Reputation: 540
I'm using AWS CDK v2 for deploying the stack which has a Lambda and rest API gateway.
When I'm deploying the stack, I'm getting following error:
The final policy size (20798) is bigger than the limit (20480). (Service: AWSLambdaInternal; Status Code: 400; Error Code: PolicyLengthExceededException
If I understand correctly AWS CDK automatically generates the resource policy for API gateway resources and attached it to lambda permission. As there are many APIs, I'm getting this error.
I'm trying to create an inline policy and attach it to lambda directly. But I'm not sure how to disable the policy which is automatically getting generated for API gateway by AWS CDK.
Thanks for the help!
Upvotes: 0
Views: 1042
Reputation: 2787
Based on your information
I have multiple endpoints in api gateway which is pointing to same lambda.
You can create multiple lambda functions pointing to the same source code and use them as API endpoint integrations. This will prevent the policy of the given function to be too big.
Upvotes: 0