Unable to delete S3 bucket as it does not exist - amazon-web-services

Brand new AWS account today, created a bucket to host static webpages.
Created via the web interface and configured it to be open to public (could access the page through "bucket-name.s3-website.eu-west-2.amazonaws.com")
I clicked to delete the bucket via the interface and nothing happened.
It's worth noting that since then clicking the bucket and navigating through the config no shows "No data" errors on the UI. The bucket policy section is empty.
Trying to add myself back into the properties as per -Unable to delete S3 bucket
gives me "an unexpected error occurred".
It shows the following properties when you click on the bucket
Events 0 Active notifications
Versioning -
MFA delete -
Logging Disabled
Static web hosting Disabled
Tags 0 Tags
Requester pays Disabled
Object lock Disabled
Transfer acceleration Disabled
Permissions
Owner REDACTED
Block public access Disabled
Bucket policy No
Access control list 0 Grantees
CORS configuration No
Management
Lifecycle Disabled
Replication Disabled
Analytics Disabled
Inventory Disabled
Metrics Disabled
Tried via the cli
aws s3 rb s3://bucket-name --force --debug
aws s3api delete-bucket --bucket bucket-name
aws s3api get-bucket-policy-status --bucket bucket-name
which tells me the bucket does not exist
fatal error: An error occurred (NoSuchBucket) when calling the ListObjectsV2 operation: The specified bucket does not exist
remove_bucket failed: Unable to delete all objects in the bucket, bucket will not be deleted.
Back to the web interface I have tried creating a new bucket with the same name but it blocks me as it already exists.
Looking around online seems to indicate it's either because there is no longer a region specified or alternatley that it is simply taking a while to reflect that it has been deleted, but I have since created and deleted other buckets without issue.

Update: Bucket disappeared of its own accord after around 20 hours. For anyone experiencing similar problems it appears patience is your only option.

Related

S3 Bucket - setting policy to "acknowledge that existing objects with the same name will be overwritten."

I have suspended object versioning on my S3 Bucket, but I don't want to have to select the check box that says "I acknowledge that existing objects with the same name will be overwritten" every time I upload photos to the s3 bucket.
I successfully set up an S3 Bucket Policy to make it so I don't have to specify that I want the uploads to be publicly viewable on every upload. Is there also an S3 Bucket Policy I can set to bypass the checkmark as well?
Thank you
Is there also an S3 Bucket Policy I can set to bypass the checkmark as well?
Sadly, this is new S3 console future. It is not related to the bucket policies.
You can use AWS CLI or SDK to upload objects "peacefully", without any distractions if you want to skip all the S3 console steps.

Access denied to the bucket ******

I am new to AWS and i am trying to export VM images from AWS EC2 to S3 bucket that I had already imported using VMImport/Export service . I tried to export using AWS CLI and SDK (python) as well , but both returns the same error :
An error occurred (InvalidParameter) when calling the ExportImage operation: Access denied to the bucket ******23
Entered parameters are correct and i have given all public access to the S3 bucket used in Export action. Still the error continues to appear.
Any help would be greatly appreciated
Thanks in advance
I was facing the same issue , make sure the open the bucket and again give permission write read in S3 bucket as attached in image
Step 1Open your bucket s3 in console
step 2Go to permission tab
Step 3Make it public and ACL
Step 4Give the read write permissions
But best practice make IAM and add that account to permissions

Delete S3 bucket in a strange state

I have a problem with removing S3 bucket with the following ERROR state (check this image).
I tried to remove it via aws cli but the result is of course:
aws s3 rb s3://hierarchy --force
fatal error: An error occurred (AccessDenied) when calling the ListObjects operation: Access Denied
I can't change anything (bucket policy, etc.) on this bucket.
I have to mention that I'm administrator and have all privileges on the AWS account.
Google does not help me. I would like to know if is it possible to remove bucket like this.
It is possible that there is a Bucket Policy containing a Deny statement that is preventing your access.
Find somebody who has access to the Root credentials, which should be able to delete it.
If that fails, contact AWS Support.

How to sync data between two s3 buckets owned by different profiles

