AWS AMI or Amazon Machine Image (AMI) is a way to launch a virtual machine in the AWS cloud. In general, to launch a virtual machine we use the standard distribution of the providers. But what if you want to launch several identical instances of virtual machines. You need something that can give you identical instances each time you launch with a very short launch time.
The answers to all questions is Amazon Machine Image (AMI). You can launch identical instances as many as you want, all in one go. And it takes a very short time in AWS to launch a virtual machine with AMIs. We have launched an EC2 machine with an AMI in our post “Amazon EC2 – AWS Elastic Compute Cloud”.
What is AMI?
AMI is an abbreviation for “Amazon Machine Image”. Amazon Machine Image provides essential information to launch a virtual machine in the cloud. You can launch several instances at a time in case you want multiple instances with the same configurations.
An AMI typically contains three below things in it:
- Template – For the root volume for the instances (An application server, an OS, and applications)
- Permissions to Launch – Which account can use this AMI to launch instances.
- Block Device Mapping – that specifies the volumes to attach to the instance during its launch time.
AWS provides you the web interface to launch Amazon EC2 instance. It has ready to instantiate AMIs (Amazon Machine Images) available.
Types of AWS AMI
There are no certain types of AMI but you can choose an AMI based on the below characteristics:
- Operating System Based – You can choose a machine image based on the operating System such as Linux, Windows etc.
- Architecture (32-bit or 64-bit) Based – Based on the architecture of the underlying operating system.
- Region Specific – Region and availability zone specific machines images.
- Storage Based – Based on the storage for the root device. All Amazon Machine Images are either backed by Amazon EBS or by instance store.See the below summary table: (reference : https://aws.amazon.com)
-
Storage Based Summary
- Launch Permission Based – The owner of the AMI can decide the visibility and launch permission of the AMI. Available launch permissions are:
- public – All AWS accounts gets the access of these AMIs.
- explicit – Owners grants the permission to specific AWS accounts.
- implicit – Only owner has the implicit permissions to launch the AMI.
Amazon Linux AMI Virtualization Types
AWS uses two types of virtualization for Amazon Machine Images:
- PV (paravirtual)
- HVM (hardware virtual machine)
The main differences between PV and HVM AMIs are their booting process. On how they can take advantage of special hardware extensions (CPU, network, and storage) for better performance.
Find/Use a Amazon Linux AMI
There are a couple of ways you can find a Linux Amazon Machine Images.
1. Choose AMI during the EC2 Launch
We have discussed and used this option during the EC2 instance launch in our post “Amazon EC2 – AWS Elastic Compute Cloud”.
Follow the below steps:
- Go to the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
- Click on the “Launch Instance” button.
Create Instance EC2
- You will see the below option to “Choose an Amazon Machine Image (AMI)”. Choose an existing AMI for quick start.
You can see that there are three options available to choose the AMIs.- My AMI – The AMIs created by you will be there in this tab.
- AWS Marketplace – The AWS Marketplace is for the paid Amazon Machine Images. You can create and sell your AMIs in AWS marketplace.
- Community AMIs – The AMIs which are build by and for public usage.< span id=”shared-amis”>Shared AMIs
As per the name, Shared AMIs are the Amazon Machine Images which are created by developers and are publically available for use. You can create and share the EMIs on AWS.
If you are going to use the shared AMIs then use these on your own risk. Amazon or developers can’t vouch for the integrity or security of AMIs shared by other Amazon EC2 users. AWS recommends using the AMIs from trusted sources only for security reasons.
We have already discussed this in the section above under the heading “Choose AMI from Image Page”. See the steps that we use to find public shared AMIs.
Publish a Public AMI
AWS allows you to create your own Amazon Machine Images and share them with other AWS users. You can restrict the use to certain AWS accounts also. You will not be billed if someone uses your AMI, only the user will be billed.
After you make an AMI public it will be available in the “Community AMIs” section. Follow the below steps to create a public AMI:
- Go to the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
- Select the “AMI” option from left navigation bar under the “IMAGES” menu.
- Select the AMI from the list that you want to make public and then choose “Actions” option “Modify Image Permissions”.
- Choose option “Public” and “Save”.
Note: If you want to share the AMI to a certain AWS account then you can choose the “AWS Account Number” field and then “Add Permissions”.
Paid AMIs
You can purchase AWS AMI from the “Amazon Marketplace”.
Amazon EC2 is also integrated to use the Amazon Marketplace where developers can buy and sell their AMIs. You can find, Buy, and deploy your AMI here at https://aws.amazon.com/marketplace.
Launching an AMI from the Amazon Marketplace is exactly similar to any other instance launch. So, the steps are almost the same to find a paid AMI:
- Go to the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
- Select the “AMI” option from left navigation bar under the “IMAGES” menu.
- Choose “Public Images” from the filter.
- Now in search bar, choose “Owner : AWS Marketplace”. And you will see the list of paid AMIs. See below screenshot for your reference:
Paid Amazon Machine Images
- The rest of the steps are same to launch the instance from the chosen AMI.
Creating your own AMI
AWS provides you the options to create your own AMI as well. The classical case of creating AMI is that you have an EC2 instance running and want to make an AMI of it. So that you can launch other instances in the future from this.
Let’s create an AMI from the running EC2 instance. Please follow the below steps:
- Go to the Amazon EC2 console at https://console.aws.amazon.com/ec2/
- Click on “Create Image”, below dialog will open with some inputs to fill.
Fill Details To Create Amazon Machine Image
- Instance Id – EC2 instance Id
- Image Name – You can give any name to your AMI
- Image Description – (optional)
- Instance Volume – AWS will pick the default volume settings which is attached with your instance. You can change the volume size and volume type as per your requirements.
- You can also attach new volume to your AMI
- Click on “Create Image” button. AWS will start creating your AMI in back and you will receive a message that “Create Image request receive”.
- You can on the Image name or “Close” button and you will see that your image has been listed in AMIs under “Owned by me” section.
-
Amazon Machine Image Created
Deregister Your AMI
If the AMI is no longer required then you can deregister it in simple steps.
- Go to the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
- Select the “AMI” option from left navigation bar under the “IMAGES” menu.
- Select option “Owned by me” and choose the AMI to deregister from the “Actions”.
-
Deregister Amazon Machine Image
- Click on “Deregister” and you system will prompt a dialog with an options to “Continue”.
Deregistered Amazon Machine Image
Click on “Continue” button and your AMI will be deregistered. You will not have the AMI under the section “Owned by me”.