Amazon API Gateway to AWS Lambda with wildcard resource-based policy

Amazon API Gateway REST API → AWS Lambda

Create a REST API with proxy integration to a Lambda function to keep the size of resource-based policy within the allowed hard limit.

Currently, in an API Gateway-Lambda setup whenever an user adds an integration, CDK adds a new policy to the Lambda function's resource-based policy.
It might result in exceeding the policy size limit for Lambda function which is 20KB.
This sample project demonstrates how to use CDK to create a customized integration that would keep the policy size within limit by using wildcards in the resource-based policy.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/apigw-lambda-wildcard-resourcebasedpolicy-cdk

Deploy

sam deploy


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack sam delete

Additional resources

Created by:

Saborni Bhattacharya

Saborni Bhattacharya

AWS SA, Cloud Enthusiast

Follow on LinkedIn