AWS Builder Center
The File I Deleted at 2:13 AM Was Still Alive

The File I Deleted at 2:13 AM Was Still Alive

This article shows how AWS Bucket keeps your article alive even after deleting them.

Series: File deleting is not so simple nowadays (1 article)

  1. 1
    The File I Deleted at 2:13 AM Was Still Alive This article
I am a freelancer.

The AWS File That Refused to Die 👻

Part 1 — The Delete Button Lied

At 2:13 AM, I deleted a file from my Amazon S3 bucket.
The console said:
Delete successful.
So I closed my laptop.
Problem solved.
Or at least… that's what I thought.
The next morning, I started wondering about something very simple:
What does “delete” actually mean in the cloud?
I opened the bucket again.
The file was gone.
No report.pdf.
No error.
Nothing.
But then I discovered something that made me stop.
The file hadn't completely disappeared.
It was still there.
Not where I expected.
Not as the current object.
But somewhere inside S3…
there was still a version of it.

The first clue

The bucket had S3 Versioning enabled.
And suddenly the story changed.
My mental model had been:
1
2
3
4
5
6
7
Upload
↓
File exists
↓
Delete
↓
File is gone forever
But S3 can behave more like:
1
2
3
4
5
6
7
8
9
10
11
Upload
↓
Version exists
↓
Delete
↓
Delete marker appears
↓
File looks deleted
↓
Older version may still exist
That tiny difference is easy to miss.
And it raises a much more interesting question:

If the file still exists…

what exactly did I delete?

The ghost inside the bucket

Imagine this object:
1
2
3
4
5
report.pdf

Version 1
Version 2
Version 3 ← current
Now I click Delete.
You might expect:
1
2
3
Version 1 ❌
Version 2 ❌
Version 3 ❌
But with S3 Versioning, a delete request can create a delete marker instead.
Conceptually:
1
2
3
4
5
6
report.pdf

Delete Marker ← current
Version 3
Version 2
Version 1
To the normal application:
“The file doesn't exist.”
To S3:
“The current version is a delete marker.”
That difference is where things get interesting.

And then I found the strangest part…

What happens if that delete marker disappears?
Could the old file come back?
I decided to test it.
But before I show you what happened, there is another question we need to answer:
How can you permanently delete something in a versioned S3 bucket?
And that question becomes surprisingly important when the bucket contains:
  • backups
  • user documents
  • logs
  • datasets
  • financial records
  • application artifacts
Because “Delete” and “Permanently delete” are not always the same thing.

Series: File deleting is not so simple nowadays (1 article)

  1. 1
    The File I Deleted at 2:13 AM Was Still Alive This article
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article