Reputation: 9217
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.
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:
I set it to remove 1 day after creation
Upvotes: 81
Views: 40650
Reputation: 83
go to buckets--> permissions --> click on edit bucket policy and then then delete the policy then you can easily able to delete bucket
Upvotes: 1
Reputation: 13227
The bucket can be deleted only in the following 3 steps:
Select the bucket to be deleted then click on Permission section in opened drawer window
Click on Bucket Policy button
Replace Deny
word with Allow
in the object that has "Action": "s3:Deletebucket"
line then click on Save button
Thereafter you can delete the bucket.
Figure for step 1:
Figure for step 2:
Figure for step 3:
Upvotes: 2
Reputation: 61
Very short and simple approach would be (if you are sure that you no longer require the bucket) is to remove the bucket policy and then try to delete the bucket. Works in all cases. As the bucket is created by Elastic Beanstalk and configured policy will not allow any changes/delete by other users. Removing policy will allow you to perform action.
Upvotes: 3
Reputation: 4718
By default, Elastic Beanstalk set some policies on your bucket that prevents the delete operation on the bucket to prevent accidental deletion of the bucket.
I highlighted the operation in red in the image below.
Step to delete the bucket:
Once complete, you go back to the list of the buckets and try to delete the bucket now.
DONE
Happy Coding
Upvotes: 19
Reputation: 380
I also came across the same error while deleting the bucket created by EBS "Access Denied" because by default EBS denies DELETE operation on s3 bucket create by it as it is used by EBS for storing logs of application any other pieces of information. To delete it you have to change the bucket's policy Steps:- Bucket => Properties => Permissions => Bucket Policy edit the bucket policy where "Action": "s3:DeleteBucket" change the "Effect": "Deny" to "Effect": "Allow"
Upvotes: 2
Reputation: 7211
This is Elastic beanstalk resection to save your accidental deletion. you can solve this issues by following 2 steps.
bucket => Properties => Permissions => Edit bucket policy
and set allow "Effect": "Allow"
from "Effect": "Deny"
Check below screenshot for more help.
Permission SCreenshot:
Bucket Policy
Upvotes: 18
Reputation: 1633
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.
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.
Upvotes: 79
Reputation: 18918
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
Upvotes: 161