snippetMinor
How to export EC2 snapshot into S3 bucket?
Viewed 0 times
intoec2bucketsnapshotexporthow
Problem
I've created a snapshot of EC2 instance via:
In
Creates a snapshot of an EBS volume and stores it in Amazon S3.
Although I cannot see in which bucket it has been imported.
In addition, there is a command
So basically I'm looking for some way of exporting EC2 snapshot into S3 bucket where I can see the image file in order to download it.
How I can do it?
aws ec2 create-snapshot --volume-id vol-xyzIn
aws ec2 create-snapshot help we can read:Creates a snapshot of an EBS volume and stores it in Amazon S3.
Although I cannot see in which bucket it has been imported.
In addition, there is a command
aws ec2 import-snapshot which imports a disk from the S3 bucket.So basically I'm looking for some way of exporting EC2 snapshot into S3 bucket where I can see the image file in order to download it.
How I can do it?
Solution
EBS Snapshots aren't really disk image files. They're logical containers of pointers to chunks of compressed and deduplicated backup data that EBS stores in S3 when you create snapshots -- but these are stored in buckets that EBS owns and controls.
They are user-accessible via only one mechanism -- creating a new EBS volume from the snapshot. When you do this, the new volume is linked back to its source snapshot and EBS starts loading the data onto the new volume in the background, from the snapshot storage in S3. If you access a part of the volume that EBS hasn't yet restored, it immediately goes and fetches the chunks and puts them on the volume.
To create a disk image file of a snapshot, you create a new volume from the snapshot, attach it to a running instance without mounting it, and then use the same tools you would use for a standard hard drive -- tools like
They are user-accessible via only one mechanism -- creating a new EBS volume from the snapshot. When you do this, the new volume is linked back to its source snapshot and EBS starts loading the data onto the new volume in the background, from the snapshot storage in S3. If you access a part of the volume that EBS hasn't yet restored, it immediately goes and fetches the chunks and puts them on the volume.
To create a disk image file of a snapshot, you create a new volume from the snapshot, attach it to a running instance without mounting it, and then use the same tools you would use for a standard hard drive -- tools like
dd to read raw blocks from the snapshot, and write them to a file, which you can then download from the instance, e.g. using scp.Context
StackExchange DevOps Q#3428, answer score: 4
Revisions (0)
No revisions yet.