What is AWS AMI?
Amazon Machine Images are custom EC2 Instances that offer repeatability and fast deployment of underlying software. The goal of an AMI is to create a “snapshot” of an EC2 instance and allow duplication and easy deployment of this asset as needed.
To follow along with this tutorial, you will need:
- A basic understanding of AWS EC2 instances.
- A basic understanding of AWS EBS volumes.
- An active EC2 instance.
What are the Types of AWS AMIs?
Two options are available to every AWS user when it comes to AMIs:
Option 1 - Public AWS AMIs
AWS has created an AMI marketplace that provides a listing of thousands of different AMIs created by 3rd party vendors. These images can be easily deployed on an EC2 instance. The vendors provide extensive documentation of their AMI through the marketplace - how to deploy, what software it contains, what the costs are, etc.
The Figure 3.1 above is the main page of the AWS Marketplace. From this page, the user can search a variety of vendors that supply AMIs. Here’s an explanation of search parameters:
- Categories | The user is able to search by “Infrastructure Software, “DevOps”, “Business Applications”, “Machine Learning”, “Data Products”, “IoT”, “Professional Services”, “Industries”, and all the sub categories for those options.
- Vendors | The user is able to search software that has been delivered by a specific vendor.
- Pricing Plans | It’s important to note that one of the reasons to dliver AMIs via the Marketplace for a vendor is to charge for using said AMI. You can filter for various billing models such as Hourly, Monthly, Free, By Hosts, etc.
- Delivery Methods | In addition to AMIs, some of the tools / software is delivered via other means - Ex: deployed through Kubernetes using AWS EKS. By using the filter, the user can ensure that the software they’re getting can be deployed using the method of their choice.
Option 2 - User Created AMIs
An AWS user can create an AMI from their own instance. This is particularly useful for two reasons - 1. You can customize your instance and load the software of your choice. 2. You’ll keep the instance private to your account. These AMIs won’t be available to any other users unlike the public AMI marketplace.
Creating an AMI from an EC2 Instance
In this section, we’re going to walk you through an example of the AMI creation process.
Note: you’ll need to have an EC2 Instance running on your AWS Account to create an AMI.
Step 1 - Create an Image of an EC2 Instance
1.1 - From the EC2 Dashboard, click on “Instances.”
1.2 - From the list of EC2 instances, right-click on the EC2 instance you’d like to create an AMI for.
1.3 - From the drop-down menu, select “Image and templates.”
1.4 - From the drop-down menu, click on “Create image.”
Step 2 - Specify the Parameters of the AMI (Part 1 / 2)
2.1 - [Optional] From the Create image menu, enter an “Image name.”
2.2 - [Optional] From the Create image menu, enter an “Image description.”
2.3 - [Optional] Modify the size of the EBS Volume attached to the instance, enter size in GB.
2.4 - [Optional] Modify the “Delete on Termination” setting of the EBS Volume attached to the instance, use the checkmark to enable.
2.5 - [Optional] Add another volume to the instance if needed, click on “Add volume” and specify parameters.
Step 3 - Specify the Parameters and Create Image (Part 2 / 2)
3.1 - [Optional] From the Tags menu, you can specify to tag the image and snapshot together.
3.2 - [Optional] From the Tags menu, specify a tag for the AMI.
3.3 - At the bottom of the page, click on “Create image.”
Conclusion - Image Listing in AWS EC2
Once the process is complete, you’ll have a listing of the AMI under the AMIs section in the EC2 Dashboard as shown below.