The complete beginner's guide to AWS AMIs
Tags: aws, cloud, awsec2
Published: 2021-05-01 19:51:30

---
title: The complete beginner's guide to AWS AMIs
published: true
date: 2021-04-23 07:16:43 UTC
tags: aws,aws,cloud,awsec2
canonical_url: https://www.archerimagine.com/articles/aws/aws-ami-tutorial.html
---

![AWS Made Easy | AWS AMI](https://www.archerimagine.com/images/aws/ec2/02-AWS-AMI.png "AWS Made Easy | AWS AMI")

## Introduction[¶](#introduction "Permanent link")

Have you ever pondered on the question

_Why AMI (Amazon Machine Image) is not called Operating System?_

If you revisit our previous article, where the first AWS EC2 instance in free tier was created, see [Step by Step guide to create an EC2 instance,](https://www.archerimagine.com/articles/aws/aws-ec2-tutorial.html#step-1-choose-an-amazon-machine-image-ami). The first selection was for AMI.

![AWS Made Easy | AWS EC2 | Ubuntu AMI](https://www.archerimagine.com/images/aws/ec2/01-AWS-EC2-SS-EC2-Ubuntu-AMI.png "AWS Made Easy | AWS EC2 | Ubuntu AMI")

In this article you will find out, _Why Amazon Machine Image (AMI) is not called operating system?_ This article is everything, you need to understand AWS AMIs.

You will also get answer's to these questions

_Why are they referred to as AMI?_  
_What does the AMI cost?_

This article will enlighten you with the AWS AMIs inner working. It also explains that you pay for the AMI, when you get bill for your EC2 instance.

This will be a beginner friendly resource. For an experienced person, it will provide some details which you might have ignored.

Let's say **Hello World** to the Amazon AMIs.

## What is AMI?[¶](#what-is-ami "Permanent link")

You should understand by now, AMI stands for Amazon Machine Image.

What is an Amazon Machine Image, the answer depends on the Storage supported.

An AMI includes these things depending on the Storage supported

- Amazon Elastic Block Storage
  - It provides the snapshot. This snapshot will include the operating system, or any other application required.
- Instance Store Backed
  - It is a template, providing
    - Operating system
    - Application server
    - Application.

Amazon Elastic Block Storage and Instance Store, they both provide the same details.

You can extract the details of an AWS AMI, by the use of an API `describe-images`. To use this API, you might need the AMI Id.

In the previous post to create Free Tier AWS EC2 instance, see [Step by Step guide to create an EC2 instance,](https://www.archerimagine.com/articles/aws/aws-ec2-tutorial.html#step-1-choose-an-amazon-machine-image-ami) you used the Ubuntu AMI.

It has a unique identifier call AMI ID, as highlighted in the image below.

![AWS Made Easy | AWS EC2 | Ubuntu AMI ID](https://www.archerimagine.com/images/aws/ec2/02-AWS-AMI-Ubuntu.png "AWS Made Easy | AWS EC2 | Ubuntu AMI ID")

You will use the AWS CLI, to execute this command

```
aws ec2 describe-images --image-ids ami-0d758c1134823146a

```

The output is

```
{
    "Images": [
        {
            "Architecture": "x86_64",
            "CreationDate": "2021-02-24T18:24:50.000Z",
            "ImageId": "ami-0d758c1134823146a",
            "ImageLocation": "099720109477/ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-20210223",
            "ImageType": "machine",
            "Public": true,
            "OwnerId": "099720109477",
            "PlatformDetails": "Linux/UNIX",
            "UsageOperation": "RunInstances",
            "State": "available",
            "BlockDeviceMappings": [
                {
                    "DeviceName": "/dev/sda1",
                    "Ebs": {
                        "DeleteOnTermination": true,
                        "SnapshotId": "snap-072d11ffd95664698",
                        "VolumeSize": 8,
                        "VolumeType": "gp2",
                        "Encrypted": false
                    }
                },
                {
                    "DeviceName": "/dev/sdb",
                    "VirtualName": "ephemeral0"
                },
                {
                    "DeviceName": "/dev/sdc",
                    "VirtualName": "ephemeral1"
                }
            ],
            "Description": "Canonical, Ubuntu, 20.04 LTS, amd64 focal image build on 2021-02-23",
            "EnaSupport": true,
            "Hypervisor": "xen",
            "Name": "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-20210223",
            "RootDeviceName": "/dev/sda1",
            "RootDeviceType": "ebs",
            "SriovNetSupport": "simple",
            "VirtualizationType": "hvm"
        }
    ]
}

```

This tells me all about the AMI, which family the AMI belongs, What is the Virtualization type. It also tells what is the root device type.

The above information is also present in the below screen.

![AWS Made Easy | AWS EC2 | Ubuntu AMI ID details](https://www.archerimagine.com/images/aws/ec2/02-AWS-AMI-Ubuntu-AMI-Id.png "AWS Made Easy | AWS EC2 | Ubuntu AMI ID details")

As mentioned above, each AMIs has 3 information in itself, you will try to find these 3 information first.

- Is the above AMI an EBS backed or Instance Store.
  - `"RootDeviceType": "ebs",`
- _What is the operating system?_
  - `"PlatformDetails": "Linux/UNIX",`
  - `"Description": "Canonical, Ubuntu, 20.04 LTS, amd64 focal image build on 2021-02-23",`
- It will be created from this snapshot id `"SnapshotId": "snap-072d11ffd95664698",`
- There is no additional application server or any other application installed.

The above AMI is a bare bone Ubuntu Image.

If you want, you can install your own Web Server Apache2, or any other application and then create an AMI from it.

The next natural progression should be to explore _what is the use of AWS AMIs?_

## What is the use of AMIs?[¶](#what-is-the-use-of-amis "Permanent link")

If you observe the image below, you can understand 2 basic uses of the AMIs, _Can you please guess the 2 use you can think of?_

![AWS Made Easy | AWS EC2 | Use of AWS AMIs](https://www.archerimagine.com/images/aws/ec2/02-AWS-AMI-Use.png "AWS Made Easy | AWS EC2 | Use of AWS AMIs")

Before I can give you the answer to the above question, you should comprehend the above Image.

The first step is to create an EBS Snapshot, Once you have the EBS Snapshot, you should register the AMI.

These two steps are not required if you are choosing an existing AMI.

In Addition, the above image shows us the 3 use or life cycle of the AMI

- Launch
  - launches an AWS EC2 instance from AMI
- Copy
  - You can copy an existing AMI, for future use.
- De-register 
  - You can de-register the AMI if not used.

If you have guessed any two use from the above image, please pat your back.

Once you are clear with the life cycle / use of an AWS AMIs, you should proceed towards seeing the types of AMIs.

Region, Operating System, Architecture, and Storage can define the AMI's classification. Let's us discuss them.

## Types of AMI[¶](#types-of-ami "Permanent link")

### Region (see Regions and Zones)[¶](#region-see-regions-and-zones "Permanent link")

The region restricts the availability of a particular AMI.

If you check Ohio (us-east-2), the number of public AMIs are 69,431.

![AWS Made Easy | AWS EC2 | AWS AMI in us-east-2](https://www.archerimagine.com/images/aws/ec2/02-AWS-AMI-Region-us-east-2.png "AWS Made Easy | AWS EC2 | AWS AMI in us-east-2")

If you check for N.Virginia (us-east-1), the number of public AMIs are 140,650.

![AWS Made Easy | AWS EC2 | AWS AMI in us-east-1](https://www.archerimagine.com/images/aws/ec2/02-AWS-AMI-Region-us-east-1.png "AWS Made Easy | AWS EC2 | AWS AMI in us-east-1")

The above numbers can change in the future. The disparity between region for AMIs will still be present.

The AMI are region specific. You can create EC2 instance with the AMI present in that region.

If you want any other AMI from a different region you may have to copy those AMIs to your region.

### Operating System & Architecture[¶](#operating-system-architecture "Permanent link")

You have already seen, AMIs are available for both Linux and Windows. There are different variants for both the operating system.

You also have both 32-bit and 64-bit architecture support in these.

### Launch permissions[¶](#launch-permissions "Permanent link")

The AMI owner can specify the availability, by providing the launch permission. There are three types of launch permissions

- public - Anyone on AWS can launch using this AMI
- explicit - One account can grant explicit permission to another account.
- implicit - Owner of the AMI has implicit permission to launch.

You will learn about public, explicit and implicit AMIs once you reach a state of creating AMIs. Till that time being, you can read this article on the same, see [Share an AMI with specific AWS accounts.](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/sharingamis-explicit.html)

### Storage for the root device[¶](#storage-for-the-root-device "Permanent link")

The storage of the root device, creates two distinct classifications of AMI Types.

- Backed by AWS EBS
  - The root device would be an AWS Elastic Block Store
- Backed by AWS Instance Store.
  - The root device would be an instance store volume, created from a template.

| Property | AWS EBS | AWS Instance Store |
| --- | --- | --- |
| Boot time | less than 1 minute | less than 5 min |
| Size Limit | 16 TiB | 10 GB |
| Root device volume | EBS | Instance Store |
| Data Persistence | Root Volume data is deleted, Non root EBS is persisted | Data is persists only till life of the instance |
| Modification | Instance type, Kernel, Ram Disk, User data can be changed in stopped state | It is fixed. |
| Charges | Charged for instance use, EBS volume usage and Storing of AMI as EBS Snapshot | Instance usage and AMI storage on S3 |
| AMI Creation | Single command | requires installation and use of AMI tool |
| Stopped State | Can be in stopped state | Cannot be in stopped state. |

* * *

![AWS Made Easy | AWS EC2 | AWS EBS Vs Instance Store](https://www.archerimagine.com/images/aws/ec2/02-AWS-AMI-InfoG-EBS-Vs-Instance-Store.png "AWS Made Easy | AWS EC2 | AWS EBS Vs Instance Store")

You might have this question in mind, _Why should you use Instance Store, when EBS is better in all aspects?_

Instance Store is the option when you need low latency. Read and write are faster because host has the volume mounted. Check out the result published [here](https://gist.github.com/ktheory/3c3616fca42a3716346b).

Instance store is ephemeral. This makes them a perfect candidate for temporary data which changes very often.

## Linux AMI virtualization types[¶](#linux-ami-virtualization-types "Permanent link")

You might be thinking, _What is Virtualization after all?_

Virtualization is a type of abstraction. It allows many machines created from a single computer. It translates the virtual machine into the underlying hardware.

You might have used a Virtual Box to run Linux on your Windows PC, that is also a type of Virtualization.

Virtualization is at the heart for all AWS or any Cloud Provider. You will be running many different operating system on the same piece of hardware.

You might be thinking, _How can you run different operating system on the same piece of hardware?_

The answer is a technology called HyperVisor or Virtual Machine Monitor (VMM). It allows to host different virtual machine.

The different virtualization techniques used are

- Full Software Virtualization
- Hardware-assisted software virtualization or Hardware Virtual Machine (HVM)
- Paravirtualization or paravitualized Machine (PV)
- Hardware assisted software virtualization with Paravirtual drivers (PVHVM)
- Component or resource virtualization

![AWS Made Easy | AWS EC2 | Linux Virtualization Types](https://www.archerimagine.com/images/aws/ec2/02-AWS-AMI-InfoG-Linux-Virtualization-Types.png "AWS Made Easy | AWS EC2 | Linux Virtualization Types")

AWS supports two types of AMIs based on the virtualization techniques.

- Paravirtual (PV)
- Hardware virtual machine (HVM)

What are these Paravirtualization or Hardware Virtual Machine (HVM)? Come further the rabbit hole.

### Hardware virtual machine (HVM)[¶](#hardware-virtual-machine-hvm "Permanent link")

CPU Chips with built in virtualization can support Hardware virtual machine (HVM).

The Hardware virtual machine is a type of full software virtualization. It is dependent on the hardware capability. Hardware Virtual Machine (HVM) is the future.

### Paravirtualization[¶](#paravirtualization "Permanent link")

In this virtualization techniques, the guest OS uses the facilities provided by the host OS.

### PV and HVM AMIs[¶](#pv-and-hvm-amis "Permanent link")

Have you seen any Paravirtual (PV) or Hardware Virtual Machine (HVM) AMIs in AWS. Check the images below

HVM:-

![AWS Made Easy | AWS EC2 | Virtualization HVM](https://www.archerimagine.com/images/aws/ec2/02-AWS-AMI-Virtualization-HVM.png "AWS Made Easy | AWS EC2 | Virtualization HVM")

Paravirtual

![AWS Made Easy | AWS EC2 | Virtualization PV](https://www.archerimagine.com/images/aws/ec2/02-AWS-AMI-Virtualization-PV.png "AWS Made Easy | AWS EC2 | Virtualization PV")

You can see that Paravirtual is a thing of the past. It is only available in community AMIs and not present in the Quick Start AMIs.

You have only HVM's as an option in Quick Start AMIs.

### HVM Vs PV[¶](#hvm-vs-pv "Permanent link")

| Property | HVM | PV |
| --- | --- | --- |
| Description | HVM AMIs are presented with a fully Virtualized set of hardware and boot by executing the master boot record of the root block device of the image. | PV AMIs boot with a special boot loader called PV-GRUB, which starts the boot cycle and then chain loads the kernel specified in the menu. |
| Hardware extension | Yes, can take advantage | No, cannot take any advantage |
| Instance Type | All current generation | Only certain generation, like C1, C3, HS1, M1, M3, M2 and T1 |
| Region | All Region | Asia Pacific (Tokyo), Asia Pacific (Singapore), Asia Pacific (Sydney), Europe (Frankfurt), Europe (Ireland), South America (São Paulo), US East (N. Virginia), US West (N. California), and US West (Oregon) |
| How to find | Virtualization type of the AMI is set to hvm | virtualization type of the AMI is set to paravirtual, |

* * *

![AWS Made Easy | AWS EC2 | Difference between HVM and PV](https://www.archerimagine.com/images/aws/ec2/02-AWS-AMI-InfoG-HVM-VS-PV.png "AWS Made Easy | AWS EC2 | Difference between HVM and PV")

You have understood the difference between the virtualization techniques. Its time to move to understand _why would you pay for an AMI?_

## Shared and Paid AMIs[¶](#shared-and-paid-amis "Permanent link")

You can separate the AMIs based on the payment option.

As a Developers, you can share AMIs to the community, which you have created. Other developer's can pick these AMIs for modification. The Community AMIs are falling in this category.

Use of these shared AMIs in production environment without audit is a security risk.

The Paid AMIs are available from AWS Marketplace. It provides high quality licensed software configured in the AMIs. These are generally charged based on the hourly rate given by the owner.

You might be thinking, normal EC2 billing I can understand.

_How does a component of that EC2 charges money?_

Come with me to find..

## Billing[¶](#billing "Permanent link")

You have executed the `describe-images` command in [What is AMI?](#what-is-ami) section. In the JSON output you got this two details.

```
{
    "PlatformDetails": "Linux/UNIX",
    "UsageOperation": "RunInstances",
}

```

These two parameters define the billing of the AMI, and also compatibility.

When launching a spot instance, always check if the spot instance supports the particular `PlatformDetails`.

In case of Reserved Instance, you should check if the operating system platform lits the AMI `PlatformDetails`.

The `UsageOperation` tells the [lineitem/Operation](https://docs.aws.amazon.com/cur/latest/userguide/Lineitem-columns.html#Lineitem-details-O-Operation) in the actual billing of the AWS EC2 instance.

## Conclusion[¶](#conclusion "Permanent link")

Cloud Computing is possible today because of advancement in virtualization techniques. Hardware virtual machine (HVM) has a special role in this.

AMI (Amazon machine image) has further enhanced the options.. Many instances can use these AMIs to launch identical copies. AMIs are the blueprint. AMIs have a definite life cycle of creating, register, copy, launch and de-register. If you are not creating your own AMI, then you have only last three life cycle states.

AMIs are different based on the region, you are launching. It is different based on the architecture and operating system. It differs in the way different people have access to launch. It is differentiated based on the root device type.

AWS supports only HVM and PV virtualization techniques. Between these, AWS is recommending the HVM and in future you may not even have a PV AMI.

The billing of an EC2 instance includes AMI cost. `PlatformDetails` & `UsageOperation` field of the AMI contributes toward this cost.

Hope you are clear with the concept of AMI. If you want to launch an EC2 instance. Checkout, the free tier EC2 instance launch article. see [Step by Step guide to create an EC2 instance](https://www.archerimagine.com/articles/aws/aws-ec2-tutorial.html).

## Reference[¶](#reference "Permanent link")

- [AWS AMI Virtualization Types: HVM vs PV (Paravirtual VS Hardware VM)](https://cloudacademy.com/blog/aws-ami-hvm-vs-pv-paravirtual-amazon/)
- [AWS AMI- Amazon Machine Image.](https://medium.com/@kumargaurav1247/aws-ami-amazon-machine-image-3e0d53ae003b)
- [What are Amazon Machine Images (AMI)?](https://www.linkeit.com/blog/what-are-amazon-machine-images-ami)
- [Cost of storing AMI](https://stackoverflow.com/questions/18650697/cost-of-storing-ami)
- [EC2 EBS-SSD vs instance-store performance on an EBS-optimized m3.2xlarge](https://gist.github.com/ktheory/3c3616fca42a3716346b)
- [Deep Dive on New Amazon EC2 Instances and Virtualization Technologies](https://www.youtube.com/watch?v=R-n4dDGfQd4)
- [Overview of Virtualization Technologies](https://logicalread.com/virtualization-for-oracle-mc11/#.YImYz-vhVTY)