Snapshot of AMI's in AWS

Create a replica for the EC2 instance.

Amazon Machine Image (AMI) is a pre-configured virtual machine image used to create an instance in Amazon Web Services (AWS).

It is a snapshot of the root file system of an EC2 instance, which includes the operating system, application server, and applications.

What is a snapshot: -

In the AWS snapshot is the duplicate copy or replica for any EC-2 Instance or volume.

Scenario-1: -

Suppose we work for one organization, and we have a team of 6 people to manage cloud operations. and each member is working in a different AWS region.

Out of six one is working in the Mumbai region and one is in the Singapore region.

Emp-A has worked in the Mumbai region and he is launching the Linux EC2 instance and installing software on it as per the project requirement, and the deployment is successful, and no issue with the application running.

Now, the same task has to perform on the Singapore region by Emp-B, if he launches the instance and does the same tasks on it, its take time and chances of getting error while running the application.

In such a scenario, the best practice is to use the configured AMI of the Mumbai region to run the same project in the Singapore region

Practical implementation

Suppose I have a Linux EC2 instance with an Apache server configured.

Go through the below link to configure the EC2 instance

https://hashnode.com/post/cley8ikzw000c09mmezhx4wxe

I created the Linux EC2 instance with an Apache web server in the Mumbai region

The test web page is also accessed from the browser

Here in the Mumbai region, everything is running properly now my requirement is to same instance and the configuration should be in the Singapore region also.

For that, I have to create AMIs of that instance which is in the Mumbai region.

Steps: -

  1. Go to EC2 Dashboard.

  2. Click on the instance.

  3. Go to action.

  4. Under action click on the image and templates.

  5. click on create an image.

  1. Give an image name and description for identification.

  2. Click on create image.

Verifying whether AMIs/replica is created or not

  1. Go to Services

  2. Click on Images

  3. Under Images, Click on AMIs

Note: - It takes some time to create AMIs depending on the root size of the instance

AMIs are created with only root volume where the OS and software are installed.

Copying AMIs from one region to another region

In our case, we transfer the AMIs from the Mumbai region to the Singapore region.

  1. Select the AMIs

  2. Go to the Actions

  3. Click on copy AMI

Choose destination region

As per our scenario, we choose the Singapore region and click on copy AMI

Verify on Destination region

Open a new tab with the same account and enter the Singapore region

Follow the step which is in the below image

Create the EC2 instance using this AMIs

Create the EC2 instance with the normal process the only difference is choosing the AMI from my AMIs section. which is like the below.

To get more about how to create the Linux instance go through the below link

https://hashnode.com/post/cleipnprn000n09l02dvp28xe

  1. Go to EC2 dashboard

  2. click on EC2 instance

  3. Launch EC2 instance

We are not doing any configuration here, all the configuration is done in the Mumbai region.

Once, instance is launched verify whether the Apache server is working?, by checking on the web browser

Note:- In Security group we have to allow HTTP traffic in inbound rule

Output on Web Browser

Conclusion: - Here we create the EC2 instance in another region with the help of AMIs also called snapshots or replicas.

Attention here

We use this AMIs or snapshot method on different scenario's also one of them like

Scenario 2: -

If we have to create 100 Servers with the same configuration for the same purpose.

In AWS we can create 100 servers at the same time but to configure all servers we have to do it manually.

In such cases, there is a 100% chance of getting an error due to human intervention.

To avoid such hectic work first we have to configure one EC2 instance by a skilled person. Once, all the configuration and testing are passed then using the same image we can create the number of EC2 instances. which will save lots of time and effort.

Kindly note here

Once all the practice is completed don't forget to

  1. Terminate the instance from both regions.

  2. Remove security group from both regions.

  3. Delete the security key from both regions.

  4. Delete the AMIs from both regions

    follow the below steps

And the last step is

Here we learned that how we reduce our workload with pre-defined AMIs

Thanks for reading my blogs!

Regards

Pawan Bhagat