image.png

An AMI is a pre-configured template used to launch EC2 instances. It packages together the operating system, installed software, configuration settings, and EBS volume snapshots into a single reusable image.

Instead of setting up a fresh server every time, you create an AMI once and use it to launch as many identical instances as you need — instantly.

Think of it like a cookie cutter. You make the perfect cookie once, then use the cutter to stamp out hundreds of identical ones.


Why Use AMI?

Without AMI:

Launch new EC2
    |
Install Java         (30 min)
Install database     (20 min)
Configure settings   (15 min)
Install monitoring   (10 min)
    |
= 75 minutes per server

Need 10 servers = 12+ hours of setup work

With AMI:

Do the setup once on one instance
    |
Create AMI
    |
Launch 10 EC2 instances from that AMI
    |
= All 10 ready in minutes, identical setup

Types of AMI

Type Created By Cost
Public AMI AWS Free (e.g. Amazon Linux, Ubuntu)
Your own AMI You Free to create and use
Marketplace AMI Third-party vendors Free or paid

How to Create an AMI

1. Launch an EC2 instance
2. Install your software and configure settings
3. Stop the instance
4. Go to: Actions → Image and Templates → Create Image
5. AMI is created

Why stop the instance first? Stopping ensures all data is flushed to disk before the snapshot is taken. This gives you a clean, consistent image. You can create an AMI from a running instance, but stopping it first is the safer approach.


How AMI Works Across Zones and Regions

EC2 in Zone A  →  Create AMI  →  Launch EC2 in Zone B or another Region
(customized)       (stored)        (identical setup)

AMIs are region-specific by default. If you want to use an AMI in a different region, you need to copy it there first. Once copied, you can launch instances from it in that region.

When an AMI is created, AWS automatically takes EBS snapshots of the attached volumes. These snapshots are what gets used when you launch a new instance from the AMI.