Introduction ( Snapshot in Amazon EC2 )
Table of Contents
What is EC2?
- Amazon Elastic Compute Cloud is a web service that provides secure, resizable compute capacity in the cloud.
- Amazon EC2’s simple web service interface allows you to obtain and configure capacity with minimal friction.
- It is designed to make web-scale cloud computing easier for developers.
- A snapshot in Amazon EC2 in easy steps explained in this post.
What is EC2 Instance?
- It is a virtual server in Amazon’s Elastic Compute Cloud (EC2) for running applications on the AWS infrastructure.
How to create an EC2 instance:
- We have to log in to the AWS root user.
- In AWS management console go to services.
Fig. services page.
- Click on EC2.
Fig. EC2 dashboard.
- In Resources click on Running Instance.
Fig. EC2 instance page.
- Click on Launch Instance.
Fig. Shows the AMI page.
- In this operating system, we have to choose one.
- There are free AMI’s which we can access freely.
- We have to choose free AMI’s to launch an instance.
- Choose Amazon Linux and click on Select.
- Select bits according to your computer configuration.
Fig. Choose the instance type.
- In this, we can see many types of storage capacity of an instance selected according to your needs.
- So select General purpose, t2.micro.
- Click on Next.
Fig. Configuration page.
Configuration Setup:
- We have to give a number of instances.
- Don’t give the purchasing options.
- Give Network it gives one default VPC.
- Select subnet means we have to select an Availability Zone.
- Enable public IP.
- Don’t give a Placement Group.
- Give shutdown behaviour as Terminate.
- The remaining all keep it up like that.
- Click on Next.
Fig. Storage page.
- We can add the storage to the system by clicking on Add New Volume.
- Click on Add new volume.
Fig. Adding volume page.
- Click on Next.
Fig. Add the Tags page.
- Give tags to the instance.
- Click on Next.
Fig. security group page.
- Create one security group or we can assign an existing security group.
- Give a name and description to the group.
- Select type SSH from different types that are present.
- If we want we can add rules.
- Click on Review and Launch.
Fig. Review page.
- Click on Launch.
Fig. keypair page.
- The key pair is used to run the LINUX instance.
- Create a new key pair and give the name to the key pair.
- Click on Download key pair.
- Click on Launch.
Fig. Status page.
- The instance has created.
- To check to go back to the instance page.
Fig. Instance page with launched EC2 machine.
Steps to Launch EC2 Machine
- Let’s run the EC2 machine in LINUX.
- The key pair which we have downloaded previously, we need to convert the file to the PPK file.
- Puttygen is used to convert the pem file to the PPK file.
- Download the putty app and install it.
Fig. putty download page.
- Download putty.exe.
- Run the application on your windows.
Fig. PUTTY app.
- For IP address go to the instance and copy the same IP address which you have created.
Fig. Instance page with Launched EC2 Machine.
- Paste this IP address at Host Name in putty.
Fig. paste IP address.
- Click on the SSH category appearing on the left side of the Putty.
- Then click on the Auth.
Fig. Auth page.
- Click on Browse to open the PPK file.
- Click on Open.
Fig. security alert.
- Click on Yes.
Fig. putty window.
- Give the ec2-user command to connect to ec2 instance, and press Enter.
Fig. shows we are connected to EC2 instance.
Attach Volume to EC2 instance:
- Go back to the EC2 dashboard.
- There you will find Elastic Block storage in that section we see the volume.
Fig. shows volume
- Click on volume.
Fig. the volume created page.
Fig. shows the volume page.
- Click on create Volume.
Fig. Create a volume page.
- The volume type will appear by default.
- Give the size to the volume to your need.
- The availability zone has to be chosen carefully because when we want to attach the volume to an instance, we have to select the same zone which we gave to the instance.
- Give snapshot id if u have or leave it.
- Give Tag to the volume.
- Click on create volume.
Fig. the volume created page.
- Click on close.
Fig. created a volume page.
Attach this volume to EC2 instance:
- Select the volume you have created.
- Click on Action.
Fig. Action option.
- Click on attach the volume.
Fig. shows attach volume page.
- Click on Attach.
- Let’s see whether it is attached or not.
- Go to the putty past IP address of an instance open putty window.
- The sudo su – this command used to login root IP.
- To check we use lsblk command.
Fig. In the putty window that volume has added.
Snapshot:
- One of the methods that AWS recommends for protecting EC2 instances is the creation of the snapshot.
- A snapshot is a copy of the storage blocks that have been modified since the previous snapshot was created.
To Create a Snapshot:
- Select the AWS console volume container.
- Right-click on the volume and choose the create snapshot option from the short-cut menu.
Fig. snapshot creation on the volume page.
- Click on create a snapshot.
Fig. snapshot page.
- Give a description of the snapshot.
- Click on create a snapshot.
Fig. snapshot created page.
- To check whether snapshot created or not go to snapshot and verify.
Fig. snapshot created.
Conclusion:
Hereby in Snapshot in Amazon EC2, we came to know how to create an EC2 instance, volume, and how to attach the volume to an EC2 instance. We have also seen how to create a snapshot of the volume that is attached to the EC2 instance.