Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to list all the snapshots created from a single volume ID EC2 instance?

In the past few months our snapshots backup volume increases and hence our monthly bill in amazon EC2. Now I wanted to delete some of our old EC2 snapshots. So here is the question:

How to find all the snapshots created from a single Volume ID using EC2 command line tool?

I tried ec2-describe-snapshots but this list all the snapshots. We have lots of snapshots and it is very difficult for me to note them down one by one.

like image 936
user2729573 Avatar asked Oct 15 '25 07:10

user2729573


2 Answers

aws ec2 describe-snapshots --filters "Name=volume-id, Values=vol-1234,vol-5678"

to get the values of only the snapshot-ids and the corresponding volumes:

aws ec2 describe-snapshots --filters "Name=volume-id, Values=vol-1234,vol-5678" --query 'Snapshots[*].{SnapshotId:SnapshotId,VolumeId:VolumeId}' --output table

Refer : http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-snapshots.html

like image 104
supa_command Avatar answered Oct 16 '25 20:10

supa_command


Do ec2-describe-snapshots --filter "volume-id=vol-12345".

Well documented.

like image 26
Assaf Lavie Avatar answered Oct 16 '25 22:10

Assaf Lavie