What is Amazon Machine Image (AMI)?
An Amazon Machine Image is a base image that is used to create virtual servers (instances) in the cloud. It contains the information needed to launch an instance such as operation system, any installed software packages that are required to set up and boot an instance.
AMI is specific to -
Region
AMIs are region-specific, meaning an AMI created in one region (like ap-south-1)
can’t be directly used in another region without copying it. Each region has its own set of AMIs.Operation System
AMIs define the operating system, such as Linux, Windows, etc. The operating system becomes the base environment for the instance.
Processor Architecture
The AMIs are compatible with specific type of architecture x86 (32-bit), x86_64 (64-bit) or ARM (for Graviton processors). Selecting the right processor impacts the performance and costing for the instance.
Launch Permissions
AMIs can have permissions set to make them private or shared. Launch permissions control who can use the AMI to launch the instances, enabling you to share an AMI within organisation or with the public.
Root Device Type
AMIs have root device type that define how the storage is handled. There are two types:
Instance Store
Temporary storage directly attached to an instance, which gets lost once instance is stopped or terminated.
Elastic Block Storage
Persistent storage that survives instance reboots or shutdowns, ideal for data that needs to be retained.
Virtualization Types
Amazon EC2 supports two types of virtualization:
Paravirtual (PV): Offers better performance for some workloads but requires specific operating systems.
Hardware Virtual Machine (HVM): Full virtualization, supporting enhanced networking and GPU capabilities.
AMI Lifecycle
The lifecycle of an AMI involves four stages -
Creation
You create an AMI by taking the snapshot of an existing EC2 instance or from another AMI. During creation, configurations like operating system, data, and other required softwares/packages are saved in AMI.
Registration
After creating an AMI, it’s registered with AWS and given an AMI ID, which is required to launch instances.
Launch
Using the AMI ID, instances can be launched as needed, with each instance operating as an independent server.
De-Registration
When an AMI is no longer required, it can be de-registered. De-registration doesn’t delete the actual data but prevents new instances from being launched using the AMI.
Shared AMIs
A shared AMI is an AMI that has been made available to other AWS accounts. Shared AMIs are commonly used for collaboration, public application distribution, or multi-account setups. There are two types of shared AMIs:
Public AMIs: These are available to all AWS users and can be freely used or customized. Be cautious when using public AMIs, as security or software configurations might not be up to your standards.
Private/Explicitly Shared AMIs: These are restricted to specific AWS accounts. They are more secure, as they are only accessible by designated users.
Best Practices with AMIs
Regular Backups: Use AMIs to create backup snapshots of your EC2 instances for easy restoration.
Region Replication: If your application operates across multiple regions, copy AMIs to the required regions to improve availability and reduce latency.
Security: Be cautious with shared AMIs, especially public ones, and conduct security audits if they are from unknown sources.
Automation: Automate the creation of AMIs for environments that need frequent updates, enabling version control and smooth rollbacks.
That’s it for this blog!!

