Home / AWS

AWSHow-toIntermediate

Optimization: EBS snapshot and AWS Backup cost - lifecycle, archive tier and orphan clean-up

Snapshot storage creeps up from scripts that never delete, AMIs nobody uses and backup plans with the same long retention everywhere. Inventory snapshots by source and age, automate lifecycle with Data Lifecycle Manager or AWS Backup, move long-term copies to the archive tier, clean orphans safely and keep Recycle Bin as a safety net.

Deepak Bhardwaj3 min read

Applies toAmazon EBS snapshots (standard and archive tiers), AMIs, Amazon Data Lifecycle Manager, AWS Backup, Recycle Bin

1. Inventory

aws ec2 describe-snapshots --owner-ids self \
  --query 'Snapshots[].[StartTime,SnapshotId,VolumeId,VolumeSize,StorageTier,Description]' --output text \
| sort > snapshots.tsv
wc -l snapshots.tsv

Classify each snapshot:

Class How to tell
AWS Backup recovery point Description/tags from AWS Backup; managed in backup vaults
DLM-managed Tag aws:dlm:lifecycle-policy-id
Backing an AMI Referenced in describe-images block device mappings
Source volume deleted VolumeId not found in describe-volumes
Ad-hoc / script Everything else (often the forgotten ones)

Snapshots are incremental, so deleting one doesn't always free its full size. Billing is for unique blocks. The Cost Explorer EBS:SnapshotUsage trend is the real measure.

2. Find orphans

# snapshots whose source volume no longer exists
aws ec2 describe-volumes --query 'Volumes[].VolumeId' --output text | tr '\t' '\n' | sort > volumes.txt
awk -F'\t' '{print $3}' snapshots.tsv | sort -u | comm -23 - volumes.txt > orphan-volume-ids.txt

# AMIs not used by any instance or launch template
aws ec2 describe-images --owners self --query 'Images[].[CreationDate,ImageId,Name]' --output text | sort | head -50

Before deleting: check launch templates, ASGs, CloudFormation/Terraform references, and DR runbooks that point at AMIs.

3. Automate lifecycle

  • AWS Backup plans for production (central policy, vault lock, cross-account/cross-region copies, reporting).
  • Data Lifecycle Manager for simple EBS snapshot and AMI schedules (including AMI deprecation and deregistration).
  • Retention by tier (example): dev 7 days; prod daily 35 days + monthly 12 months.

Ad-hoc snapshots before changes: tag them with expires=YYYY-MM-DD and run a weekly job that deletes expired ones.

4. Archive tier for long-term snapshots

EBS Snapshots Archive stores a full copy at a much lower monthly price, with a 90-day minimum and restores that take up to 72 hours. Good for monthly/yearly compliance snapshots:

aws ec2 modify-snapshot-tier --snapshot-id snap-0abc123 --storage-tier archive

AWS Backup can move eligible EBS recovery points to cold storage/archive via lifecycle settings in the plan. Archiving a snapshot that shares most blocks with others can save little (archive stores a full copy). Archive older monthly/yearly points, not daily incrementals.

5. Recycle Bin as a safety net

Retention rules keep deleted snapshots and AMIs recoverable for a period:

aws rbin create-rule --resource-type EBS_SNAPSHOT --retention-period RetentionPeriodValue=14,RetentionPeriodUnit=DAYS \
  --description "14-day safety net for snapshot clean-up"

Clean-up with Recycle Bin on means mistakes are recoverable. Snapshots in the bin are still billed during retention.

6. Other levers

  • Fast Snapshot Restore is billed per AZ per hour. Disable where unused.
  • Cross-region copies: only for DR-relevant systems.
  • AWS Backup for EFS/RDS/DynamoDB: check their retention too; the same habits apply.

Caution

Never delete snapshots in AWS Backup vaults or those under vault lock from scripts. Change the backup plan retention and let AWS Backup expire them. And confirm with owners before deregistering AMIs used in DR plans.

Checklist

  • Snapshots inventoried and classified
  • Orphans and unused AMIs reviewed with owners
  • Lifecycle via AWS Backup / DLM; ad-hoc snapshots expire
  • Long-term points archived where it saves
  • Recycle Bin rule before clean-up
  • FSR and cross-region copies reviewed