Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix 'Access Denied' while deleting empty S3 Elastic Beanstalk?

I've noticed some Elastic Beanstalk is drawing about $20 to $30 every month on my AWS account and it turns out it is an empty S3 bucket.

I tried deleting it but it returns "Access Denied" error.

Access Denied

I also tried to use life cycle to remove it, but it also didn't work. Here is how I set up the life cycle:

Life Cycle

I set it to remove 1 day after creation

enter image description here

like image 835
Aero Wang Avatar asked Oct 03 '15 18:10

Aero Wang


People also ask

How do I fix an AWS S3 bucket policy and Public permissions access denied error?

If you're denied permissions, then use another IAM identity that has bucket access, and edit the bucket policy. Or, delete and recreate the bucket policy if no one has access to it. If you're trying to add a public read policy, then disable the bucket's S3 Block Public Access.

Why can't I delete my S3 bucket?

Short description. You can't delete an S3 bucket using the Amazon S3 console if the bucket contains 100,000 or more objects. You can't delete an S3 bucket using the AWS CLI if versioning is enabled. For more information, see Deleting a bucket.

Can you delete non empty S3 bucket?

If your bucket does not have versioning enabled, you can use the rb (remove bucket) AWS CLI command with --force parameter to remove a non-empty bucket. This command deletes all objects first and then deletes the bucket.


1 Answers

Check the bucket policy on the S3 bucket. The bucket name seems to be the standard bucket that beanstalk creates to store your application versions, logs etc. To prevent accidental deletion of the bucket, the bucket policy denies delete permission. You can update the permissions on the S3 bucket policy to allow delete from your root account. Most likely your bucket policy currently does not allow deletion of the bucket. Then you will be able to delete the bucket.

Read more about S3 bucket permissions here: http://docs.aws.amazon.com/AmazonS3/latest/UG/EditingBucketPermissions.html

like image 182
Rohit Banga Avatar answered Sep 23 '22 07:09

Rohit Banga