Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create "Instance Store" AMI image of a Reserved Instance with no EBS

I have some micro instances with EBS volumes and from the ec2 console you can right click and create a AMI image of the whole system.

But I bought some High-Memory Reserved Instances which had 500GB of storage so I installed a "Instance Store" ubuntu AMI image

Now I have configured everything on my server and want to create a instance store ami image so that I can install those images on new servers and I don't have to install everything again

Can you please help me how can I do it.

Thanks

like image 404
user1025488 Avatar asked Jul 27 '12 20:07

user1025488


People also ask

When you create an AMI Where is the image stored?

An Amazon Machine Image (AMI) is stored in Amazon S3, but it is not directly accessible. Instead, you must use API calls or the Management Console to use an AMI.

Does AMI include EBS volumes?

By default, when you create an AMI from an instance, snapshots are taken of each EBS volume attached to the instance. AMIs can launch with multiple EBS volumes attached, allowing you to replicate both an instance's configuration and the state of all the EBS volumes that are attached to that instance.


1 Answers

This is how you do it with Ubuntu: Launch desired instance from here (pick one without EBS storage): http://cloud-images.ubuntu.com/releases/precise/release/

Follow this guide here (look below for hints concerning Ubuntu): http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/creating-snapshot-s3-linux.html

  1. First you need to create you public key and certificate using this guide (you will need them later): http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-credentials.html#using-credentials-certificate
  2. Also note your AWS Account ID: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-credentials.html#using-credentials-account-id
  3. Upload your pk and cert to your ubuntu instance that you downloaded: scp -i <path-to-your-ec2key>.pem <your-account-pk>.pem <your-account-cert>.pem ubuntu@<yourinstance>.<yourzone>.compute.amazonaws.com:~/
  4. That puts the pk-file and cert-file in you home directory in your running instance. Now login and move these to the /mnt directory so that they do not get included when you bundle your AMI.
  5. Now modify your image to your hearts content.
  6. Install EC2 AMI Tools: sudo apt-get install ec2-ami-tools
  7. Run the following command to create your bundle: ec2-bundle-vol -k <your-account-pk>.pem -c <your-account-cert>.pem -u <user_id>
  8. Se guide above for the rest. You need to upload you bundle to S3 and then register your AMI so you can launch it.

Good Luck!

like image 178
Magnus Avatar answered Sep 30 '22 23:09

Magnus