aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.68k stars 3.93k forks source link

support custom values in API key #7584

Closed gandlusn closed 4 years ago

gandlusn commented 4 years ago

I want to create API key with custom value for API gateway usage plan, but as of now I don't see a attribute to set value of the API[1], I am aware that CDK converts code into CF template, and Cloud Formation has Value attribute defined in it[2], then my question is is there a way to create custom-api key in API Gateway using CDK

https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-apigateway/lib/api-key.ts

[1]. https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-apigateway/lib/api-key.ts [2]. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-apikey.html#cfn-apigateway-apikey-generatedistinctid

gandlusn commented 4 years ago
  1. what you’re trying to do? Ans: I want to create a API Key using AWS CDK, in which I wants to provide a custom value, similar to cloud formation template provided below, that creates a API Key, with the Custom value provided by user in Properties.

ApiKey: Type: 'AWS::ApiGateway::ApiKey' DependsOn:

How can I replicate same thing in AWS CDK.

  1. what you expect? If possible can you share a sample code to implement this, or share some articles that I can follow to accomplish this task.

Thank you

nija-at commented 4 years ago

Looks like we don't support this value in the CDK just yet. Marking this as a feature request.

Until then, you can use overrides to add this to the underlying cfn layer. This should work as a workaround here.

nija-at commented 4 years ago

Turns out we already have an issue open for this - https://github.com/aws/aws-cdk/issues/3233. Resolving as duplicate.