diff --git a/packages/aws-cdk-lib/aws-apigateway/README.md b/packages/aws-cdk-lib/aws-apigateway/README.md index cfbd4f639db40..01f78150afe12 100644 --- a/packages/aws-cdk-lib/aws-apigateway/README.md +++ b/packages/aws-cdk-lib/aws-apigateway/README.md @@ -12,9 +12,9 @@ running on AWS Lambda, or any web application. - [Amazon API Gateway Construct Library](#amazon-api-gateway-construct-library) - [Table of Contents](#table-of-contents) - [Defining APIs](#defining-apis) + - [Breaking up Methods and Resources across Stacks](#breaking-up-methods-and-resources-across-stacks) - [AWS Lambda-backed APIs](#aws-lambda-backed-apis) - [AWS StepFunctions backed APIs](#aws-stepfunctions-backed-apis) - - [Breaking up Methods and Resources across Stacks](#breaking-up-methods-and-resources-across-stacks) - [Integration Targets](#integration-targets) - [Usage Plan \& API Keys](#usage-plan--api-keys) - [Adding an API Key to an imported RestApi](#adding-an-api-key-to-an-imported-restapi) @@ -76,6 +76,23 @@ const method = api.root.addResource('books').addMethod('GET'); method.grantExecute(user); ``` +### Breaking up Methods and Resources across Stacks + +It is fairly common for REST APIs with a large number of Resources and Methods to hit the [CloudFormation +limit](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html) of 500 resources per +stack. + +To help with this, Resources and Methods for the same REST API can be re-organized across multiple stacks. A common +way to do this is to have a stack per Resource or groups of Resources, but this is not the only possible way. +The following example uses sets up two Resources '/pets' and '/books' in separate stacks using nested stacks: + +[Resources grouped into nested stacks](test/integ.restapi-import.lit.ts) + +> **Warning:** In the code above, an API Gateway deployment is created during the initial CDK deployment. +However, if there are changes to the resources in subsequent CDK deployments, a new API Gateway deployment is not +automatically created. As a result, the latest state of the resources is not reflected. To ensure the latest state +of the resources is reflected, a manual deployment of the API Gateway is required after the CDK deployment. See [Controlled triggering of deployments](#controlled-triggering-of-deployments) for more info. + ## AWS Lambda-backed APIs A very common practice is to use Amazon API Gateway with AWS Lambda as the @@ -255,23 +272,6 @@ AWS Step Functions will receive the following execution input: } ``` -### Breaking up Methods and Resources across Stacks - -It is fairly common for REST APIs with a large number of Resources and Methods to hit the [CloudFormation -limit](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html) of 500 resources per -stack. - -To help with this, Resources and Methods for the same REST API can be re-organized across multiple stacks. A common -way to do this is to have a stack per Resource or groups of Resources, but this is not the only possible way. -The following example uses sets up two Resources '/pets' and '/books' in separate stacks using nested stacks: - -[Resources grouped into nested stacks](test/integ.restapi-import.lit.ts) - -> **Warning:** In the code above, an API Gateway deployment is created during the initial CDK deployment. -However, if there are changes to the resources in subsequent CDK deployments, a new API Gateway deployment is not -automatically created. As a result, the latest state of the resources is not reflected. To ensure the latest state -of the resources is reflected, a manual deployment of the API Gateway is required after the CDK deployment. See [Controlled triggering of deployments](#controlled-triggering-of-deployments) for more info. - ## Integration Targets Methods are associated with backend integrations, which are invoked when this