Commit 35f8e46
authored
feat(apigateway): add option for consolidating lambda permissions for rest and http lambda integrations (#36021)
### Issue # (if applicable)
Fixes #9327
Fixes #19535
### Reason for this change
The maximum Lambda permission policy size can be exceeded for APIs which reuse the same Lambda function for multiple operations, as the integration adds a new permission for each operation, scoped down to the specific operation.
### Description of changes
This change updates both the REST and HTTP API lambda integrations with options to scope the permission to any operation on the API, adding a single statement and avoiding overflowing the maximum policy size.
Raised this as a new PR to replace #35705 so we have a clearer history in case we ever wanted to consider the more automatic implementation which collapses permissions.
### Describe any new or updated permissions being added
Permission for API Gateway to invoke the lambda is scoped to any resource/method/stage when `scopePermissionToMethod` (for REST) or `scopePermissionToRoute` (for HTTP) is set to `false`.
### Description of how you validated changes
Unit tests, Integ tests
Added an integration test for both REST and HTTP (`integ.lambda-permission-consolidation`).
### 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*1 parent 47a9a20 commit 35f8e46
File tree
26 files changed
+65445
-23
lines changed- packages
- @aws-cdk-testing/framework-integ/test
- aws-apigatewayv2-integrations/test/http
- integ.lambda-permission-consolidation.js.snapshot
- asset.c11608a15785084ea1afe65826e575ee316add10c8b1bb373e93297e26aec564.bundle
- aws-apigateway/test
- integ.lambda-permission-consolidation.js.snapshot
- asset.c11608a15785084ea1afe65826e575ee316add10c8b1bb373e93297e26aec564.bundle
- aws-cdk-lib
- aws-apigatewayv2-integrations
- lib/http
- test/http
- aws-apigateway
- lib/integrations
- test/integrations
26 files changed
+65445
-23
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments