What is orphaned EBS storage and why does it keep billing?
Orphaned EBS storage comes in two forms: volumes in the available state, meaning they exist but are attached to no instance, and snapshots that no longer back any restore plan, AMI or compliance requirement. Neither shows up in instance dashboards, so both stay hidden until someone reads the bill.
Where it comes from
- DeleteOnTermination set to false. Root volumes created at launch usually delete with the instance. Volumes attached after launch default to
false, so when the instance terminates they becomeavailableand stay that way. - Auto Scaling and CI churn. Short-lived instances with extra data volumes can leave one orphan per scale-in event or pipeline run.
- Failed infrastructure teardowns. A Terraform destroy or CloudFormation stack deletion that errors partway, or a resource removed from state by hand, leaves volumes that no tool tracks anymore.
- Manual debugging. Volumes detached for forensics, or restored from a snapshot to inspect data, are rarely cleaned up afterward.
Why it keeps billing
EBS volumes are billed for provisioned size, not for data written or I/O performed. A detached 500 GiB volume costs the same as one that is attached and full. Snapshots are billed for the data they store, and that charge continues until the snapshot is deleted.
Illustrative estimate: assume 120 unattached volumes, an average size of 200 GiB and $0.08 per GB-month. That is 24,000 GB × $0.08, or about $1,920 per month, for storage nobody uses. Replace these numbers with your own counts and with current regional pricing from the AWS pricing page or your bill.
Backend and platform teams usually own this cleanup, because they control the launch templates, IaC modules and pipelines that create these volumes.
Who should use this checklist?
This checklist is for the engineers who create EBS storage at scale and are expected to keep its cost under control:
- Platform and infrastructure teams that own launch templates, IaC modules, account vending and the AWS Organizations structure. They can fix the root causes, such as
DeleteOnTerminationdefaults and missing tags, as well as the symptoms. - Backend and service teams that run Auto Scaling groups, stateful workloads or CI runners with extra data volumes. These are the workloads that produce orphans most steadily.
- SRE and operations engineers who detach volumes during incidents, restore snapshots for debugging, or run blue/green cutovers. They are the people most likely to know whether an
availablevolume is still needed. - FinOps or cost owners who need a repeatable, defensible process instead of a one-time sweep, and who need findings routed to a named owner.
It is most useful when you run more than a handful of accounts or regions, when volumes are created by automation rather than by hand, or when nobody can currently say who owns a given unattached volume. A single small account with a few manually managed instances can usually get by with an occasional console review. The steps below still apply there, just with less tooling.
You need read access to EC2, CloudTrail and CloudWatch in every account you scan. Running it across an organization also requires management-account or delegated-administrator credentials and a read-only audit role in each member account. Deletion and modification steps need write permissions, and those should be granted separately and narrowly.
How does the checklist work?
The checklist is a loop that repeats on a schedule. Each section below covers one stage:
- Inventory. List every volume in the
availablestate across all active accounts and enabled regions. Record size, type, creation time, tags, source snapshot, account ID and region. - Attribute. Find an owner for each volume using tags first, then CloudTrail
CreateVolumeandDetachVolumeevents, then the source snapshot or AMI. - Decide. Apply a written rule, such as "unattached for 14 days with no
ownertag," so each volume gets the same treatment. - Check exceptions. Exclude planned reattaches, forensic holds, recovery copies, blue/green leftovers and anything carrying an opt-out tag.
- Notify and tag. Tell the owner, then tag the volume with a pending-deletion date to start a visible grace period.
- Snapshot or delete. Take a final snapshot with an expiry tag only when the data's value is uncertain, then delete the volume.
- Clean up snapshots. Build review lists of snapshots whose source volume is gone, that no AMI references, or that are past retention. Delete only the snapshots that land on all three lists after review.
- Right-size what remains. Convert attached gp2 volumes to gp3 where CloudWatch metrics show the baseline is enough.
- Prevent recurrence. Move detection and retention into policy: IaC defaults, required tags, lifecycle and backup retention rules, and continuous detection. Then track the EBS storage trend in Cost Explorer.
The first run is the expensive one, because it uncovers the backlog. After that, each run handles only what was created since the last one. Every orphan that prevention stops also stops showing up in later runs.
How do you find unattached EBS volumes across every region and account?
The core query is aws ec2 describe-volumes with the filter Name=status,Values=available. A volume in the available state exists but is not attached to any instance. That is the clearest signal of orphaned storage. The call is regional, so a single run only covers the region in your CLI profile. Volumes left behind in a region nobody looks at are exactly the ones that bill for years.
To cover every region, list them first with aws ec2 describe-regions. By default it returns only the regions enabled for the account. Then run the volume query once per region by passing --region on each iteration. Opt-in regions that are not enabled cannot hold volumes, so skipping them is safe.
Fields to capture for attribution
For each volume, record:
- VolumeId and AvailabilityZone, to locate it.
- Size and VolumeType, to estimate cost.
- CreateTime, to gauge how stale it is.
- Tags, especially owner, team, environment and IaC stack identifiers.
- SnapshotId, the snapshot the volume was created from, if any. This often traces back to an AMI or a restore operation.
Store the results with the account ID and region attached. Without those two values, you cannot route a finding to an owner.
Covering every account
Most organizations spread workloads across many AWS accounts, and a scan of one account will underreport waste. Sandbox and retired project accounts tend to hold the most orphaned storage, and they are the accounts nobody scans.
Covering them requires infrastructure. Typically you enumerate member accounts through AWS Organizations from the management account or a delegated administrator. You then assume a read-only role in each account and repeat the region loop with those credentials. That role has to exist in every account, ideally deployed by your account-vending process. Accounts that joined the organization by invitation may lack it until someone adds it.
#!/usr/bin/env bash
set -euo pipefail
ROLE_NAME="EbsAuditReadOnly" # read-only role deployed in every member account
OUT="unattached-volumes.jsonl"
: > "$OUT"
for acct in $(aws organizations list-accounts \
--query 'Accounts[?Status==`ACTIVE`].Id' --output text); do
# Assume the audit role. Log and skip accounts where the role is missing.
if ! creds=$(aws sts assume-role \
--role-arn "arn:aws:iam::${acct}:role/${ROLE_NAME}" \
--role-session-name ebs-audit \
--query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken]' \
--output text); then
echo "WARN: cannot assume role in ${acct}, not scanned" >&2
continue
fi
# Subshell keeps the assumed credentials from leaking into the next iteration.
(
read -r AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN <<< "$creds"
export AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN
# describe-regions returns only regions enabled for this account by default.
for region in $(aws ec2 describe-regions --query 'Regions[].RegionName' --output text); do
aws ec2 describe-volumes --region "$region" \
--filters Name=status,Values=available \
--query 'Volumes[].{VolumeId:VolumeId,AZ:AvailabilityZone,Size:Size,Type:VolumeType,Created:CreateTime,SnapshotId:SnapshotId,Tags:Tags}' \
--output json |
# Attach account and region so each finding can be routed to an owner.
jq -c --arg a "$acct" --arg r "$region" '.[] | . + {account: $a, region: $r}'
done
) >> "$OUT"
done
A bash loop that assumes a read-only role in each active AWS Organizations account, queries every enabled region for volumes in the available state, and writes one JSON line per volume with size, type, CreateTime, tags, SnapshotId, account ID and region.
How does the find, attribute, snapshot-or-delete workflow work?
Once inventory runs in every account, each available volume goes through the same pipeline:
find (state = available) -> attribute (tags, CloudTrail, source snapshot or AMI) -> decide (apply rule) -> notify owner -> tag pending-deletion date -> final snapshot (only if value is uncertain) -> delete
Attribution
Check owner or team tags first. If they are missing, look in CloudTrail for the CreateVolume and DetachVolume events. The caller identity shows who created the volume, and the detach time shows how long it has been idle. CloudTrail's default event history covers only a limited window, so older volumes need an organization trail delivered to S3. If both lookups fail, check the volume's source snapshot ID. That snapshot often traces back to an AMI or a backup job whose owner is known.
Decision rule
Write the rule down so nobody has to make a judgment call each time. For example: "unattached for 14 days and no owner tag" qualifies for deletion. A fixed threshold makes the process predictable and easy to defend when someone asks why their volume disappeared.
Safe deletion
- Notify the owner, or the account's contact if no owner was found.
- Tag the volume with a pending-deletion date. This gives people a visible grace period and lets the next run act without re-checking.
- Take a final snapshot only when nobody can say whether the data matters.
- Delete the volume.
A final snapshot moves cost from the volume to snapshot storage. It does not remove the cost. Give every final snapshot an expiry tag. Otherwise these snapshots become the next pile of orphaned storage.
[ scheduled run: every account, every region ]
|
v
FIND list EBS volumes where state = available
|
v
ATTRIBUTE 1. owner / team tags on the volume
2. CloudTrail: CreateVolume -> who created it
DetachVolume -> idle since when
(older than event history? query the org trail in S3)
3. SnapshotId -> source snapshot -> AMI or backup job owner
|
v
DECIDE unattached >= 14 days AND no owner tag?
| |
no yes
| |
v v
keep, record owner, NOTIFY owner (or account contact)
re-check next run |
v
TAG pending-deletion = 2026-11-21
|
v
grace period over, no objection?
| |
no yes
| |
remove tag, keep v
is the data's value known?
| |
uncertain known disposable
| |
v |
FINAL SNAPSHOT |
tag expire-on = 2027-02-21 |
(cost moves, it is not removed) |
| |
+--------+--------+
v
DELETE volume
The full find, attribute, decide, notify, tag, snapshot-or-delete flow for one available volume. It uses a 14-day, no-owner-tag rule as the example threshold, and every final snapshot gets an expiry tag.
When should you avoid deleting an available volume or snapshot?
An available state tells you a volume has no attachment. It does not tell you the volume is unwanted. Several common cases look like waste and are not:
- Planned reattach. An instance was stopped for a resize or an OS rebuild, and its data volume was detached until the new host is ready.
- Forensic preservation. A security team detached the volume from a compromised host to keep evidence intact.
- Database recovery copy. A volume restored from a snapshot is held for point-in-time verification or a rollback window.
- Blue/green cutover. The old environment's volumes are kept until the new stack has proven itself.
These cases matter because EBS deletion cannot be undone. A deleted volume or snapshot has no recycle step in the standard API path. If it held the only copy, the data is gone.
Snapshots carry an extra constraint. A snapshot that backs a registered AMI cannot be deleted until the AMI is deregistered. Deregistering the AMI has its own side effects. Launch templates that reference the AMI stop working, and Auto Scaling groups fail when they try to launch new instances during a scale-out or replacement. Any account the image was shared with also loses access to it.
Automated deletion makes all of these risks larger, because a script acts on state rather than intent. Three mitigations help:
- Report-only mode. The script lists candidates and deletes nothing.
- Tag-based opt-out. Tags such as
retain-untilexclude a resource from cleanup. - Human approval. A person must confirm before anything is deleted.
Each mitigation slows cleanup, so waste stays on the bill longer. That cost is usually smaller than the cost of one unrecoverable deletion.
How do you do EBS snapshot cleanup without breaking restores?
Start by building three lists from aws ec2 describe-snapshots --owner-ids self, run per region:
- Snapshots of volumes that no longer exist. Compare each snapshot's
VolumeIdagainstdescribe-volumes. Copied snapshots can carry a placeholder volume ID, so treat a missing volume as a reason to investigate, not proof the snapshot is orphaned. - Snapshots not referenced by any AMI. Collect every
SnapshotIdunderBlockDeviceMappingsfromaws ec2 describe-images --owners self. A snapshot backing a registered AMI cannot be deleted until the AMI is deregistered. Deregistering an AMI that a launch template or Auto Scaling group still uses breaks scaling. - Snapshots past retention. Filter on
StartTimeagainst your written policy. Exclude snapshots managed by a backup service or lifecycle policy, because those tools enforce their own schedules.
Snapshots are incremental, so predicting savings is hard. Deleting one snapshot frees only the blocks that no other snapshot references. Removing a snapshot from the middle of a series may save almost nothing, because AWS keeps any blocks that later snapshots still need. Deleting a snapshot never corrupts the others. The real risk is deleting the restore point you actually depend on, such as the last snapshot taken before a volume was removed.
For data you must keep but rarely read, the archive tier lowers storage cost but comes with trade-offs:
- Archived snapshots are stored as full copies, not incremental ones.
- You pay a per-GB retrieval fee.
- There is a minimum retention period, and deleting early is billed as if you had kept the snapshot for that period.
- Restoring takes hours to days.
Archive fits compliance and legal-hold data. Do not use it for anything you might need during an incident.
#!/usr/bin/env bash
set -euo pipefail
REGION="us-east-1" # run once per region
CUTOFF=$(date -u -d '365 days ago' +%Y-%m-%dT%H:%M:%S) # GNU date; match your written policy
OUT="./snapshot-review-$REGION"; mkdir -p "$OUT"
aws ec2 describe-snapshots --region "$REGION" --owner-ids self \
--query 'Snapshots[].[SnapshotId,VolumeId,StartTime]' --output text \
| sort > "$OUT/snapshots.tsv"
aws ec2 describe-volumes --region "$REGION" \
--query 'Volumes[].VolumeId' --output text | tr '\t' '\n' | sort -u > "$OUT/volumes.txt"
aws ec2 describe-images --region "$REGION" --owners self \
--query 'Images[].BlockDeviceMappings[].Ebs.SnapshotId' --output text \
| tr '\t' '\n' | grep -v '^None$' | sort -u > "$OUT/ami-snapshots.txt" || true
awk 'NR==FNR {vol[$1]=1; next} !($2 in vol) {print $1}' \
"$OUT/volumes.txt" "$OUT/snapshots.tsv" | sort > "$OUT/1-volume-missing.txt"
cut -f1 "$OUT/snapshots.tsv" | comm -23 - "$OUT/ami-snapshots.txt" > "$OUT/2-no-ami.txt"
awk -v c="$CUTOFF" '$3 < c {print $1}' "$OUT/snapshots.tsv" | sort > "$OUT/3-past-retention.txt"
comm -12 "$OUT/1-volume-missing.txt" "$OUT/2-no-ami.txt" \
| comm -12 - "$OUT/3-past-retention.txt" > "$OUT/candidates.txt"
wc -l "$OUT"/*.txt
A read-only bash script that uses describe-snapshots, describe-volumes and describe-images to build the three review lists and their intersection for one region, without deleting anything.
Should you migrate gp2 to gp3 after cleanup?
For volumes that stay attached, gp3 is usually the better default. It is typically cheaper per GB than gp2. It also decouples performance from size: gp2 gives you IOPS in proportion to capacity, while gp3 includes a fixed baseline of IOPS and throughput at any size, and you can provision more of either separately.
| Characteristic | gp2 | gp3 |
|---|---|---|
| Baseline IOPS | 3 per GiB, with a minimum floor | 3,000 at any size |
| Burst | Credit bucket up to 3,000 IOPS on smaller volumes | No burst model; baseline is sustained |
| Throughput | Tied to size, capped per volume | 125 MiB/s baseline, provisionable separately |
| Extra performance | Grow the volume | Pay for added IOPS or throughput |
The migration is an in-place Elastic Volumes modification. You change the volume type with no detach and no downtime. Before you change anything, pull the CloudWatch metrics over a representative window that includes peaks:
VolumeReadOpsandVolumeWriteOpsare counts per period. Divide by the period length in seconds to get IOPS.VolumeReadBytesandVolumeWriteBytesgive you throughput.BurstBalanceshows whether the workload is living on gp2 credits.
Savings shrink in two cases:
- Small, burst-reliant volumes. gp3's baseline covers the burst IOPS. However, if peak throughput exceeds 125 MiB/s, you must provision extra throughput. The absolute saving on a small volume is small to begin with.
- Large gp2 volumes. Their size-derived IOPS can sit well above 3,000. Matching that on gp3 means paying for the additional IOPS.
After a modification, the volume moves through modifying and then optimizing. Performance can vary until optimization completes. You also cannot modify the same volume again for about six hours, so size the target correctly the first time.
#!/usr/bin/env bash
set -euo pipefail
VOL=vol-0123456789abcdef0 # placeholder volume ID
PERIOD=300 # 5-minute buckets; 3 days = 864 datapoints (API limit is 1440)
START=$(date -u -d '3 days ago' +%Y-%m-%dT%H:%M:%SZ)
END=$(date -u +%Y-%m-%dT%H:%M:%SZ)
peak() { # $1=metric $2=statistic $3=jmespath fn (max|min)
aws cloudwatch get-metric-statistics --namespace AWS/EBS --metric-name "$1" \
--dimensions Name=VolumeId,Value="$VOL" --start-time "$START" --end-time "$END" \
--period "$PERIOD" --statistics "$2" --query "$3(Datapoints[].$2)" --output text
}
R_OPS=$(peak VolumeReadOps Sum max); W_OPS=$(peak VolumeWriteOps Sum max)
R_B=$(peak VolumeReadBytes Sum max); W_B=$(peak VolumeWriteBytes Sum max)
BURST_MIN=$(peak BurstBalance Minimum min)
awk -v ro="$R_OPS" -v wo="$W_OPS" -v rb="$R_B" -v wb="$W_B" -v p="$PERIOD" 'BEGIN {
printf "peak IOPS ~ %.0f (gp3 baseline 3000)\n", (ro+wo)/p
printf "peak MiB/s ~ %.1f (gp3 baseline 125)\n", (rb+wb)/p/1048576 }'
echo "lowest BurstBalance: ${BURST_MIN}% (low values mean the volume relies on gp2 credits)"
aws ec2 modify-volume --volume-id "$VOL" --volume-type gp3 --iops 3000 --throughput 125
aws ec2 describe-volumes-modifications --volume-ids "$VOL" \
--query 'VolumesModifications[0].[ModificationState,Progress]' --output text
This script pulls peak IOPS, throughput and the lowest BurstBalance for a gp2 volume from CloudWatch, converts the volume to gp3 in place with Elastic Volumes, and then checks how far the modification has progressed.
What are the alternatives to cleanup scripts, and how do you make this recurring?
Once volumes are cleaned up and right-sized, the next step is to stop the waste from coming back. A cleanup script finds problems after they have already been billed for weeks. Policy prevents most of them from being created in the first place.
| Approach | What it covers | Limitation |
|---|---|---|
| One-off scripts | Anything you can query | Runs only when someone remembers, and knowledge leaves with the author |
| Amazon Data Lifecycle Manager | Tag-targeted snapshot and AMI creation and retention | Does not touch unattached volumes |
| AWS Backup retention rules | Recovery points it creates, expired on schedule | Ignores snapshots made outside the backup plan |
AWS Config managed rules (e.g. ec2-volume-inuse-check) |
Continuous detection of unattached volumes across accounts | Detects only; remediation is separate |
| Trusted Advisor checks | Underutilized volume findings, where your support plan includes them | Coverage depends on the plan |
| IaC enforcement | DeleteOnTermination in modules and launch templates, plus required owner and expiry tags |
Only covers resources created through IaC |
The savings come from removing toil. Every orphan that IaC prevents is one nobody has to attribute later, and attribution is the slow, expensive part of every cleanup. Retention managed by DLM or AWS Backup also ends the "keep it just in case" snapshot growth that scripts rarely address.
Make the remaining detection recurring:
- Assign a named owner to the scheduled report. A shared channel does not count as an owner.
- Set a cadence. Run it weekly for review and clean up monthly.
- Track the trend in Cost Explorer. Filter to the EBS usage types for volume and snapshot storage, such as those containing
VolumeUsageandSnapshotUsage, and group by usage type. If the line flattens, the policies are working. If it climbs, a team is creating storage outside your modules.
How can it save engineering time?
The billing savings are easy to see. The time savings come from replacing ad-hoc investigations with a process that does most of the work before a person gets involved.
- Attribution stops being archaeology. Without required tags, every unknown volume means searching CloudTrail, guessing from names and asking in team channels. When IaC enforces
ownerandexpirytags, the inventory output already names the owner, and the investigation step disappears for most findings. - Decisions stop needing meetings. A written rule, such as 14 days unattached with no
ownertag, settles most cases mechanically. Engineers only discuss the exceptions, not every volume. - The grace-period tag replaces follow-up. The
pending-deletiondate records the decision on the resource itself. The next run acts on it without anyone re-checking history or remembering what was agreed. - Read-only reports are cheap to review. The inventory and snapshot scripts produce lists and change nothing, so a reviewer can scan a candidate list in one sitting instead of clicking through every region and account in the console.
- Prevention removes work entirely. Correct
DeleteOnTerminationsettings in launch templates and lifecycle or backup retention rules for snapshots mean those orphans never enter the queue. - Incidents caused by cleanup become rarer. Opt-out tags, approval steps and the AMI check stop deletions that would otherwise cost hours of recovery work or a failed scale-out.
Illustrative estimate: assume a scan surfaces 40 new unattached volumes per month, and that manually attributing an untagged volume takes about 20 minutes while confirming a tagged one takes about 2 minutes. With no tags, that is roughly 40 × 20 = 800 minutes, or about 13 hours a month. If tag enforcement means an assumed 30 of the 40 arrive already tagged, the work becomes 30 × 2 + 10 × 20 = 260 minutes, or about 4.3 hours. These inputs are assumptions, not measurements. Replace them with your own volume counts and the time your team actually spends per investigation.
The time freed this way also compounds. Each policy fix shrinks future scans, so the recurring review moves from clearing a backlog to a short weekly check of a few genuine exceptions.
How OneEnv can help
Disclosure: OneEnv is the product behind this blog.
OneEnv (oneenv.io) is a workspace-based governance platform for the things services share — environment variables, database structure, API routes and validation rules. A change to a shared value is staged on a branch, reviewed once, and then every affected service explicitly approves or rejects it before it goes live, so you can see who a change touches before it ships instead of finding out in production.
Applied to unattached ebs volumes cost, this is where it helps:
Saves time
- Every service that inherits a shared value is listed in one place, so nobody searches repos and chats to find out who is affected.
- One review per branch replaces coordinating each team separately; each service still keeps its own approve/reject.
- Reviewers see the exact diff and the list of affected services up front, so approval is a decision rather than an investigation.
Saves cost
- Fewer production incidents and rollbacks caused by a shared value, route or column changing under a consumer unannounced.
- Less duplicated configuration to maintain: one shared definition inherited by many services.
- Per-service approve/reject means a bad shared value can be refused where it would break something, before it is live.
- OneEnv has a free plan (1 workspace, unlimited services and members, full governance), so trying it costs nothing.
These are qualitative benefits, not measured results — how much you save depends on how many services share the value.
Want to try it? Start at oneenv.io.