← Back to list

The Ultimate Guide to AWS AMI (Amazon Machine Image)

Ridma Gamage in AWS Tip · 2025-03-12 06:50 · 1 claps · 4.5 min read paywalled
#aws-ami #machine-image #ec2 #aws #ebs-volume
Open on Medium ↗
Wiki topics: ☁️ · DevOps & Cloud

The Ultimate Guide to AWS AMI (Amazon Machine Image)

What is an AMI (Amazon Machine Image)?

An Amazon Machine Image (AMI) is a template that contains software and information that are required for setup and launch of an Amazon EC2 instance. AMI contains OS, softwares, configuration and permissions to boot EC2 instances. You should select an AMI when you create an EC2 instance.

Importance of AWS AMI?

When you deploy an AWS EC2 instance, you need to set it up from scratch. This process can be time consuming if you need to do it from scratch all the time and also if you need to create a large number of instances. As a solution for that, Amazon provides AMI with a pre-configured template. Users can have the following advantages using AMI.

  • Save the time for launching instances.
  • Users can launch identical environments across the multiple EC2 instances.This will increase the consistency.
  • AMI can be used in Auto scaling to handle dynamic workloads.
  • Users can use AMIs to backup their instances.

Key Components of an AMI

  • Region : AMI specifies AWS region (geographical area) where AMI is available to use with EC2. AMI is not directly allowed to launch in another region. But you can copy it to another region and then use it to launch instances.
  • Operating System : AMI define for specific operating system (Windows, Linux, Mac)
  • Root volume : Primary storage that used to contain operating system and core softwares.
  • Block device mapping : Additional storage devices (EBS or instance store)
  • Launch permissions : You can specify in AMI, which AWS accounts can use the AMI to launch the instances.
  • Metadata : Specify the information about architecture. (ARM, x86_64, Virtualization type)
  • Virtualization Type : AMI can use two types of virtualization. It can be Hardware Virtual Machine( HVM) which provides better and efficient performance and Paravirtual (PV) which is the legacy type.

Types of AMIs in AWS

There are 4 types of AMI based on the accessibility, source and customisation.

  • Prebuilt AMIs : These are the AMIs that are available by default when you create an EC2 instance from the AWS console. They can be free or paid based on their resource capacity and specialization. (Ex: Amazon Linux AMI, Ubuntu AMI). This provides a way to launch instances with clean OS installation.
  • Custom AMIs : The ones that individual users created from their EC2 instances. It can include the custom setting along with the pre-installed OS and software. Users can create them as a backup purpose or sharing purpose.
  • Shared and Private AMIs : Purpose of shared AMI is It can be shared between multiple AWS accounts. and private AMIs are only accessible to users AWS account.
  • Marketplace AMIs : Provided by third party vendors with some pre-installed software or enterprise software. It can be free or paid. As an example you can see the marketplace AMIs with pre-configured wordpress, postgres, Mysql, mongodb, etc

How to Create an AWS AMI

1. Create AMI using existing EC2 instance in AWS console.

  • Go to the AWS console -> EC2 dashboard → Instances
  • Select the instance that you want to create an AMI
  • Go to Actions -> Image and Templates -> Create image

  • It will open the Create Image window and you can give a name and a description. Change the volumes and tags according to your requirement or keep it as is and click the create image button. It will create the image. You can see it under the Images-> AMIs.

2. Create AMI using AWS CLI

aws ec2 create-image --instance-id <Instance_ID> --name "ec2_001_AMI" --no-reboot

3. Creating an AMI with Packer

You can use hashicorp parker to automate the creation of AMIs.

  • Install parker and configure the AWS credentials using AWS CLI.
  • Create a .hcl file or json file to define the steps to create the AMI. (aws-ami.pkr.hcl)

  • Use below commands to initialise, validate and build the parker template.
packer init .
packer validate aws-ami.pkr.hcl
packer build aws-ami.pkr.hcl

How to Launch an EC2 instance using AMI

  • Go to AWS console and EC2 dashboard
  • Expand Images from the left side panel and click AMIs. You can see the available AMIs list.
  • Select a AMI that you want to launch an instance and click Launch instance from the AMI button.

  • It will launch the EC2 and you can see it in EC2 dashboard.

AMI Storage

When a user creates an AMI, it contains root volume and EBS snapshot or instance store volumes. These two types of storage are considered the AMI storage types. Let’s see the difference between these two storage types.

  • EBS backed AMI : These AMIs are stored root volume as a EBS snapshot. This method helps to persist data even after the instance terminated and you can reside in the EBS volume. It is stored in the Amazon S3. Users have to pay for the Amazon S3 storage and EBS volume size used by instances.
  • Instance Store backed AMI : These AMIs are stored root volume on local instance storage instead of EBS. This way data will be lost when the instance stops or terminates. But this increases the performance. AMI is stored as an Amazon S3 image file and User has to pay only for the S3 storage.

Best practice is always delete the AMIs when they are no longer used.

Managing and Deleting AMIs

Deregistering an AMI

  • Go to EC2 Dashboard → AMIs.
  • Select the AMI and click Deregister AMI.

Deleting Associated Snapshots

  • Identify snapshot ID:
aws ec2 describe-images - image-ids ami-xxxxxxxx

Delete snapshot

aws ec2 delete-snapshot - snapshot-id snap-xxxxxxxx

Purpose of this article is to provide the theoretical and hands on knowledge about the AWS AMI. Hope this helps you. Please post below if you have any queries about the article.


메타데이터
post_id
a85201136f9b
slug
the-ultimate-guide-to-aws-ami-amazon-machine-image-a85201136f9b
url
https://awstip.com/the-ultimate-guide-to-aws-ami-amazon-machine-image-a85201136f9b
canonical_url
https://awstip.com/the-ultimate-guide-to-aws-ami-amazon-machine-image-a85201136f9b
author_url
https://medium.com/@ridmag
status
ok
fetched_at
2026-08-04 16:45:44