Home› Blog› Week 30 - What Actually Protects a Snapshot
AWS Weekly Lab AWS Terraform

What actually protects a snapshot

Delete a photo on your phone and it waits thirty days in a folder called Recently Deleted. Delete a snapshot in AWS and, unless you set something up beforehand, it is simply gone.

Verified against current vendor documentation on 2 December 2026. Pricing, limits and API behaviour were checked against the official docs on that date. Cloud services change fast — if you are reading this much later, treat the specifics as a starting point and re-check the linked sources.
AWS Platform Engineering Lab · Week 30 of 52

Lab Overview

Everyone has deleted the wrong photo. It is not a disaster, because the phone keeps it in a folder called Recently Deleted for thirty days. The safety net was there before you needed it, and nobody had to switch it on.

Most people carry that assumption into AWS. There is a Recycle Bin, so a deleted snapshot must sit in it for a while. There is not, unless you created a rule for it first, in that Region, before the delete. AWS is direct about this: if you delete a resource that matches no retention rule, "that resource is permanently deleted; it is not moved to the Recycle Bin".

So: one snapshot of one volume, and Delete pressed four times under four different conditions — nothing in place, a Recycle Bin rule in place, a governance lock, and a compliance lock. Every screen below is the console at the moment of the click.

Cloud Services and Concepts

ServicePurpose hereWhat it is
Amazon EBSOne encrypted 8 GiB gp3 volume holding a 512 MiB payload with a known checksum — the thing being protectedNetwork-attached disks for EC2 instances
EBS snapshotsThe backup under test. Incremental, stored in S3 that you never see, and restorable into a new volumeA point-in-time copy of a volume
Recycle BinThe safety net, and the week's main finding: it is opt-in, Region by Region, and only protects deletes that happen after the rule existsA holding area for deleted EBS resources, governed by retention rules
EBS snapshot lockThe stronger control. Governance mode for "don't delete this by accident", compliance mode for "you cannot delete this at all"A WORM lock applied to an individual snapshot
Amazon Data Lifecycle ManagerCreates the snapshots on a schedule, selecting volumes by tag, and deletes them when the retention count is exceededManaged snapshot scheduling, no code to run
HCP TerraformBuilds the volume, the instance and the roles in the sandbox account over OIDC, so no AWS keys are stored anywhereHosted Terraform runs with short-lived credentials

The rule has to exist before the delete

A Recycle Bin retention rule is not a setting on a snapshot. It is a standing rule in a Region that catches matching resources as they are deleted. Nothing about it is retroactive, which is the whole trap: the moment you want it is the moment it is too late to create it.

Two consequences follow, and both cost money rather than data. Once a snapshot is in the bin you cannot take it out early — AWS says plainly that you "can't manually delete a resource from the Recycle Bin", it leaves when its retention period expires. And while it waits, snapshots in the bin "are billed at the same rate as regular snapshots in your account". A thirty-day rule is a thirty-day bill for everything anyone deletes.

Two kinds of lock, and only one is reversible

A locked snapshot "can't be deleted by any user, regardless of their IAM permissions". The mode decides who can take that back.

Governance mode locks immediately, and anyone holding the right IAM permission can unlock it again. It stops accidents, not decisions.

Compliance mode has an optional cooling-off period of one to seventy-two hours during which you can still change your mind. After it expires — or straight away, if you asked for no cooling-off — the door closes: you "can't unlock the snapshot, change the lock mode, or decrease the lock duration". AWS states the consequence in one sentence worth reading twice: "The only way to delete a snapshot that is locked in compliance mode before its lock expires is to close the associated AWS account."

Lock duration runs from 1 day to 36,500 days. There is no shorter option, which matters more than it sounds.

Architecture and Workflow

