Are you working on the Amazon Web Services (or AWS) cloud platform? Amazon Machine Image (or AMI) offers an easy and visual mode of launching instances of your virtual machine on the cloud platform.
For example, you may want to launch multiple and identical instances of the same virtual machine for your applications. AMI allows you to do that by creating an unlimited number of instances having the same configuration in a short period of time.
Additionally, you can use AMI to create multiple instances of different virtual machines when you require instances of different configurations.
How does the AMI technology work and what are the different types of AMI that are available for your use? Let’s discuss all this and more in the following below-given sections.
In this article, we will go through the below topics: |
In simple words, an AWS AMI is a virtual image that can be used to create an instance of a virtual machine. How does it operate? Here’s an illustration that summarizes the AMI lifecycle:
Related Article: What is Amazon AWS |
The first step is to create and register the AMI, which is then used to launch or set up AWS instances. Alternatively, you can launch instances from another AMI provided the AMI creator grants you the necessary launch permissions. You can also copy an existing AMI within the same or different AWS region. Finally, you need to deregister an AMI once you no longer require it.
An AMI typically consists of the following three components:
Want to become a Certified AWS Solution Architect? Learn AWS Certification Training |
As an AWS user, you can choose your AMI on the basis of the following parameters:
You can choose an AMI on the basis of the supported operating system (or OS) like Windows or Linux.
This parameter is based on the architecture of your selected OS.
This parameter is based on the selected region of the Amazon machine image that comprises regions, availability zones, and local zones. Each region operates in different geographical regions and is independent of each other.
This AMI parameter is based on the storage of the root device. Based on storage, AMIs are categorized as either of the following two types namely:
The table below highlights the main differences between these two storage types:
EBS-backed AMI | Instance store-backed AMI | |
Instance boot time | < 1 minute | < 5 minutes |
Size limit for root device | 16TiB | 10GiB |
Data persistence | The root volume is deleted on the termination of the instance. | Data persists only during the overall life of the instance. |
Cost | Less expensive | More expensive |
An AMI owner can determine their instance availability through the following three launch permissions:
Related Article: AWS Interview Questions for Experienced Professionals |
In simple language, a shared AMI is one that an AWS developer creates and shares with other users for use. Shared AMIs enable any new AWS user to easily get started using the AWS platform. On the flip side, Shared AMIs are not guaranteed any security or integrity and must be treated as any other foreign code.
You can locate the following shared AMIs from the Amazon EC2 console by selecting the “AMIs” option from the navigation pane:
Additionally, you can also create your own AMI and share it for public use or with specific AWS accounts.
Here’s how you can share your AMI with all AWS account holders:
Alternatively, you can share your AMI for public use by modifying the “launchPermission” property of your AMI. To do this, run the “modify-image-attribute” command for the specific AMI as follows:
aws ec2 modify-image-attribute
--image-id ami-<ID>
--launch-permission "Add=[{Group=all}]"
Here’s how you can share your AMI with specific AWS account holders:
Learn end-to-end AWS concepts through the AWS Course in Hyderabad to take your career to a whole new level!
Alternatively, you can share your AMI for public use by modifying the “launchPermission” property of your AMI. To do this, run the “modify-image-attribute” command for the specific AMI as follows:
aws ec2 modify-image-attribute
--image-id ami-<ID>
--launch-permission "Add=[{ UserId=<UserID>}]"
As the name suggests, a paid AMI is when you purchase an AMI from another developer. As an AMI developer, you can create an AMI and then sell the same on the AWS Marketplace that is an online store for paid AMIs. For paid AMIs, the AWS user is charged for the instance based on the rates set by the AMI owner.
You can find a paid AMI either from the Amazon EC2 console or from the AWS Marketplace. Here’s how to find one from the Amazon EC2 console:
To find a paid AMI from the AWS Marketplace:
Alternatively, you can find a paid AMI by running the “describe-images” command as follows:
aws ec2 describe-images
--owners aws-marketplace
On running this command, you are provided with a list of paid AMIs along with its product code. You can filter the list of paid AMIs by searching for the product code.
You need to first sign up or purchase a paid AMI before launching an AWS instance using the AMI. To purchase a paid AMI, you can use the Amazon EC2 launch wizard.
For the Linux OS, AMIs uses either of the following virtualization methods, which are primarily different in their booting processes:
In this case, the AVM instance boots with the help of a special boot loader, PV-GRUB that starts the boot cycle and then loads the menu.1st file kernel on the image. AVM users deploying this method run their instances on host hardware that do not explicitly support virtualization, hence cannot exploit hardware extensions like GPU processing for better performance.
AMIs that are based on the HVM method has the ability to directly run an OS on the virtual machine without any underlying modification. HVM allows complete access of the virtualized hardware and booting through the execution of the master boot record of your image’s root block device. HVM users can also exploit the hardware extensions on the host system for better performance.
On the whole, the PV method works better for applications with storage and network operations as compared to HVM. However, for the best overall performance, HVM AMIs work better when launching your instances.
As discussed before, you can only launch an instance after selecting a Linux AMI. Here are the two best ways to locate and select an AMI from the Amazon EC2 console:
Choosing an AMI during the EC2 launch
1) Sign in to the Amazon EC2 console and then select from the available AWS regions in which you wish to launch your instance.
2) Next, from the dashboard, click the “Launch Instance” button.
3) This will open the section where you can now choose an Amazon Machine Image (AMI). You can choose the AMIs from any of the following four sections:
4) Review the existing AMIs and check the Root device and virtualization type of each AMI. Finally, choose the AMI that satisfies your instance requirements.
Choosing an AMI using the Images page
1) Sign in to the Amazon EC2 console and then select from the available AWS regions in which you wish to launch your instance.
2) From the Images menu on the left navigation pane, choose the “AMIs” option.
3) From the Filter section, select the “Public Images” option from the drop-down list to view all the machine images that are safe for public use. Alternatively, you can select “Private Images" to view all the shared AMIs that have been shared with you.
You can also choose to filter the AMIs on the basis of other parameters like AMI name, owner, architecture, and image type.
4) Select the AMI of your choice, then click “Launch” to launch the AWS instance on the next page.
Leave an Inquiry to learn AWS Course in Bangalore
You can also create your own AMI from a running AWS instance. You can use this AMI later to launch additional instances in the near future.
Here are the steps you need to follow to create your own AMI:
1) Sign into the Amazon EC2 console.
2) Next, from the dashboard, select the running instance (as illustrated in the figure), then click the Actions > Image > Create Image option.
3) The “Click Image” dialog box is displayed with the following instance-related fields:
4) Click “Create Image” to start the creation of your AMI.
5) After creating the AMI, you can view your AMI in the “Owned by me” section along with its details.
You can deregister your AMI once you have finished using it to launch new instances. This does not impact any of the running instances that you have launched using the same AMI.
Additionally, deregistering an EBS-backed AMI does not impact the snapshots taken for the instance volumes created when creating the AMI. You need to delete those snapshots separately.
For instance, for store-backed AMIs, deregistering does not impact the files uploaded to the Amazon S3 location when creating the AMI. You need to delete uploaded files separately.
Here’s how you can deregister your AMI:
1) Sign in to the Amazon EC2 console.
2) Next, from the dashboard, click the “AMIs” option in the left navigation pane.
3) Select the “Owned by me” filter option, and then select the AMI that you want to deregister.
4) Click Actions > Deregister
5) Click Continue on the Deregister dialog box to complete the deregistration process.
Alternatively, you can deregister your owned AMI by running the “deregister-image” command as follows:
aws ec2 deregister-image --image-id ami_id
Conclusion
As an AWS user, you can use Amazon Machine Image or AMI to create a new image or customize an existing image to launch new instances. You can also copy the AMI to other AWS regions for wider use. Through this guide, we have learned about shared and paid AMIs, as well as how to create and find an AMI for your use. Additionally, we have learned how to deregister an AMI which is no longer in use.
Hope you have found the article helpful and knowledgeable. You can leave a message if you have any doubts regarding AWS AMI.
Our work-support plans provide precise options as per your project tasks. Whether you are a newbie or an experienced professional seeking assistance in completing project tasks, we are here with the following plans to meet your custom needs:
Name | Dates | |
---|---|---|
AWS Training | Dec 14 to Dec 29 | View Details |
AWS Training | Dec 17 to Jan 01 | View Details |
AWS Training | Dec 21 to Jan 05 | View Details |
AWS Training | Dec 24 to Jan 08 | View Details |
Prasanthi is an expert writer in MongoDB, and has written for various reputable online and print publications. At present, she is working for MindMajix, and writes content not only on MongoDB, but also on Sharepoint, Uipath, and AWS.