Checking to see what is in old AWS EBS Snapshots - Green-Biome-Institute/AWS GitHub Wiki
How to check what is inside of an EC2 EBS snapshot!
- Build an EC2 instance
- Create a volume from the snapshot that is in the same availability zone as the ec2 instance
- In order to check the ec2 instance availability zone, have aws cli tools set up and configured (use
aws configure
), and use the commandaws ec2 describe-instances --instance-id [your instance I]
, then scroll up to where you see “Availability Zone” and to the right of that is the availability zone. It will looking something like “us-west-2a”
- In order to check the ec2 instance availability zone, have aws cli tools set up and configured (use
- Use
aws ec2 attach-volume --volume-id [your volume ID] --instance-id [your instance ID] --device /dev/sdf
- Use
lsblk
to identify the name of the device
1. This will result something like:
ubuntu@ip-172-31-52-157:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 26.6M 1 loop /snap/amazon-ssm-agent/5163
loop1 7:1 0 55.5M 1 loop /snap/core18/2344
loop2 7:2 0 61.9M 1 loop /snap/core20/1405
loop3 7:3 0 79.9M 1 loop /snap/lxd/22923
loop4 7:4 0 43.6M 1 loop /snap/snapd/15177
nvme0n1 259:0 0 8G 0 disk
├─nvme0n1p1 259:1 0 7.9G 0 part /
├─nvme0n1p14 259:2 0 4M 0 part
└─nvme0n1p15 259:3 0 106M 0 part /boot/efi
nvme1n1 259:4 0 50G 0 disk
└─nvme1n1p1 259:5 0 50G 0 part
The very last one is your new volume addition. The entry “nvme1n1p1” is the partition of the new volume we will use
5. Use sudo mount /dev/nvme1n1p1 /newvolume/
6. Then you can navigate into the volume by using cd /newvolume
Once you have seen what is on the volume and decided what to do with it, you can unmount and detach the volume by doing:
7. sudo umount /dev/nvme1n1p1
8. aws ec2 detach-volume --volume-id [your volume ID]
All done! You can delete the volume and snapshot to save room on the AWS account using the online dashboard.