Skip to content
v2.278.0

RateLimitedApiKeyProps Struct ​

RateLimitedApiKey properties.

Example ​

ts
declare const api: apigwv2.WebSocketApi;
declare const stage: apigwv2.WebSocketStage;

const key = new apigwv2.RateLimitedApiKey(this, 'rate-limited-api-key', {
  customerId: 'test-customer',
  apiStages: [{
    api: api,
    stage: stage
  }],
  quota: {
    limit: 10000,
    period: apigwv2.Period.MONTH
  },
  throttle: {
    rateLimit: 100,
    burstLimit: 200
  }
});
python
# api: apigwv2.WebSocketApi
# stage: apigwv2.WebSocketStage


key = apigwv2.RateLimitedApiKey(self, "rate-limited-api-key",
    customer_id="test-customer",
    api_stages=[apigwv2.UsagePlanPerApiStage(
        api=api,
        stage=stage
    )],
    quota=apigwv2.QuotaSettings(
        limit=10000,
        period=apigwv2.Period.MONTH
    ),
    throttle=apigwv2.ThrottleSettings(
        rate_limit=100,
        burst_limit=200
    )
)
java
WebSocketApi api;
WebSocketStage stage;


RateLimitedApiKey key = RateLimitedApiKey.Builder.create(this, "rate-limited-api-key")
        .customerId("test-customer")
        .apiStages(List.of(UsagePlanPerApiStage.builder()
                .api(api)
                .stage(stage)
                .build()))
        .quota(QuotaSettings.builder()
                .limit(10000)
                .period(Period.MONTH)
                .build())
        .throttle(ThrottleSettings.builder()
                .rateLimit(100)
                .burstLimit(200)
                .build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
WebSocketApi api;
WebSocketStage stage;


var key = new RateLimitedApiKey(this, "rate-limited-api-key", new RateLimitedApiKeyProps {
    CustomerId = "test-customer",
    ApiStages = new [] { new UsagePlanPerApiStage {
        Api = api,
        Stage = stage
    } },
    Quota = new QuotaSettings {
        Limit = 10000,
        Period = Period.MONTH
    },
    Throttle = new ThrottleSettings {
        RateLimit = 100,
        BurstLimit = 200
    }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var api WebSocketApi
var stage WebSocketStage


key := apigwv2.NewRateLimitedApiKey(this, jsii.String("rate-limited-api-key"), &RateLimitedApiKeyProps{
	CustomerId: jsii.String("test-customer"),
	ApiStages: []UsagePlanPerApiStage{
		&UsagePlanPerApiStage{
			Api: api,
			Stage: stage,
		},
	},
	Quota: &QuotaSettings{
		Limit: jsii.Number(10000),
		Period: apigwv2.Period_MONTH,
	},
	Throttle: &ThrottleSettings{
		RateLimit: jsii.Number(100),
		BurstLimit: jsii.Number(200),
	},
})

Properties ​

apiKeyNameoptionalstringapi_key_nameoptionalstrapiKeyNameoptionalStringApiKeyNameoptionalstringApiKeyNameoptional*string #
A name for the API key.

Default: automatically 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.
customerIdoptionalstringcustomer_idoptionalstrcustomerIdoptionalStringCustomerIdoptionalstringCustomerIdoptional*string = none #
An AWS Marketplace customer identifier to use when integrating with the AWS SaaS Marketplace.
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.
throttleoptionalThrottleSettingsthrottleoptionalThrottleSettingsthrottleoptionalThrottleSettingsThrottleoptionalThrottleSettingsThrottleoptionalThrottleSettings = none #
Overall throttle settings for the API.
valueoptionalstringvalueoptionalstrvalueoptionalStringValueoptionalstringValueoptional*string = none #
The value of the API key.

Must be at least 20 characters long.