Reputation: 14693
I would like to download a public Amazon EC2 AMI, such as this one (Ubuntu Lucid), so that I can programmatically extract its contents.
How do I do this? I suspect there is an S3 address somewhere? This blog post looks like it once described this process, but the link seems to no longer work.
So far I can only find explanations of how to move around EC2 instance within AWS. I believe manifest files are an important piece of the puzzle.
Upvotes: 45
Views: 72075
Reputation: 25371
I can think of at least two approaches:
Follow the (surprisingly complicated) EC2 VM export docs to export the AMI to S3, then download from S3.
This may work for some AMIs, but sadly it didn't work for me when I tried it because I was trying to download an AMI exported from an Amazon Lightsail snapshot, which apparently fails the prerequisites:
$ aws ec2 export-image --image-id ami-xxx --disk-image-format RAW --s3-export-location S3Bucket=xxx
An error occurred (InvalidParameter) when calling the ExportImage operation: The image ID (ami-xxx) provided has encrypted EBS block devices and is not exportable.
What did work, however, was the following approach:
mount
it, inspect it, rsync
from it, etc.).Upvotes: 2
Reputation: 11
Seems an approach would be to create a volume directly from the public ami. Then you could run an instance, mount the volume you created from the ami, and download the files from the instance using any file transfer scheme.
Upvotes: -1
Reputation: 1097
Use the ec2-download-bundle in the AMI Tools to download AMIs. Create an instance, then immediately create an AMI. Use ec2-download-bundle to retrieve and decrypt the AMI.
Upvotes: 7
Reputation: 73
Is there a real problem that you're trying to solve?
Because if there is, and you need the contents of a particular AMI to solve it, then your best approach is going to be starting an instance and taking a snapshot of its running EBS (which you can then download). If you're not using an EBS-backed instance, then you can use the Amazon tools to create an AMI from your current instance.
Upvotes: -3