aws Sandbox account · us-east-1 gp3 volume, 8 GiB encrypted, 512 MiB payload snapshot created in the console restored volume same checksum Data Lifecycle Manager daily 03:00 UTC, keep 3, by tag 1 3 2 restore, then hash both: 5f3193a3…89983 on each Now press Delete. What happens depends entirely on what was already in place. NOTHING IN PLACE permanently deleted no undo, no grace period the confirmation says nothing RECYCLE BIN RULE held for 1 day billed at the normal rate cannot be purged early GOVERNANCE LOCK delete refused removable by anyone with the IAM permission to unlock COMPLIANCE LOCK delete refused past cooling-off, no unlock: wait, or close the account

The numbers in the diagram are the order things happen:

  1. Take the snapshot from the volume, in the console, so every setting on the form is visible.
  2. Let Data Lifecycle Manager take the rest. The policy selects volumes by the tag Backup=daily and keeps three. The tag is the selector, so an untagged volume is simply not backed up, and nothing anywhere says so.
  3. Restore and check the bytes. A volume that mounts proves nothing. The 512 MiB payload has to hash to the same SHA-256 it had on the original.

Then the four deletes, which are the bottom half of the diagram and the rest of this post.

Prerequisites

  • An AWS account, and Terraform 1.10 or later.
  • A Recycle Bin retention rule in the same Region you will delete in. Rules are Region-scoped, and a rule in another Region is not a safety net, it is a line on an invoice.
  • IAM permissions for ec2:LockSnapshot and ec2:UnlockSnapshot, and rbin:* for the retention rules. Holding the unlock permission is what makes governance mode reversible.
  • An instance you can reach with Session Manager, to write the payload and hash it afterwards. No SSH key, no inbound port.

Implementation

What was deployed

ResourceHow manyIts job
aws_ebs_volume18 GiB gp3, encrypted, tagged Backup=daily — the data under test
aws_instance1t3.micro, writes the payload and hashes it, reachable only by Session Manager
aws_volume_attachment1Attaches the volume at /dev/sdf
aws_dlm_lifecycle_policy1Daily at 03:00 UTC, keep 3, selecting by tag
aws_iam_role2The instance profile, and the role Data Lifecycle Manager assumes
aws_security_group and its rule2Egress only — Session Manager dials out, nothing dials in
Instance profile and role attachments3Binding the two roles to their managed policies

Eleven resources, and not one of them is a protection control. The snapshot, the retention rule, the locks, the deletes and the restore are all console work, and all of it is below.

The HCP Terraform run page for workspace week-30-dev, showing a plan and a completed apply of eleven resources into the sandbox account.
Eleven resources into the sandbox account, over OIDC. The interesting part of the week starts after this finishes.
The HCP workspace variables page showing TFC_AWS_PROVIDER_AUTH set to true and the sandbox role ARN marked sensitive.
No stored keys. The run assumes a role in the sandbox account, and the role ARN points there rather than at the management account, where a deny policy could not reach it.
The EC2 Volumes console showing the gp3 volume in the in-use state, attached to the instance, with numbered callouts on its state and attachment.
The volume, in use and attached. Everything after this is measured against it.

Taking the snapshot

The EC2 create snapshot form, with numbered callouts on the source volume and the description field, before it is confirmed.
The whole form. The only field it asks for is a description — nothing here asks about retention, protection, or what happens if someone deletes this later.
The EC2 Snapshots list showing the new snapshot at 100 percent with its size, with numbered callouts on the progress and the size column.
Completed. The size shown is the volume's size, not what is billed — snapshots are incremental.

And the ones nobody takes by hand

The Data Lifecycle Manager create policy wizard, with numbered callouts on the target tag, the schedule time and the retention count.
The setting that matters is the first one: the policy targets volumes by tag. An untagged volume is not backed up, and no screen anywhere tells you that.
The Data Lifecycle Manager policy list showing the policy in the ENABLED state with its execution role, with numbered callouts on the state and the role.
Enabled, with the role it assumes. A policy that exists and a policy that runs are different things, and this column is the difference.

Validation and Evidence

