From 079c1e23b6c31ddfe0ac12e2c948866ce2a768a4 Mon Sep 17 00:00:00 2001 From: Mohamed Elasmar <71043312+moelasmar@users.noreply.github.com> Date: Mon, 23 Dec 2024 15:18:17 -0800 Subject: [PATCH] chore(apigateway): fix the readme sections order. (#32650) ### Description of changes Fixes the readme sections order to match the original order when `Breaking up Methods and Resources across Stacks` section was originally added in this PR https://github.com/aws/aws-cdk/pull/8270. The current order does not make sense, this section does not related to the Step function backed rest API ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk-lib/aws-apigateway/README.md | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) 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