I want to sync data between two s3 buckets.
The problem is that each one is owned by different AWS accounts (i.e. access key id and secret access key).
I tried to make the destination bucket publicly writable, but I still get
fatal error: An error occurred (AccessDenied) when calling the ListObjects operation: Access Denied
How to solve this?
I solved by giving permissions to write the destination bucket to the source bucket's AWS account.
I went to bucket "Permissions" tab of the destination bucket, "Access for other AWS accounts" and I gave permissions to the source bucket's AWS account by using the account email.
Then I copied the files by using AWS CLI (don't forget to grant full access to the recipient account!):
aws s3 cp s3://<source_bucket>/<folder_path>/ s3://<destination_bucket> --recursive --profile <source_AWSaccount_profile> --grants full=emailaddress=<destination_account_emailaddress>

Can't Delete Empty S3 Bucket

I have an S3 bucket that is 100% empty. Versioning was never enabled on the bucket. However, I still cannot remove the bucket. I have tried via the Console and the CLI tool. On the console it just says "Error" with no error message. From the cli and api it tells me: "An error occurred (BucketNotEmpty) when calling the DeleteBucket operation: The bucket you tried to delete is not empty". I have tried all of the following:
aws s3 rb s3://<bucket_name> --force -> BucketNotEmpty
aws s3 rm s3://<bucket_name> --recursive -> No output (because it's already empty)
aws s3api list-object-versions --bucket <bucket_name> -> No output (because versioning was never enabled)
aws s3api list-multipart-uploads --bucket <bucket_name> -> No outputs
aws s3api list-objects --delimiter=/ --prefix= --bucket <bucket_name> -> No Output (because it's empty)
It has no dependencies (it's not used by cloudfront or anything else that I'm aware of).
The bucket has been empty for approximately 5 days.
I was able to delete another very similar bucket with the same IAM user. Additionally my IAM user has Admin access.
I was facing this same problem. I was able to fix the issue by going into the bucket and deleting the "Bucket Policy" for the bucket. After that, deleting the bucket worked correctly.
I did this through the AWS console, for an S3 bucket created by Elastic Beanstalk (ie elasticbeanstalk-us-west-2-861587641234). I imagine the creation script includes a policy to prevent people from accidentally deleting the bucket.
I had a similar issue and was able to delete the bucket after waiting overnight.
It's a pretty weak solution but may save you and other some time from pounding on it.
If it's still not deleting after all the actions in the comments there are some things that only AWS support can fix properly. Again a weak answer but register a ticket with AWS support and then post their response here as an answer for others.
To delete an Elastic Beanstalk storage bucket (console)
1. Open the Amazon S3 Management Console
2. Select the Elastic Beanstalk storage bucket.
3. Choose Properties.
4. Choose Permissions.
5. Choose Edit Bucket Policy - Allow to delete and make it public.
6. Save.
7. Choose Actions and then choose Delete Bucket.
8, Type the name of the bucket and then choose Delete.
This is what had worked for me. I didn't have versioning enabled on the bucket. When you delete an object from s3 bucket, it puts a 'delete marker' on that object and hides it from the listing. When you click 'show' version button you will see your deleted objects with the delete marker. Select this object (with delete marker) and delete again. This is a permanent delete. Now your object is really gone and your bucket is really empty. After this I was able to delete my bucket.
I guess, versioning=true only means that s3 will create versions of the object if you upload with the same name.
For users who are facing similar issue.
I tried #Federico solution still no success. There was an other option "Empty" next to delete.
So I emptied the bucket first and then tried delete, it worked.
I was facing an issue with deleting the Elastic Beanstalk storage bucket.
Follow the below steps:
1. Select the Elastic Beanstalk storage bucket.
2. Choose Permissions.
3. Delete the bucket policy
4. Save.
If your bucket is empty, you can delete the bucket.
Sometimes after attempting to delete a bucket, it's not actually deleted, but the permissions are lost.
In my case, I went to the "permissions" tab, re-granted permissions to myself, and was then able to remove it
I had the same issue and there was not a policy, so added permission for the email I was logged in with and saved. After granting myself permission I was able to delete the bucket. I also had another bucket that had a policy, so I delete the policy and was able to delete that bucket as well.
Using aws cli :
# delete contents of a bucket
aws s3api delete-objects --bucket nameOfYourBucket --delete "$(aws s3api list-object-versions --bucket nameOfYourBucket --query='{Objects: Versions[].{Key:Key,VersionId:VersionId}}')"
# delete older version files from bucket
aws s3api delete-objects --bucket nameOfYourBucket --delete "$(aws s3api list-object-versions --bucket nameOfYourBucket --query='{Objects: DeleteMarkers[].{Key:Key,VersionId:VersionId}}')"
And then you can delete the bucket.
i made the s3 bucket permission to public, and gave access to everyone. Then i was able to delete the Bucket from the AWS console.
I am using the AWS Console to perform deletion of the bucket.
had the same problem and I tried all the above solutions and not worked for me then I figured out another way.
My bucket was used by ElasticBean and whenever I deleted the bucket the ElasticBean created one automatically. I then deleted the ElasticBean service and tried to delete the bucket again but not worked again this time, the bucket was empty but was not allowing to delete.
I tried to change permissions but the bucket was still there.
Finally I deleted the bucket policy and came back and deleted the bucket and it was gone.
Problem solved
I tried to look at many of the solutions mentioned. The only thing that worked for me is deleting it through Cyberduck (I neither work for nor am promoting Cyberduck, i genuinely used it and it worked). Here are the steps of what I did:
1 - Download and install Cyberduck.
2 - Click on Open Connection
3 - Select Amazon S3 from the dropdown (default would be FTP)
4 - Enter your access key ID and secret Access key (if you dont have one then you need to create one on your s3 bucket through IAM on AWS)
5 - You will see a list your S3 buckets. Select the file or folder or bucket you want to delete, right click and delete. Even files with 0kb show up here and can be deleted.
Hope this helps