TestExpectedActualStatus
Delete a snapshot, no retention rulerecoverable from the binpermanently gone, no bin entry❌
Delete a snapshot, rule in placeheld in the binheld, exit time one day later✅
Recover it from the binback in the snapshot listrecovered, fully usable✅
Delete a governance-locked snapshotrefusedrefused: "The snapshot is locked"✅
Restore a volume and compare the databyte-identicalSHA-256 identical on both✅
Lock a snapshot for less than a dayallowed, for a labrefused — one day is the floor❌
Take a snapshot out of the bin earlypossibleno such action exists❌

Delete one, with nothing in place

The first row is the week. Here is the console at the moment it happens, with no retention rule in the Region:

The EC2 console delete-snapshot confirmation dialog, which asks the user to type the word delete to confirm, with numbered callouts marking the snapshot and the confirmation field.
The confirmation asks you to type the word delete. It does not mention the Recycle Bin, a retention period, or any way back, because with no rule in the Region there is none. The snapshot was gone a second later.

Now switch the safety net on

The Recycle Bin create retention rule form, with numbered callouts on the resource type, the retention period in days and the rule lock setting.
Two things to read on this form: the retention period, and the note under it — minimum 1 day, maximum 365. That number is chosen once, for everything the rule will ever catch.

Now the same delete, on an identical snapshot. Same console, same button, same typed word:

The Recycle Bin console showing the deleted snapshot with its retention period and the date and time it will leave the bin, with numbered callouts on the resource and the Recycle Bin exit time.
The same delete, caught. The exit time is the part to notice: it bills at the normal snapshot rate until then, and there is no action anywhere that takes it out early.
The Recycle Bin recover confirmation, and the recovered snapshot back in the EC2 snapshots list, with numbered callouts on the recover action and the restored snapshot.
Recovered, and usable exactly as before. The confirm button is labelled Recover resources, which is worth knowing when you are looking for a button called Recover.

The stronger control

The manage snapshot lock form in governance mode, with numbered callouts on the mode selection and the lock duration in days.
Governance mode, and a duration in whole days. Note the minimum under the field.

With the lock on it, the console offers the Delete button exactly as before, and then declines:

The EC2 snapshots console showing a red error banner reading that the snapshot is locked and cannot be deleted, with numbered callouts on the error message and on the Delete button that is still offered.
The lock stops the action, not the attempt. Worth knowing if you were relying on the console to warn someone before they try.
The manage snapshot lock form in compliance mode, showing the cooling-off period field and the acknowledgement checkbox, with numbered callouts on both.
Compliance mode, and the only two ways out of it: a cooling-off period of 1 to 72 hours, or the acknowledgement you tick when you want none. Configured and photographed here, deliberately not confirmed — past the cooling-off period there is no unlock at all.

Does the backup actually restore?

The create volume from snapshot form, with numbered callouts on the source snapshot and the Availability Zone.
Create volume from snapshot. The Availability Zone has to match the instance that will mount it, and the form will happily let you choose one that does not.
The restored volume attached to the instance, and the payload hashing to the same SHA-256 as the original, with numbered callouts on the attachment and the matching checksum.
Attached, mounted, and hashing to 5f3193a3…89983 — the same value the original payload had. A volume that mounts is not evidence. This is.

The one thing the console cannot do

The lock form offers a duration in whole days and says "Min: 1 Day". The API takes a timestamp instead, which looks like a way round it. A lock asked to expire two hours later:

A terminal running aws ec2 lock-snapshot with an expiration date two hours in the future, answered with an InvalidRequest error stating that the ExpirationDate must be one day or more after the current date and time.
Refused. The one-day minimum is not a console simplification, it is the service. A lock set to try it out outlives the lab that set it.

Security and Cost

The volume is encrypted, and a snapshot inherits the volume's encryption, so the backup is encrypted without anyone choosing to encrypt it. The instance has no inbound rule at all: Session Manager is an outbound connection, so writing and hashing the payload needed no SSH key and no open port.

The account-level guardrail got stricter this week. The deny service control policy at the organization root now refuses volumes above 100 GiB, refuses the provisioned-IOPS types, caps IOPS at the gp3 maximum, and denies ec2:ModifyVolume outright. That last one is there because the size and type condition keys do not apply to a resize: an 8 GiB volume could be grown to 200 GiB with every other rule still in place.

