What is AMI in AWS, How to create EC2 instance using AMI

1. What is AMI in AWS?

Amazon Machine Image (AMI) is a crucial component of Amazon Web Services (AWS) that enables users to create, launch, and deploy virtual machines, known as EC2 instances, in a scalable and efficient manner. An AMI serves as a template, encapsulating the operating system, applications, data, and configurations necessary to instantiate and run virtual instances.

2. How to create Amazon Machine Image(AMI)?

In this, we will go over how to create an Amazon Machine Image (hereafter “AMI”) from a previously created Instance using the AWS console.

Once the instance is fully configured, You can stop the instance to ensure data consistency during the AMI creation process or create AMI during the Running instance also here I am creating AMI uring the Running instance.

To create an AMI image, select EC2 -> Go to action TAb -> Select the instance you want to create an image of -> right-click -> Image and Templates -> Create Image.

Give any name and create image, We can create AMI in same region or in Different Region also, Here I am Creating an AMI in another region and EC2 using the same AMI.

GO to to AMI sectiom sellect your AMI, go to Action Tab and Copy AMI.

Select Destination Region, Here I am selecting Europe (London).

3. Launching our Instance from our AMI image

Now Go to the AMIs section, click on My AMIs and you will see the AMI that you Coppied from another region an image of.

I’m going to a create new key pair and set RDP and allow traffic from HTTP and HTTPS, Once all these are configured, we can click on Launch Instance.

Note: But we can connect EC2 through RDP using an old key(which is used in main ec2 instance meance from where AMI created/coppied).

Now EC2 Unstance created through AMI :

Test the AMI:

Here We will now go back to AWS console for EC2 and to grab the public ip address from the new instance to see, we can access our webserver which is created previously.

Here we can see same configuration, file and folder in new instance which is created by AMI.

Conclusion:

Creating an AWS AMI for Windows Server is a straight forward process that involves launching a Windows Server instance, customizing it to meet your requirements, sysprepping it, and then creating an image of the instance as an AMI.

AMIs enable you to maintain consistency across your infrastructure, making it easier to scale and deploy new instances with your desired configurations.

Thanks for reading this post.