40

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.

AndyL
  • 14,302
  • 14
  • 43
  • 70

3 Answers3

8

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.

ken
  • 1,067
  • 9
  • 14
  • 2
    Yes, thanks for the pointers, Ken. How do you determine the exact location of the AMI you just created, so you can apply "AMI Tools" to download ? – Cbhihe Apr 19 '17 at 12:01
-1

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.

Bob
  • 1
-2

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.

Anon
  • 75
  • 2
  • 2
    Are you suggesting that the only way to access an AMI is to start an instance and then take a snapshot? Shouldn't the AMI file itself reside somewhere accessible? – AndyL Oct 10 '10 at 12:01
  • 1
    And it may in fact be the only approach. AMIs are stored somewhere on S3. However, if they're stored with permissions that only allow the owner and EC2 to access them, then they might as well be inaccessible. You'll never be able to see them unless you have the appropriate keys. – Anon Oct 10 '10 at 13:46
  • Interesting. But what about *public* AMI's, such as the Ubuntu AMI that I linked to. I would suspect these are accessible to everyone. How would I go about finding their S3 address? Ultimately, I would strongly prefer not to have to start a new instance. Part of my goal is to take public AMI's out of the cloud in a programmatically accessible way. – AndyL Oct 10 '10 at 14:37
  • 1
    I have no idea why you'd suspect that. It would make much mroe sense if publisher retained sole access to the image, and simply granted EC2 read rights. There's absolutely no need to make an S3 bucket world-accessible, and the publisher would have to pay download charges (or take extra time to configure the bucket so that the downloader pays). – Anon Oct 11 '10 at 11:39
  • 1
    To follow Anon's initial post here, it looks like you currently have to use bundling utilities from the command line of the EC2 instance you want to transfer to S3. There is currently good documentation at AWS that discusses this process. It's not straightforward, but looks like it would do the trick. [link]http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/creating-an-ami-instance-store.html – Robert Casey Dec 11 '13 at 17:07
  • BitNami is one manufacturer of AMIs that has them available for download, with installers, etc: http://bitnami.com/stacks. But For the others, it would seem best to set them up in AWS and take a snapshot first, so you can establish your keys and security credentials, etc. AWS offers a free Micro Tier for a year, so that's plenty to get images. – rcd Mar 30 '14 at 18:53
  • 1
    "Is this a real problem that you're trying to solve?" It's called due diligence, visibility, inspection, engineering. I download AMI provided by Amazon ALL THE TIME in order to determine how automations are happening and know how things work from the ground up and what is being provided beyond the norm. – whardier Mar 27 '22 at 22:59