An error occurred (AccessDenied) when calling the DeleteBucket operation: Access Denied
[ec2-user@ip-172-31-31-84 temp]$ aws s3 rb --force s3://elasticbeanstalk-us-east-2-719330736384/
remove_bucket failed: s3://elasticbeanstalk-us-east-2-719330736384/ An error occurred (AccessDenied) when calling the DeleteBucket operation: Access Denied
The "403 Access Denied" error can occur due to the following reasons: Your AWS Identity and Access Management (IAM) user or role doesn't have permissions for both s3:GetBucketPolicy and s3:PutBucketPolicy. The bucket policy denies your IAM identity permission for s3:GetBucketPolicy and s3:PutBucketPolicy.
If you're trying to host a static website using Amazon S3, but you're getting an Access Denied error, check the following requirements: Objects in the bucket must be publicly accessible. S3 bucket policy must allow access to the s3:GetObject action. The AWS account that owns the bucket must also own the object.
If you're getting Access Denied errors on public read requests that are allowed, check the bucket's Amazon S3 Block Public Access settings. Review the S3 Block Public Access settings at both the account and bucket level. These settings can override permissions that allow public read access.
Elastic Beanstalk Bucket policies by default denies deletion.
Go to the bucket's policy (bucket --> properties --> permissions --> edit bucket policy)
Then find this statement
{
"Sid": xxxxxxxxx,
"Effect": "Deny",
"Principal": {
"AWS": "*"
},
"Action": "s3:DeleteBucket",
"Resource": xxxxxxxxxx
}
Change the Effect from Deny to Allow.
Save the change to the Bucket Policy.
Try deleting again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With