Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

An error occurred (AccessDenied) when calling the DeleteBucket operation: Access Denied

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

like image 238
Naresh Etikyala Avatar asked Feb 05 '18 14:02

Naresh Etikyala


People also ask

Why is my S3 bucket 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.

Why is S3 object URL Access Denied?

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.

Why am I getting an access denied error message when I upload files to my Amazon S3 bucket?

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.


1 Answers

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.

like image 76
J. Parashar Avatar answered Oct 21 '22 07:10

J. Parashar