Overview
Lab details
- This lab walks you through the steps to create an AMI from an Amazon EC2 instance. You will practice using Amazon Machine Images to launch Amazon EC2 instances and will create an AMI of your EC2 Instance.
- Duration: 60 minutes
- AWS Region: US East (N. Virginia) us-east-1.
Introduction
What is AMI?
- AMI stands for Amazon Machine Image.
- It’s a master image for the creation of virtual servers, i.e., EC2 instances in the AWS environment.
- They are like templates that are configured with an operating system and other software, which determine the user’s operating environment.
- AMIs are categorized according to region, operating system, system architecture (32 or 64 bit), launch permissions and whether they are backed by Amazon EBS or by the Instance Store.
- AMI includes a template for the root volume required for an instance; a typical example might contain an operating system, an application server and applications.
- When you launch an instance, the root device volume contains the image used to boot the instance.
- In the initial stages, all AMIs were backed by the Amazon EC2 Instance Store. This means the root device for an instance launched from the AMI is an Instance Store volume created from a template stored in Amazon S3.
- Any data on the instance store volumes persists as-long-as the instance is running, i.e., the data gets deleted once the instance is terminated.
- Instance store backed instances do not support the Stop action.
- If using an instance store is required, Amazon recommends distributing the data across multiple Availability Zones.
- After the introduction of Amazon EBS, Amazon introduced AMIs that are backed by Amazon EBS i.e., the root device for an instance launched from the AMI is an Amazon EBS volume created from an EBS Snapshot.
- Amazon recommends using EBS backed AMIs, because they launch faster and use persistent storage.
- Amazon EBS backed instances can be stopped and later restarted without affecting data stored in the attached volumes.
- Permissions are controlled to constrain AMIs for instance launches to the appropriate AWS accounts.
- A block device mapping ensures that the correct volumes are attached to the launched instance.
- Users have the facility of selecting AMI provided by AWS, the user community, or through the AWS Marketplace.
- Users can also create their own AMIs and share them within the same region or across regions.
Architecture diagram

Task details
- Sign in to AWS Management Console
- Launching an EC2 Instance.
- Create a new AMI using the EC2 Instance.
- Checking the newly created with AMI.
- Launching the EC2 instance created with the created AMI and testing the AMI.
- Validation of the lab.
Launching the lab environment
- To launch the lab environment, Click on the Launch lab button.
- Please wait until the cloud environment is provisioned. It will take less than a minute to provision.
- Once the Lab is started, you will be provided with IAM username, Password, Access Key, and Secret Access Key.
You can only start one lab at any given time
Lab guide
Lab steps
Task 1: Sign in to AWS Management Console
- Click on the Open console button, and you will get redirected to AWS Console in a new browser tab.
-
On the AWS sign-in page,
- Leave the Account ID as default. Never edit/remove the 12-digit Account ID present in the AWS Console. Otherwise, you cannot proceed with the lab.
- Now copy your Username and Password in the Lab Console to the IAM Username and Password in AWS Console and click on the Sign-in button.
- Once Signed In to the AWS Management Console, make the default AWS Region as US East (N. Virginia) us-east-1.
If you face any issues, please go through FAQs and Troubleshooting.
Task 2: Launching an EC2 Instance
- Make sure you are in the US East (N. Virginia) us-east-1 Region.
- Navigate to Services menu in the top, then click on the EC2 in the Compute section.
- Navigate to Instances on the left panel and click on Launch instances button.

- Name : Enter MyEC2Server

- For Amazon Machine Image (AMI): Search for Amazon Linux 2023 kernel AMI in the Quick Start menu
- For Instance Type: Select t2.micro


-
For Key pair: Select Create a new key pair Button
- Key pair name: Enter WhizKey
- Key pair type: Select RSA
- Private key file format: Select .pem
- Select Create key pair Button.
- In Network Settings, Click on Edit:
- Auto-assign public IP: Enable
- Select Create new Security group
- Security group name : Enter MyEC2Server_SG
- Description : Enter Security Group to allow traffic to EC2

-
To add SSH:
- Choose Type: SSH
- Source: Anywhere
-
For HTTP:
- Click on Add security group rule
- Choose Type: HTTP
- Source: Anywhere

-
Click on Advanced Details Under the User data section, enter the following script (which creates an HTML page served by an Apache httpd web server).
- Keep rest thing Default and Click on Launch Instance Button.
- Select View all Instances to View the Instance you Created
- Launch Status: Your instance is now launching, Navigate to Instances page from the left menu and wait until the status of the EC2 Instance changes to running

- Note down the sample IPv4 Public IP Address of the EC2 instance.

- Enter http://your IP address

If the Public IP of the instance is not opening any page, Make sure URL Protocol is http not https. Please wait until the status check of the instance is transitioned from initializing to 2/2 checks passed. This may take up to 5 minutes. If still the page does not load, make sure to check the Security group’s inbound rule and see if the entry for HTTP exists or not.
Task 3: Creating an AMI from the EC2 Instance
In this task, we are going to create an AMI from the running EC2 instance created in the previous task. It demonstrates the process of capturing the configuration and contents of an existing instance into a reusable image.- Select the MyEC2Server. Click on Actions.
- Under Image and templates, click on Create Image.

-
In the pop-up window, enter the following details:
- Image Name : Enter MyEC2Image
- Image Description : Enter My EC2 Image
- Leave other details as default.
- Click on Create image button.
Task 4: Check the newly created AMI
- Navigate to AMI’s under Images on the left menu.
- You can see that the image is getting generated and status is pending.

- Once the process is completed, the status will change to available.

- Now we can use this Image AMI to create brand new instances.
Task 5: Launching the EC2 Instance with the Created AMI and Testing the AMI
- Select the AMI and click on Launch instance from AMI

- Name : Enter MyEC2AMIServer

- For Instance Type: select t2.micro

- For Key pair: Select the key you created previously.
-
In Network Settings :
- Auto-assign public IP: Enable
- Select Select existing security group created earlier.
- Keep rest thing Default and Click on Launch Instance Button.
- Select View all Instances to View the Instance you Created
- Launch Status: Your instances are now launching, Navigate to Instances page from left menu and wait the status of the EC2 Instance changes to running
- Navigate to the instances menu and copy the IPv4 Public IP address of the created EC2 instance.
- Enter the IP Address in the Browser.

- You will be able to see the HTML page displaying the message Welcome to Whizlabs. This shows that the data in the new instance is the same as the one in the first instance we created.
Task 6: Validation Test
- Once the lab steps are completed, please click on the Check my work button on the right side panel.
- This will validate the resources in the AWS account and displays whether you have completed this lab successfully or not.
-
Sample output :

Completion and conclusion
- You have successfully created an EC2 instance.
- You have successfully created an image directly from that EC2 instance.
End lab
- Sign out of AWS Account.
- You have successfully completed the lab.
- Once you have completed the steps, click on End lab in the IP Lab Portal.
What gets checked
When you press Check my work, the platform verifies each of these:- Launch an EC2 Instance — Check whether an EC2 Instance is launched or not.
- Validate EC2 Instance Type t2.micro — Check whether the EC2 instance type is t2.micro.
- Launch EC2 AMI type Amazon Linux — Check whether the EC2 instance is launched using an Amazon AMI.
- Create an EC2 instance AMI — Check whether the AMI is created from EC2 or not