Skip to content
v2.274.0

ApiKeyProps Struct ​

ApiKey Properties.

Example ​

ts
const stack = new Stack(app, 'my-stack', {
  propertyInjectors: [new ApiKeyPropsInjector()],
});
new api.ApiKey(stack, 'my-api-key', {});

Properties ​

apiKeyNamestringapi_key_namestrapiKeyNameStringApiKeyNamestringApiKeyName*string#
A name for the API key.

Default: automically generated name

If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the API key name.

customerIdstringcustomer_idstrcustomerIdStringCustomerIdstringCustomerId*string= none#
An AWS Marketplace customer identifier to use when integrating with the AWS SaaS Marketplace.
defaultCorsPreflightOptionsCorsOptionsdefault_cors_preflight_optionsCorsOptionsdefaultCorsPreflightOptionsCorsOptionsDefaultCorsPreflightOptionsCorsOptionsDefaultCorsPreflightOptionsCorsOptions#
Adds a CORS preflight OPTIONS method to this resource and all child resources.

Default: CORS is disabled

You can add CORS at the resource-level using addCorsPreflight.

defaultIntegrationIntegrationdefault_integrationIntegrationdefaultIntegrationIntegrationDefaultIntegrationIntegrationDefaultIntegrationIntegration#
An integration to use as a default for all methods created within this API unless an integration is specified.

Default: Inherited from parent.

defaultMethodOptionsMethodOptionsdefault_method_optionsMethodOptionsdefaultMethodOptionsMethodOptionsDefaultMethodOptionsMethodOptionsDefaultMethodOptionsMethodOptions#
Method options to use as a default for all methods created within this API unless custom options are specified.

Default: Inherited from parent.

descriptionstringdescriptionstrdescriptionStringDescriptionstringDescription*string= none#
A description of the purpose of the API key.
enabledbooleanenabledboolenabledBooleanEnabledboolEnabled*bool= true#
Indicates whether the API key can be used by clients.
generateDistinctIdbooleangenerate_distinct_idboolgenerateDistinctIdBooleanGenerateDistinctIdboolGenerateDistinctId*bool= false#
Specifies whether the key identifier is distinct from the created API key value.
resourcesIRestApi[]resourcestyping.List[IRestApi]resourcesList<IRestApi>ResourcesIRestApi[]Resources*[]IRestApi= nonedeprecated#
- use `stages` instead
stagesIStage[]stagestyping.List[IStage]stagesList<IStage>StagesIStage[]Stages*[]IStage#
A list of Stages this api key is associated with.

Default: the api key is not associated with any stages

valuestringvaluestrvalueStringValuestringValue*string= none#
The value of the API key.

Must be at least 20 characters long.