AMI fullform Amazon Machine Images. An AMI contains the software configuration (for example, an operating system, an application server, and applications) required for the creation of EC2 instances. When you launch an instance, you must specify an AMI. in simple way we can treat it as OS(Operating system) or
OS with required setup.
+ You find the AMI Selection option, While you creating an AWS EC2 instance , in the step 2 : Application and OS Images (Amazon Machine Image)
Generally AMI are basically classified in AWS as :
|
Name |
Info |
Total Available (11-2022) |
1 |
Quickstart AMIs |
by AWS/AWS Provided |
46 |
2 |
My AMIs |
Created by AWS User |
– |
3 |
AWS Marketplace AMIs |
AWS & trusted third-party AMIs |
6527 |
4 |
Community AMIs |
Published by anyone |
500+ |
More Information Links: [1] Amazon Machine Images (AMI) – Official AWS documentation |
+ AMIs are categorized by the storage for the root device of an instance launched from the AMI, as follows:
- EBS-backed AMI : The instance’s root device is an EBS volume created from an EBS snapshot.
(credits : https://docs.aws.amazon.com/)
You can restore/reuse EBS-backed AMI, in this circumstances :
- Stop and then start again.
- snapshot all relevant volumes and create a new AMI.
- Attach the volume to the new instance
EBS : Amazon Elastic Block Store (Amazon EBS) is an easy-to-use, scalable, high-performance block-storage service designed for Amazon Elastic Compute Cloud |
- Instance store-backed AMI : The instance’s root device is an instance store volume created from a template stored in S3.
(credits : https://docs.aws.amazon.com/)
The data in an instance store persists only during the lifetime of its associated instance. If an instance reboots (intentionally or unintentionally), data in the instance store persists. However, data in the instance store is lost under any of the following circumstances:
- The underlying disk drive fails
- The instance stops
- The instance hibernates
- The instance terminates
More Info : Amazon EC2 instance root device volume |
What is the need ?
- In Real Time scenario, When we need multiple applications and tools are required in a new instance, you can use bootstrap script/commands(new ami console calling it as User data) to preinstall in instance to save time.
- But based the requirement/commands/applications/softwares we mentioning in the user data , it increases the booting time, so it’s not a suitable way for autoscaling, instant instance creation,
- To overcome this,We can Create Customized AMI with OS, with required Softwares/Files/Tools and save , use it whenever you need to launch an instance.
- Creating an Customized image called has Hardening an Image
More Info : AWS AMI Bootstrap Script/Run Commands/User data at launch |