AWS::ApiGateway::UsagePlan
The AWS::ApiGateway::UsagePlan resource specifies a usage plan for deployed Amazon API Gateway (API Gateway) APIs.
A usage plan enforces throttling and quota limits on individual client API keys. For
more information, see Creating and Using API Usage Plans in Amazon API Gateway in the API Gateway Developer Guide.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::ApiGateway::UsagePlan", "Properties" : { "ApiStages" : [ApiStage, ...], "Description" :String, "Quota" :QuotaSettings, "Throttle" :ThrottleSettings, "UsagePlanName" :String} }
YAML
Type: AWS::ApiGateway::UsagePlan Properties: ApiStages: -ApiStageDescription:StringQuota:QuotaSettingsThrottle:ThrottleSettingsUsagePlanName:String
Properties
ApiStages-
The API stages to associate with this usage plan.
Required: No
Type: List of Amazon API Gateway UsagePlan ApiStage
Update requires: No interruption
Description-
The purpose of this usage plan.
Required: No
Type: String
Update requires: No interruption
Quota-
Configures the number of requests that users can make within a given interval.
Required: No
Type: Amazon API Gateway UsagePlan QuotaSettings
Update requires: No interruption
Throttle-
Configures the overall request rate (average requests per second) and burst capacity.
Required: No
Type: Amazon API Gateway UsagePlan ThrottleSettings
Update requires: No interruption
UsagePlanName-
A name for this usage plan.
Required: No
Type: String
Update requires: No interruption
Return Value
Ref
When the logical ID of this resource is provided to the Ref intrinsic function, Ref returns the usage plan ID, such as MyUsagePlan.
For more information about using the Ref function, see Ref.
Examples
The following examples create a usage plan for the Prod API stage, with a quota of 5000 requests per month and a rate limit of 100 requests
per second.
JSON
"usagePlan" : { "Type" : "AWS::ApiGateway::UsagePlan", "Properties" : { "ApiStages" : [ {"ApiId" : { "Ref" : "MyRestApi" }, "Stage" : { "Ref" : "Prod" }} ], "Description" : "Customer ABC's usage plan", "Quota" : { "Limit" : 5000, "Period" : "MONTH" }, "Throttle" : { "BurstLimit" : 200, "RateLimit" : 100 }, "UsagePlanName" : "Plan_ABC" } }
YAML
usagePlan: Type: AWS::ApiGateway::UsagePlan Properties: ApiStages: - ApiId: !Ref 'MyRestApi' Stage: !Ref 'Prod' Description: Customer ABC's usage plan Quota: Limit: 5000 Period: MONTH Throttle: BurstLimit: 200 RateLimit: 100 UsagePlanName: Plan_ABC
