aitchkhan
aitchkhan

Reputation: 1952

Delete a weird object in s3 bucket

I somehow endedup creating a weird object name in aws s3 bucket which is something like: 

I tried deleting it from aws cli, aws-sdk-go and from the aws console as well. Nothing seems to work. Has anyone faced an issue like this and how did you counter it?

P.S: My bucket contains 24 giga bytes of data.

s3-bucket-image

Upvotes: 1

Views: 169

Answers (2)

aitchkhan
aitchkhan

Reputation: 1952

Using aws-cli, I moved the objects I wanted to keep to another folder. After that, I ran:

$ aws s3 rm s3://mybucket/public/0 --recursive  
# where 0 is the directory containing the object I wanted to delete

Upvotes: 1

John Rotenstein
John Rotenstein

Reputation: 269340

It is likely that the name of the file includes some unprintable characters, or something that looks from in an HTML page. You can use an API call to delete it, but the hard part would be finding the exact filename!

I would use the AWS CLI to get a list of all Keys:

aws s3api list-objects-v2 --bucket my-bucket --query Contents[].Key

Then find the offending object and delete it:

aws s3 rm XXX

Upvotes: 0

Related Questions