Skip to content
v2.277.0

RateLimitedApiKeyProps Struct ​

RateLimitedApiKey properties.

Example ​

ts
declare const api: apigateway.RestApi;

const key = new apigateway.RateLimitedApiKey(this, 'rate-limited-api-key', {
  customerId: 'hello-customer',
  apiStages: [{ stage: api.deploymentStage }],
  quota: {
    limit: 10000,
    period: apigateway.Period.MONTH
  }
});
python
# api: apigateway.RestApi


key = apigateway.RateLimitedApiKey(self, "rate-limited-api-key",
    customer_id="hello-customer",
    api_stages=[apigateway.UsagePlanPerApiStage(stage=api.deployment_stage)],
    quota=apigateway.QuotaSettings(
        limit=10000,
        period=apigateway.Period.MONTH
    )
)
java
RestApi api;


RateLimitedApiKey key = RateLimitedApiKey.Builder.create(this, "rate-limited-api-key")
        .customerId("hello-customer")
        .apiStages(List.of(UsagePlanPerApiStage.builder().stage(api.getDeploymentStage()).build()))
        .quota(QuotaSettings.builder()
                .limit(10000)
                .period(Period.MONTH)
                .build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
RestApi api;


var key = new RateLimitedApiKey(this, "rate-limited-api-key", new RateLimitedApiKeyProps {
    CustomerId = "hello-customer",
    ApiStages = new [] { new UsagePlanPerApiStage { Stage = api.DeploymentStage } },
    Quota = new QuotaSettings {
        Limit = 10000,
        Period = Period.MONTH
    }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var api RestApi


key := apigateway.NewRateLimitedApiKey(this, jsii.String("rate-limited-api-key"), &RateLimitedApiKeyProps{
	CustomerId: jsii.String("hello-customer"),
	ApiStages: []UsagePlanPerApiStage{
		&UsagePlanPerApiStage{
			Stage: api.DeploymentStage,
		},
	},
	Quota: &QuotaSettings{
		Limit: jsii.Number(10000),
		Period: apigateway.Period_MONTH,
	},
})

Properties ​

apiKeyNameoptionalstringapi_key_nameoptionalstrapiKeyNameoptionalStringApiKeyNameoptionalstringApiKeyNameoptional*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.

apiStagesoptionalUsagePlanPerApiStage[]api_stagesoptionaltyping.List[UsagePlanPerApiStage]apiStagesoptionalList<UsagePlanPerApiStage>ApiStagesoptionalUsagePlanPerApiStage[]ApiStagesoptional*[]UsagePlanPerApiStage = none #
API Stages to be associated with the RateLimitedApiKey.
notes

If you already prepared UsagePlan resource explicitly, you should use stages property. If you prefer to prepare UsagePlan resource implicitly via RateLimitedApiKey, or you should specify throttle settings at each stage individually, you should use apiStages property.

customerIdoptionalstringcustomer_idoptionalstrcustomerIdoptionalStringCustomerIdoptionalstringCustomerIdoptional*string = none #
An AWS Marketplace customer identifier to use when integrating with the AWS SaaS Marketplace.
defaultCorsPreflightOptionsoptionalCorsOptionsdefault_cors_preflight_optionsoptionalCorsOptionsdefaultCorsPreflightOptionsoptionalCorsOptionsDefaultCorsPreflightOptionsoptionalCorsOptionsDefaultCorsPreflightOptionsoptionalCorsOptions #
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.

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

Default: Inherited from parent.

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

Default: Inherited from parent.

descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string = none #
A description of the purpose of the API key.
enabledoptionalbooleanenabledoptionalboolenabledoptionalBooleanEnabledoptionalboolEnabledoptional*bool = true #
Indicates whether the API key can be used by clients.
generateDistinctIdoptionalbooleangenerate_distinct_idoptionalboolgenerateDistinctIdoptionalBooleanGenerateDistinctIdoptionalboolGenerateDistinctIdoptional*bool = false #
Specifies whether the key identifier is distinct from the created API key value.
quotaoptionalQuotaSettingsquotaoptionalQuotaSettingsquotaoptionalQuotaSettingsQuotaoptionalQuotaSettingsQuotaoptionalQuotaSettings = none #
Number of requests clients can make in a given time period.
resourcesoptionalIRestApi[]resourcesoptionaltyping.List[IRestApi]resourcesoptionalList<IRestApi>ResourcesoptionalIRestApi[]Resourcesoptional*[]IRestApi = none deprecated #
- use `stages` instead
stagesoptionalIStage[]stagesoptionaltyping.List[IStage]stagesoptionalList<IStage>StagesoptionalIStage[]Stagesoptional*[]IStage #
A list of Stages this api key is associated with.

Default: the api key is not associated with any stages

throttleoptionalThrottleSettingsthrottleoptionalThrottleSettingsthrottleoptionalThrottleSettingsThrottleoptionalThrottleSettingsThrottleoptionalThrottleSettings = none #
Overall throttle settings for the API.
valueoptionalstringvalueoptionalstrvalueoptionalStringValueoptionalstringValueoptional*string = none #
The value of the API key.

Must be at least 20 characters long.