LAB: Create AMI from EC2

LAB: Create AMI from EC2

LAB: Create AMI from EC2

Task :

In this lab we will learn how to create an AMI from EC2 instance and launch another instance from AMI itself.

Step1: Launch an EC2 instance

Go to AWS | Services | Click Compute | and EC2 Instance

Select the Amazon Linux 2 AMI

Choose Instance type: t2. micro and Click on next: Configure Instance Details

Configure Instance Details

  • Network: Select dclessons VPC
  • Subnet: Select Subnet of that particular VPC
  • Auto-assign Public IP: Enable

Under User Data: ( This Script create an HTML page served by an Apache httpd web server)


sudo su

yum update -y

yum install httpd -y

echo "Welcome to Dclessons" >> /var/www/html/index.html

systemctl start httpd

systemctl enable httpd

Click on Add Storage: No change | Click Next Add tag

Key : Name

Value: Dclessons-AMI | Click on Next: Configure Security Group

Configure Security groups: Select Create a new Security Group

Security group name: dclessons-SG | Description: Enter SSH Allow

Allow SSH and HTTP traffic with Source Anywhere (

Click on review and Launch

Review and launch: review all your setting and click on launch

Key pair: Select Proceed without a Keypair and check the Checkbox to ACK and | Click on Launch


Once EC2 Instance is running , use its public IP to browse

Step 2: Creating Ami from EC2 Instance

Select EC2 Instance | Action| Image & template | Create Image


    You are will be the first.


Please login here to comment.