Create AMI and Launch Amazon EC2 Instance from AMI in AWS

Share via:
Dear Readers,

In this article,we will see Create AMI and Launch Amazon EC2 Instance from AMI.

Implementation Steps

  1. Launch Instance.
  2. Connect to Linux Server through putty and Install updates,package “tree” and create files,directories.
  3. Create AMI (Amazon Machine Image).
  4. Launch Instance from AMI (Amazon Machine Image).

First, we need to AWS Console page by using below link.

https://aws.amazon.com/console/

Click on sign in to Console button.

Logging to aws account

Login using username & password and click on sign in.

Enter to AWS Management Console

We can see the AWS Management Console Dashboard.

Go to Services, under the compute module click EC2 service to open.

Launch Instance

Please check below link to Launch Linux Server.

Launch Linux Launch Linux Server

We can see Linux Server “My Linux” which was created earlier.

Connect to Linux Server through putty and Install updates,package “tree” and create files,directories.

Open Linux Server terminal,.

Open Linux Terminal

Switch to root user

Install Updates

Verify files in the current directory

Check the tree package installed or not

Make Directory “ktexperts”

Go inside Directory “ktexperts” and make a file “aws” then put some content

Install the package “tree”

Check the tree package installed or not

In this Server, we can see one directory “ktexperts” ,one file “aws”.

One package has been installed i.e,tree.

Create AMI (Amazon Machine Image)

Select your instance “My Linux”

Go to actions, click on Create Image under the Image.

Specify Name of the Image “Ktexperts – AMI (Mumbai) and click on Create Image.

One success message will be displayed. Click ‘Close’.

and click on Close.

View your AMI

Navigate to AMIs under IMAGES.

we can see the AMI “Ktexperts – AMI (Mumbai) has been created.

Note

When you create Image , Snapshot will also be created automatically.

Go Snapshots, we can see one snapshot created  by Created by Create Image.

View your Snapshot

Navigate to Snapshots under Elastic Block Storage.

We can see the created snapshot as shown below.

Launch Instance from AMI (Amazon Machine Image)

Go to Instances and click on Launch Instance.

Choose an Amazon Machine Image (AMI)

Select the Operating system of the EC2 instance by choosing any of the Amazon Machine Images (AMI). Select the Microsoft Amazon Linux AMI.

Choose an Instance type

Choose the Type of instance depending on your requirements.

Instance types comprise of varying combinations of CPU, memory, storage, and networking capacity.

select the default option of t2.micro – this instance type is covered within the free tier. Then click on Configure Instance Details.

Configure Instance Details

Configure EC2 instance details as per requirements of your environment and click on Add Storage.

Add Storage

Here, we can see root volume by default and size of 8GB.

Add a new volume if required.

Click on Add Tags.

Add Tags

Tags assist in easier identification and classification of the various instances in your AWS environment.

Click on click to add a Name tag to provide name for our server.

Provide the name for the Linux virtual machine for easier understanding and click on Configure Security Groups.

Configure Security Group

A security group allows configuring firewall rules to allow traffic as needed. Only one rule has been added to allow remote connection.

SSH Is enough to connect to our Linux virtual server and click on Review and Launch.

SSH – Secure Shell

Review Instance Launch

Review and confirm the configuration of the instance. Click on the Edit button on each configuration item to make changes and click on Launch.

 

Select an existing key pair a Key Pair and Launch Your Instance

To connect to your virtual machine, you need a key pair. A key pair is used to log into your instance and Select an existing security group and click on Review and Launch.

Click on Launch Instance  to start your Linux Server instance.

click on View Instances to view the instance you have just created and see its status.

We can see Linux Server which was created from AMI.

Connect to Linux Server through putty and verify  packages,files and directories.

Copy Public DNS of your instance.

Enter public DNS in putty and upload PPK file then terminal will be opened.

It will ask username, specify “ec2-user” .

Open Linux Server terminal.

Open Linux Terminal

Switch to root user

Verify files in current directory

Thank you for giving your valuable time to read the above information. Please click here to subscribe for further updates

KTEXPERTS is always active on below social media platforms.

Facebook : https://www.facebook.com/ktexperts/
LinkedIn : https://www.linkedin.com/company/ktexperts/
Twitter : https://twitter.com/ktexpertsadmin
YouTube : https://www.youtube.com/c/ktexperts
Instagram : https://www.instagram.com/knowledgesharingplatform

Share via:
Note: Please test scripts in Non Prod before trying in Production.
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

Add Comment