Friday, 13 December 2019

How to Copy AMI between Regions and Launch Instance From AMI in AWS (Amazon Web Services)

How to Copy AMI between Regions and Launch Instance From AMI in AWS (Amazon Web Services)

In this article,we will see Copy AMI between Regions and Launch Instance From AMI.
Implementation Steps
  1. View Instance (For already created Instance).
  2. Connect to Linux Server through putty and  verify packages,files and directories.
  3. Create AMI (Amazon Machine Image).
  4. Copy AMI to another Region (singapore).
  5. Go to singapore Region and view AMI and snapshot.
  6. Launch Instance from AMI.
  7. Connect to Linux Server through putty and  verify packages,files and directories.
First, we need to AWS Console page by using below link.
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.
I have already launched EC2 Instance.
View your Instance
Go to Instances,
We can see Linux Server “My Linux” which was created earlier.
Connect to Linux Server through putty and  verify packages,files and directories.
Open Linux Server terminal,.
Open Linux Terminal
Switch to root user
Verify files in current directory
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.
Copy AMI to Another Region
Navigate to AMIs under IMAGES.
Select your AMI, click on copy AMI in the Actions.
Select Destination region “Asia Pacific (Singapore) and click on copy AMI.
The AMI copy operation has been initiated.
You can see New AMI in the AMI Screen and click on done.
Go to singapore Region and view AMI and snapshot
Click on Asia Pacific (Singapore).
Navigate to AMIs under IMAGES.
we can see the AMI “Ktexperts – AMI (Mumbai) is  being created.
It will take come to complete.
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
Go to Instances, 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).
Go to My AMI’s,Select you created AMI “Ktexperts – AMI (Mumbai)”.
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.
Create a new security group “My Linux” and choose SSH and HTTP ports.
Click on Review and Launch.
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.
Create 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 Choose create a new key pair
Create a new key pair and name it My Linux. Then click on Download Key Pair.
After you have downloaded and saved your key pair, click on Launch Instance to start your Windows Server instance.
click on View Instances to view the instance you have just created and see its status.
We can the instance which was created.
Connect to Linux Instance through putty
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 Terminal
Open Linux Terminal
Switch to root user
Verify files in current directory