-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@aws-cdk/aws-s3: CloudFormation stack deployment fails intermittently when adding a bucket policy and EventBridge notifications #27600
@aws-cdk/aws-s3: CloudFormation stack deployment fails intermittently when adding a bucket policy and EventBridge notifications #27600
Comments
Thank you for your report. |
I am facing the same issue, is there any update on this one? |
It looks like PutBucketPolicy and PutBucketNotification API calls are happening at the same time and causing race condition because S3 does not allow parallel bucket edits. One workaround is to add BucketPolicy as dependency to BucketNotification custom resource. This way Bucket Policy would be created before PutBucketNotification API call is made. For example:
|
|
1 similar comment
|
Describe the bug
CloudFormation stack deployment fails intermittently when adding a bucket policy (PutBucketPolicy) and EventBridge notifications (PutBucketNotification) to a S3 bucket due to race condition.
Below is my CDK code of using S3 Bucket construct with
eventBridgeEnabled: true
and adding the policy after creating the bucket.Similar issue #16811
Expected Behavior
S3 Bucket policy (PutBucketPolicy) and bucket notifications (PutBucketNotification/PutBucketNotificationConfiguration) happen without failing.
Current Behavior
Stack deployment fails intermittently
Reproduction Steps
Below is my CDK code of using S3 Bucket construct with
eventBridgeEnabled: true
and adding the policy after creating the bucket.Possible Solution
(AWS Support Recommended) Implement retry with incremental back off into the custom resource code. This includes retrying operations with an exponential back off time to cater for any issues.
aws-cdk/packages/@aws-cdk/aws-s3/lib/notifications-resource/lambda/index.py
Line 26 in ecb94d7
Additional Information/Context
No response
CDK CLI Version
2.99.1
Framework Version
No response
Node.js Version
18
OS
MacOS
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: