Can you create Usage Plan with Cloud Formation?

2019-05-21 08:44发布

问题:

just like in the title. I can deploy stuff on AWS using only Cloud Formation. Now I try to secure my API Gateway with API Keys and looks like I need a Usage Plan for it. It doesn't seem to be covered by the documentation right here: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-apikey.html

Have any of you had a similar problem and if yes, how did you solved it?

回答1:

AWS has today released the ability to create AWS::ApiGateway::UsagePlan using cloud formation templates

Unfortunately there isn't currently a method of Adding API Keys to a UsagePlan through CloudFormation, this has to be done manually.



回答2:

For anyone reading, this is now supported via the AWS::ApiGateway::UsagePlanKey (docs) resource type in CloudFormation. From that page:

The AWS::ApiGateway::UsagePlanKey resource associates an Amazon API Gateway API key with an API Gateway usage plan. This association determines which users the usage plan is applied to.