Replies: 1 comment 3 replies
-
This seems to be a limitation of the AWS APIs, maybe not strictly a CDK thing. There aren't L1 constructs for associating an existing usage plan to a api stage. Only for creating the usage plan and associating it all together. I think my scenario is similar, but the dependecies are inverted. I have a separate Infrastructure stack which defines my VPC, and I'd like the add the usage plan to this stack. I can then template out my Application stack, and run that stack multiple times for different environments. I want to share that usage plan across these Application stacks. I can use the usagePlanId along with: var usagePlan = APIGW.UsagePlan.FromUsagePlanId(this, "UsagePlan", props.UsagePlanId); but then usagePlan.AddApiStage(new UsagePlanPerApiStage
{
Api = props.Api,
Stage = props.Api.DeploymentStage
}); |
Beta Was this translation helpful? Give feedback.
-
Describe the feature
How to attach an existing usage plan to an api gateway using CDK
Use Case
Cx wants to import existing usagePlan for aws-api-gateway using CDK, but running into this error below:
Resource handler returned message: "Invalid API Stage {api: %s, stage: %s} specified for usageplan %s (Service: ApiGateway, Status Code: 400, Request ID: ...)" (RequestToken: ..., HandlerErrorCode: InvalidRequest)
Proposed Solution
Tried to create new usagePlan from the link here : https://docs.aws.amazon.com/cdk/api/v1/docs/@aws-cdk_aws-apigateway.UsagePlan.htmlbut same error occurred. I have included the code snippet
Other Information
Acknowledgements
CDK version used
2.46.0
Environment details (OS name and version, etc.)
Windows
Beta Was this translation helpful? Give feedback.
All reactions