Deleting S3 objects

Instructions

Q&A (0)

Notes (0)

Resources (0)

Saving Progress...

Resources

There are no resources for this lesson.

Notes can be saved and accessed anywhere in the course. They also double as bookmarks so you can quickly review important lesson material.

Create note

To delete an object, first, choose the bucket that contains the object you want to delete. In my case, I will be selecting the myfirstbucket129:

image 17
Select your AWS S3 Bucket

Next we should see if we have bucket versioning enabled or not. We can do that by going to the properties tab and scrolling down to note if we have bucket versioning enabled or not for this bucket.

image 18
image 18

Once we've done that, we can go back to the objects tab and select the object and choose delete:

image 16
Delete an AWS S3 Object

Versioning Disabled

If you are deleting an object from a versioning-enabled bucket with versioning off, Amazon S3 will create a delete marker. To permanently delete the object, type "delete" in the text field and confirm your choice:

image 19
Permanently deleting an AWS S3 Object with Versioning Disabled

In case you didn't know, here is a quick explanation of what a delete marker is:

A delete marker in Amazon S3 is a placeholder for a versioned object that was named in a DELETE request. It allows Amazon S3 to behave as if the object has been deleted, even though it is still stored in the bucket.

What is an AWS S3 Delete Marker?

Versioning Enabled

If you are deleting an object from a versioning-enabled bucket with versioning on, Amazon S3 will permanently delete the object version.

To delete the object, select the object version that you want to delete and choose delete. Then, confirm your choice by typing "delete" in the text field.

image 20
Permanently deleting an AWS S3 Object with Versioning Enabled

Once you have deleted the object, you will see a success message stating the object was deleted:

image 21
AWS S3 object Successfully Deleted

Recovering deleted objects

It's important to note that deleting an object from a bucket is permanent and cannot be undone unless you have bucket versioning enabled. To recover an S3 object that you have deleted when the bucket has versioning enabled, browse to the folder where the deleted object was located.

Click Show versions, thenclick the checkbox next to the Delete Marker and finally click the Delete button to remove the marker:

image 22
Deleting and AWS S3 Delete Marker

Next, you'll need to confirm you want to delete the marker by entering permanently delete and clicking Delete objects:

image 24
Deleting

In order to delete a delete marker, you need the s3:DeleteObjectVersion permission and must use the AWS account that owns or created the bucket.

Permissions Requirement

Also, it's important to note that you can't use the Amazon S3 console to undelete folders. To do so, you must use the AWS CLI or the AWS SDK.

Now if we go back to the S3 bucket and turn off Show versions we will see our S3 object has been restored.

image 25
image 25

That's it! Now you know how to use the Amazon S3 console to delete a single object from a bucket. The moral of the story is, turn on bucket versioning! Happy deleting!

Server Academy Members Only

Want to access this lesson? Just sign up for a free Server Academy account and you'll be on your way. Already have an account? Click the Sign Up Free button to get started..

0 0 votes
Lesson Rating
Subscribe
Notify of
profile avatar
0 Comments
Inline Feedbacks
View all comments