Skip to content

Instantly share code, notes, and snippets.

@asishrs
Created February 1, 2020 06:11
Show Gist options
  • Save asishrs/6b0de41f031c215452d74f12d8d93f45 to your computer and use it in GitHub Desktop.
Save asishrs/6b0de41f031c215452d74f12d8d93f45 to your computer and use it in GitHub Desktop.
ApiKey:
Type: AWS::ApiGateway::ApiKey
Properties:
Name: !Join ["", [{"Ref": "AWS::StackName"}, "-apikey"]]
Description: !Join ["", [{"Ref": "AWS::StackName"}, "api key"]]
Enabled: true
GenerateDistinctId: false
ApiUsagePlan:
Type: "AWS::ApiGateway::UsagePlan"
DependsOn: ApiGatewayStage
Properties:
ApiStages:
- ApiId: !Ref ApiGatewayRestApi
Stage: !Ref "apiStageName"
Description: !Join [" ", [{"Ref": "AWS::StackName"}, "usage plan"]]
UsagePlanName: !Join ["", [{"Ref": "AWS::StackName"}, "-usage-plan"]]
ApiUsagePlanKey:
Type: "AWS::ApiGateway::UsagePlanKey"
Properties:
KeyId: !Ref ApiKey
KeyType: API_KEY
UsagePlanId: !Ref ApiUsagePlan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment