aws-lambda: Log retention gives rate exceeded error #31338
Labels
@aws-cdk/aws-lambda
Related to AWS Lambda
bug
This issue is a bug.
effort/medium
Medium work item – several days of effort
p2
Describe the bug
Legacy log retention in Lambda gives a rate limit exceeded error.
We are in the process of upgrading our app from CDK v1 to v2. To test this, we created a new env in a new account and redeployed the configuration using CDK v1.
We are creating 70-80 lambdas with log retention enabled. The legacy log retention creates a custom lambda resource to create log group and set log retention. CDK V1 used to create Node 14 lambas for this purpose (for which the creation is blocked in AWS). Hence, we disabled the log retention and upgraded the stack to 2.151.0 and then enabled the log retention.
While doing so, our stack is failing with the error:
Initially we thought this is an issue with the
“CreateLogGroup throttle limit in transactions per second” quota
. We increased it to 80 from 10 but the issue still exists.On exploring the cloudwatch logs for the custom lambda resource, we found:
Looks like an issue with the rate limit for
PutRetentionPolicyCommand
. The service quota for the same cannot be changed. Our earlier implementation had one difference in how log retention was implemented.The
base
property was enabled to apply a exponential backoff (probably to handle such cases). This is now deprecated and hence we removed it during our upgrade from CDK v1 to v2. The documentation for LogRetentionRetryOptions says that this was removed as it is handled differently in AWS SDK v3. Is this what is causing the issue? Should't CDK/ SDK handle the backoff in this case?Regression Issue
Last Known Working CDK Version
1.204.0
Expected Behavior
Log retention backoff should be handled internally
Current Behavior
Creating legacy log retention for multiple lambas together gives a rate limit exceeded error.
Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.108.1
Framework Version
No response
Node.js Version
v22.1.0
OS
MacOs
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: