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

Elastic beanstalk added this restriction automatically as it creates the bucket. To remove it you will first have to empty the bucket out.

Once done, select the bucket --> Properties --> Permissions --> Edit bucket policy.

enter image description here

You will now see the permissions Elastic Beanstalk automatically added to that bucket. Scroll to where you find the "Action": "s3:DeleteBucket", above that Change "Effect": "Deny" to "Effect": "Allow"

Once done, save change and delete the bucket.

enter image description here


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