Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

delete S3 object

I am using .net, and I am trying to delete an object from my S3 bucket. I tried the following:

Amazon.S3.AmazonS3Client client = new Amazon.S3.AmazonS3Client(Properties.Settings.Default.AmazonS3VideoSrcKey, Properties.Settings.Default.AmazonS3VideoSrcSecret);
client.DeleteObject(new Amazon.S3.Model.DeleteObjectRequest() { BucketName = "xxxx", Key = "http://....../filename"});

I dont get IsDeleteMarker true.

What can be wrong?

thanks

like image 373
Himberjack Avatar asked Jan 14 '12 18:01

Himberjack


People also ask

Can you Delete an S3 bucket with objects in it?

If you are unable to delete an Amazon S3 bucket, consider the following: Make sure the bucket is empty – You can only delete buckets that don't have any objects in them.

How do you Delete a bucket object?

Deleting an objectIn the Buckets list, choose the name of the bucket that you want to delete an object from. Select the check box to the left of the names of the objects that you want to delete. Choose Actions and choose Delete from the list of options that appears.

What happens to an object when we Delete it from Amazon S3?

To delete an object version in a bucket with bucket versioning enabled, Amazon S3 will permanently delete the object version.

How can you Delete an object?

Procedure. Right-click over the objects you want to delete, and choose Delete. In the Delete dialog box, select the objects you want to delete from the list.

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.

How long does it take to delete an S3 object?

When you delete a bucket, there may be a delay of up to one hour before the bucket name is available for reuse in a new region or by a new bucket owner. If you re-create the bucket in the same region or with the same bucket owner, there is no delay.


1 Answers

Does your keys have an http://... prefix?

My guess is that you are mistakenly passing a URL instead of a key. Your request should probably look more like this:

client.DeleteObject(new Amazon.S3.Model.DeleteObjectRequest() { BucketName = "xxxx", Key = "filename"});
like image 80
Chen Harel Avatar answered Sep 28 '22 01:09

Chen Harel