Hey everyone! I've run into a bit of a problem with what seems like thousands of orphaned snapshots on AWS, and I'm not sure how to get rid of them. When I run the command `aws ec2 describe-snapshots --region us-west-2 --profile profilename --output text > snapshots2.txt`, it gives me a huge list of snapshots, many dating back to 2017 and 2018.
When I try to delete these snapshots using `aws ec2 delete-snapshot --snapshot-id "snap-XXXXXX" --profile profilename --region us-west-2`, I keep getting an error that says the snapshot does not exist, even though I'm being charged for them. I've already spent hours trying to figure this out with ChatGPT, but it just leads me in circles. Unfortunately, I don't have a support plan. Is there any way to clean these up? Thanks for any help!
3 Answers
Are you sure those snapshots are actually yours? The command you used can list public snapshots as well. Maybe some aren’t owned by your account. You might want to use the `--owner-ids` flag to filter the list down to only those you own.
Before proceeding, did you check the AWS documentation about deleting snapshots? There are various reasons why snapshots can’t be deleted, especially if they're owned by another AWS account in your organization. If you want, you can activate business support just for this issue to get help, then deactivate it later.
I might go ahead and activate business support. We do have an AWS Organization, so there could be snapshots from other accounts.
You could try this command to limit the snapshots to only those owned by you: `aws --profile --region ec2 describe-snapshots --owner-ids self`. It should help narrow down the orphaned snapshots you can actually delete.
Thanks! That command did help reduce the number of snapshots in the list.
Thanks for pointing that out! I didn't realize the command included public snapshots. I’ll try using the `--owner-ids` flag to get a more accurate list.