AWS Certified Sysops Administrator Associate · Free Practice Question Medium
Question 27
You are in S3 and have deleted all the files in it. As you can see, the bucket is empty:

You have tried to delete the bucket afterward and it fails with an error saying the bucket is not empty.
What's the issue?
-
A
Some files are in Glacier
-
B
An S3 bucket policy is set up and it prevents bucket deletion
-
C
S3 is eventually consistent. Wait two minutes and retry, it will work then
-
D
S3 versioning is enabled and delete markers are still present in the bucket
Reveal correct answer
Correct answer: D
Explanation
Correct option:
S3 versioning is enabled and delete markers are still present in the bucket
S3 Versioning is a means of keeping multiple variants of an object in the same bucket. You can use versioning to preserve, retrieve, and restore every version of every object stored in your Amazon S3 bucket. With versioning, you can easily recover from both unintended user actions and application failures. When you enable versioning for a bucket, if Amazon S3 receives multiple write requests for the same object simultaneously, it stores all of the objects.
If you overwrite an object, it results in a new object version in the bucket. You can always restore the previous version.
If you delete an object, instead of removing it permanently, Amazon S3 inserts a delete marker, which becomes the current object version.
So for the given use-case, as delete markers are still present in the bucket, therefore you get the error saying the bucket is not empty.
Incorrect options:
S3 is eventually consistent. Wait two minutes and retry, it will work then - This is a made-up option. Amazon S3 provides strong read-after-write consistency for PUTs and DELETEs of objects in your Amazon S3 bucket in all AWS Regions.
An S3 bucket policy is set up and it prevents bucket deletion - You could set up a bucket policy to prevent bucket deletion, but it would not present an error that says the bucket is not empty.
Some files are in Glacier - You store your data in Amazon S3 Glacier as archives. Archives may be further grouped into vaults. So files are not stored in buckets for Glacier. So while deleting, you will not get an error that says the bucket is not empty.
Reference:
https://docs.aws.amazon.com/AmazonS3/latest/dev/Versioning.html
https://docs.aws.amazon.com/AmazonS3/latest/dev/Introduction.html#ConsistencyModel
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
