Open In App
Related Articles

Amazon Web Services – Creating an Amazon Machine Image(AMI)

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

In this tutorial, we’ll go through in great detail how to create an Amazon Machine Image on AWS. An operating system, programmes, and configuration settings are all part of an Amazon Machine Image (AMI), which is a template for software configuration. You must choose an AMI to act as the instance’s foundation when creating it in Amazon EC2. You can save time and guarantee consistency when launching numerous instances with the same configuration by building a custom AMI. A paused or operating Amazon EC2 instance can be used to build an Amazon Machine Image (AMI). If you’ve previously created an instance, proceed to the page where we started constructing an AMI; otherwise, carry on from here.

Steps To Create Amazon Machine Image(AMI)

Step 1: Access AWS Services by following Step 1 and logging in.

  • At the top left corner of your AWS account, click on the AWS Services tab and proceed to log in.
  • EC2 is what you need to click on if you’re looking for the Compute category.
AWS EC2 Instance

Step 2: Choose an AWS Region

Select the AWS Region in the top right corner of the EC2 dashboard to set up your EC2 server. Among numerous regions available across the globe, AWS enables you to opt one that best meets the needs of your apps with fast network response time and minimal downtime.

Select the Region

 

Step 3: Instance Launch

           1. On the EC2 dashboard, click the ‘Launch Instance’ button.
           2. The instance creation wizard will open, guiding you through the process of configuring your instance.

Launch Instance

 

Configure the instance details

 

Step 4: Choose an Amazon Machine Image (AMI)

Here we need to choose an AMI from the already available AMIs. Here we are choosing Amazon Linux Instance. You can select the appropriate AMI based on your application requirements. 

Select the AMI

 

Step 5: Choose EC2 Instance Types

Here I am selecting t2.micro(Free Tier Eligible) as the Instance type, you will select the type of instance that best suits your needs based on CPU, memory, and storage requirements.

Selec the Key pair

 

Step 6: Create and Download a Key Pair

Create a Key Pair if you don’t have one. Make sure to download the private key to use in future to launch an instance made using that key pair. Talking about key pair, it consists of a public key, which is stored on the instance, and a private key, which is used to securely connect to the instance.
   

Create a new key pair

 

Step 7: Configure Network Settings

In the network setting configuration, add number of Instances as 1, add the default VPC(or any other VPC if you have one) also the subnet connected to that vpc, then we will move on to create a security group which is the next step.

Configure the network

 

Step 8: Configure Security Groups

Specify the allowed protocols and IP addresses for the rules, whether it be by creating a new security group or utilizing an existing one. Our focus for the time being is on the default settings.

Firewall

 

Step 9: Add Storage

EBS volumes for your instances come in three types: General Purpose SSD, Magnetic, and Provisioned IOPS. They can be adjusted or added as necessary to suit your application’s IOPS requirements.

Comfigure storage

 

Step 10: Review and Launch Instance

Make sure to review the configuration settings and make any necessary adjustments before you launch your instance. Then, proceed by clicking “Launch” once you’re content with the setup or else you can also review commands.

launch instance

Creating an AMI from an Amazon EC2 Instance

You can create an Amazon Machine Image (AMI) from either a running or stopped Amazon EC2 instance. Here, we will outline the steps to create an AMI from an Amazon EC2 instance.

Step 1: Access the Amazon EC2 Instances View

First step towards creating an AMI is to navigate to the Amazon EC2 Instances console. Wondering how to go about it?
            1.Launching the AWS Management Console is where you should start.
            2.The next stop – the EC2 Dashboard, must not be missed.
            3.Navigating the instances in the instances view will lead you to the appropriate selection.

AWS Console

 

Step 2: Select the Instance for Your AMI

In the Amazon EC2 Instance­s view, you can locate the fundame­ntal instance for your AMI by using either the­ search box or                  filter options. Finding this instance is e­ssential for creating your AMI.Then choose Create Image from the context menu.

Select the Create Image

 

Step 3: Configure the Create Image Dialog Box

Give your new AMI a special name and description in the Create Image dialogue box. When you need to utilise the AMI later, this will make it easier for you to recognise it.By default, Amazon EC2 shuts down the instance, creates and registers the AMI, creates snapshots of any associated volumes, and reboots the instance. Choose the No reboot option if you don’t want your instance to be terminated during this  procedure.

Configure the Image details

 

Note :It is not assured that all file system changes will be included in the snapshot, hence selecting the No reboot option may  cause file system integrity problems with the produced image.To start the AMI creation process after configuring the options, click Create Image.

Create Image

 

Step 4: Monitor the AMI Creation Process

The process of creating an AMI could take a short while. Progress can be followed by:
          1. Using the AWS Explorer to access the AMIs view. Double-click the Amazon EC2 | AMIs node in the AWS Explorer to                            accomplish this.
          2. Select Owned By Me from the Viewing drop-down list in the AMIs view. All of the AMIs you have made will be seen in here.
          3. Look through the list for your just formed AMI.

Image summary

 

Step 5: Launch an Instance from Your New AMI

Once the­ Amazon Machine Image (AMI) is available, it can be­ used to launch new instances. Follow the­se steps to procee­d:   
One can acce­ss the Amazon EC2 dashboard by navigating to the AWS Manageme­nt Console. To view instances, simply  click on the­ “Instances” option located in the le­ft-hand menu. .
Then the use­r should click on the button labelled “Launch Instance­”. In this step, the­ user should select the­ My AMIs tab in order to access the list of the­ir previously created Amazon Machine­ Images (AMIs).The use­r needs to locate the­ newly created AMI and proce­ed by clicking on the Sele­ct button to use it as a foundation for  their new instance­.To launch the instance­, proceed with its launch process. Configure­ all necessary settings, such as type­, storage, security   groups and more as re­quired.

Launch instance

 

AMI

 

Launch the instance

 

Network settings

 

Instance launched

The Instance has been created successfully from your custom AMI.

Conclusion

When launching ne­w instances and deploying applications on the AWS cloud, cre­ating a custom Amazon Machine Image (AMI) can help simplify the­ process. Following the steps outline­d in this article will allow you to create an AMI customize­d with your desired software, se­ttings, and configurations, saving time and ensuring consistency. Manage­ your instances more easily with a custom AMI!
 



Last Updated : 22 Nov, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads