This post will explain in step by step process to create an AMI of AWS EC2 Instance. Many times we require similar web servers, language runtimes and databases for many application, so we can create AMI of an existing instance where we have already installed webserver like Nginx or Apache and language runtimes like PHP etc. We can utilize this created AMI to launch a new instance. AMI’s are region specific, but they can be copied to another region or to a different AWS account. Reading this post will make you learn how to create AWS EC2 AMI.
You can create AMI of a running instance as well as stopped instance. Recommended is to create AMI of a stopped instance, otherwise you may loose some info. AMI’s are usefull in case of autoscaling as well where we need to auto launch instance on hitting certain metric, so the newly generated autoscaled instances should have similar infrastructure. Now, let’s see how we can create an AMI.
1. AWS Console Access with administrator permissions or full permission for EC2.
2. Running AWS EC2 Instance whose AMI to be created.
STEP 1: Browse the EC2 Instance
Login to your AWS console in any browser, you will be landed on dashboard. Select the region from top right corner.
Click EC2 and select the instance whose AMI needs to be created.
STEP 2: Select Create AMI Option
From the actions drop down button on top of EC2 Instance you can hover over to Image option and then selecting Create Image option.
STEP 3: AMI Configuration
When you click Create Image button this will open up a window. In that windows you can give a name to image for identification, you can put in some description. There is an option for No Reboot as well, on selecting it the AMI will be created out of running instance, if it is not selected then the ami will be created on a reboot. It is always a good practice to keep No Reboot unchecked, that shuts down the instance before creating an image. This will keep the file system integrity intact. You can increase volume size of AMI and can uncheck Delete on Termination if you want to delete volume when terminating an instance.
After clicking create image, it will display another window stating Create Image request recieved, you can close this window. After closing window, from Images section in left navigation click on AMIS to see status of AMI you had requested for creation.
STEP 4: Check the Status of AMI
EC2 Instance AMI creation takes some time, so initially you may see a pending status in Orange colour, which will change to Available in Green colour.
That’s it you are done with AMI creation. In our next post we will show you how you can copy an aws ami to another region, copy an aws ami to other AWS account, and how to de-register an ami when you no longer needed it.