Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there a way to attach an AMI, or a copy thereof, to an instance? This would be a non-pay public Linux AMI. An example would be the Ubuntu 12.04 LTS AMI. But I don't want to be limited to just that one, either (so a copy of it elsewhere, while nice to know, isn't the answer). In particular, what I am trying to avoid is making a copy that is running or has been run.

The test would then be to make a snapshot of that, and register that as an AMI, and it would be an exact copy. My intention would be to modify the copy (as my own volume). But my modifications would not work if it is a root device initially (since the transition of changes would cause a crash).

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Can you see the source file system for an AMI? No, Maybe, Yes:

NO: Most public AMIs do not make the source EBS snapshot publicly readable, so you can't look at the contents without running an instance of the AMI.

MAYBE: You can try running an instance of the AMI and then immediately "stop" it while it is "pending" in the hopes that it goes into the "stopped" state before the OS starts booting. Detach the root EBS volume from that instance and attach it to another instance to view the file system. This method cannot be used with AMIs in the AWS Marketplace as they are specially protected.

YES: Some companies that publish AMIs also publish copies of the file system image used to create the AMIs. For example, the file systems used to create Ubuntu AMIs are published by Canonical here:

http://cloud-images.ubuntu.com/

You can download the Ubuntu 12.04 LTS Precise image you reference here:

http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64.tar.gz

This can be used to create new AMIs using the method you describe.

share|improve this answer
    
I will use this to test out making my own AMIs (EBS and S3). Once I get that workflow perfected I'll then work on tweaking (adding packages) and extreme tweaking (replace everything with Slackware, Arch, or Gentoo). –  Skaperen Jul 25 '12 at 21:45
add comment

This is possible if you are using EBS backed AMIs. It might be possible with S3 backed, but it may take more digging.

  1. Start a fresh instance with the AMI you want to duplicate. This will create a new ~8GB EBS volume as the root device.

  2. Stop this new instance (not terminate)

  3. Detach the Root EBS drive (/dev/sda1) from the fresh, recently stopped instance.

  4. Attach this to another instance like a regular EBS drive. Manipulate as you wish.

  5. Snapshot the Drive.

  6. Convert the Snapshot to an AMI using the AWS Console.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.