What this means for a platform team

Two of the three protections here are bills as much as they are controls. A retention rule means every deleted snapshot keeps costing for the full retention period, with no way to stop it early, and a thirty-day rule across a busy account is a standing charge nobody decided to accept. A compliance lock is worse if it is set wrongly: the documented escape is closing the account.

So pick the retention period as a cost decision, not a safety one, and test a lock in governance mode before anyone types the word compliance.

Cost

$0.38 measured, read from Cost Explorer on 2026-12-02 once both usage days had stopped moving: the t3.micro $0.20, the public IPv4 address on it $0.10, every EBS volume and snapshot in the lab $0.04, AWS Config $0.03, tax $0.02.

Read that order again. The subject of the week cost four cents. All the storage, every snapshot, the restore, the Recycle Bin, the locks — four cents out of thirty-eight. The public IPv4 address attached to the instance cost two and a half times more than the thing the lab was about, and it was never mentioned in any of the screens above.

The Config line is the one worth checking in your own account. This account has a configuration recorder left over from an unrelated project, recording exactly two resource types: AWS::EC2::Instance and AWS::EC2::Volume. It billed nothing at all for the seven days before this lab, because there were none of either. Creating eleven resources and deleting them again cost $0.03 in configuration items — nine percent of the week, from a service this lab never used and never configured.

The Cost Explorer cost and usage breakdown for 1 and 2 December 2026, grouped by service: total 0.38 dollars, EC2-Instances 0.20, VPC 0.10, EC2-Other 0.04, Config 0.03, Tax 0.02, with numbered callouts on the first three.
The bill, grouped by service, for the two days the lab existed. The lab's own storage is the fourth line down.

Troubleshooting and Lessons

Problem. A snapshot locked for a few hours, so that a short-lived environment can still be torn down the same evening.

Root cause. There is no such lock. The console offers whole days with a minimum of one, and the API, which takes a timestamp and looks like it would accept anything, answers "The ExpirationDate must be one day or more after the current date and time".

Resolution. Governance mode, which can be unlocked on the way out. Compliance mode belongs nowhere near a short-lived environment: it is a snapshot you keep paying for until its lock expires, and no permission shortens that.

Lesson. Check whether a control can be undone before you switch it on, not after. The minimum duration of a protection is part of its cost.

Problem. A snapshot that landed in the Recycle Bin could not be removed from it.

Root cause. That is the design. Resources leave the bin when their retention period expires, or when you restore them, and there is no third option.

Lesson. The retention period is the one number that matters, and it is chosen once, in advance, for everything the rule catches. Treat it as a budget line.

Cleanup and Key Takeaways

The EC2 console showing no snapshots and no volumes for the account, and the Recycle Bin showing no resources, after teardown.
Snapshots, volumes and the Recycle Bin, all empty, read in the console rather than taken from the destroy output.

The retention rule had to be deleted before the snapshots, or they would have gone to the bin and billed for another day with no way to empty it. The order of a teardown is part of its cost.

Key takeaways

  • The Recycle Bin is not on. A deleted snapshot is permanently deleted unless a retention rule already existed in that Region. There is no grace period and the confirmation dialog does not hint at one.
  • Protection you can configure after the fact is not protection. Every control here only works if it was in place before the mistake.
  • The bin is a bill. Snapshots in it are charged at the normal rate, and nothing takes them out early.
  • Governance before compliance. Governance mode refuses the delete and can still be unlocked. Compliance mode refuses everyone, including you, and the documented way out is closing the account.
  • Restores are proved with a checksum. A volume that attaches and mounts is not evidence that the data survived.
  • The backup was not the expensive part. Every volume and snapshot came to four cents of a thirty-eight cent week. The public IP address on the instance cost more than twice that.

One sentence worth carrying to any backup, in any cloud: the question is not "can I take a backup", it is "what happens the moment someone deletes it", and the answer was decided before anyone pressed the button.

References

Comments

How was your experience?
Your feedback helps improve this site.
PoorExcellent