aws-samples / aws-cdk-examples

Example projects using the AWS CDK
Apache License 2.0
4.95k stars 2.1k forks source link

CREATE_FAILED | AWS::S3::BucketPolicy | (Service: S3, Status Code: 403) #1029

Open hellofadude opened 2 months ago

hellofadude commented 2 months ago

Describe the bug

Static-site-stack - Python

If you are using an identity other than the root user (i.e. user with administrative credentials in Identity center per best practice) of the AWS account that owns the bucket, the calling identity must have the PutBucketPolicy permissions on the specified bucket and belong to the bucket owner's account in order to use this operation.

If you don't have PutBucketPolicy permissions, Amazon S3 returns a 403 Access Denied error

Expected Behavior

stack deploys correctly

Current Behavior

stack fails creation

Reproduction Steps

cdk deploy

Possible Solution

Add a s3:PutBucketPolicy action to the PolicyStatement

Additional Information/Context

No response

CDK CLI Version

2.139.0 (build 2699ffd)

Framework Version

No response

Node.js Version

v20.0.0

OS

Ubuntu 22.04.4 LTS

Language

Python

Language Version

3.10.12