Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

Cloud Computing Lab Date : 28-04-2022

IV/IV B.Tech CSE 2


Roll.no: 198W1A05B1

TASK 6 – Launching an EC2 Instance using Amazon Web Services

AIM :

Using account in Amazon AWS, create a virtual machine, connect and work with it.

PROCEDURE :

Step 1: Enter the EC2 Dashboard

a. Open AWS management console in a new browser


https://aws.amazon.com/
b. Find EC2 under Compute and click to open the Amazon EC2 Console.

Step 2: Create and Configure Your Virtual Machine

a. You are now in the Amazon EC2 console. Click Launch Instance

b. With Amazon EC2, you can specify the software and specifications of the instance you
want to use. In this screen, you are shown options to choose an Amazon Machine
Image(AMI), which is a template that contains the software configuration required to launch
your instance.

For this tutorial, find Amazon Linux AMI 2018.03.0 and Click Select.

The dashboard looks as follows :

VR SIDDHARTHA ENGINEERING COLLEGE Page. No: 1


Cloud Computing Lab Date : 28-04-2022
IV/IV B.Tech CSE 2
Roll.no: 198W1A05B1

c. You will now choose an instance type. Instance types comprise of varying combinations of
CPU, memory, storage and networking capacity so you can choose the appropriate mix for
your applications. For more information, see Amazon EC2 Instance Types.

For this tutorial, select the default option of t2.micro-this instance type is covered within the
free tier. Click Review and Launch at the bottom of the page.

You can review the options that are selected for your instance which include AMI
Details, Instance Type, Instance details, Storage, and Tags. You can leave these at the
defaults and move next and launch.
Step 3: Create a security group

AWS security groups (SGs) are associated with EC2 instances and provide security at the protocol
and port access level. Each security group –  working much the same way as a firewall – contains a
set of rules that filter traffic coming into and out of an EC2 instance.

VR SIDDHARTHA ENGINEERING COLLEGE Page. No: 2


Cloud Computing Lab Date : 28-04-2022
IV/IV B.Tech CSE 2
Roll.no: 198W1A05B1

Each security group must have a name, allowing you to easily identify it from account menus. It’s
always a good idea to choose a descriptive name that will quickly tell you this group’s purpose. In
fact, you would be well served to define and use a consistent convention for naming all objects in
your AWS account.

Security groups exist within individual VPCs. When you create a new group, make sure that it’s in
the same VPC as the resources it’s meant to protect.

Step 4: 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 (just like your house key is used to enter your home).
a. In the popover, select Create a new key pair and name it Demo. Then click Download Key
Pair. Demo.pem will be downloaded to your computer—make sure to save this key pair in a
safe location on your computer.
 Windows Users: We recommend saving key pair in your user directory in a sub dir-
ectory called .ssh (ex.C:\use5r\{yourusername}\.ssh\Demo.pem).
 Mac/Linux users: We recommended saving your key pair in the .ssh sub-directory
from your home directory(ex.~/.ssh/Demo.pem).
 Note: If you don’t remember where you store your SSH private key (the file you are
downloading), you won’t be able to connect to your virtual machine.

VR SIDDHARTHA ENGINEERING COLLEGE Page. No: 3


Cloud Computing Lab Date : 28-04-2022
IV/IV B.Tech CSE 2
Roll.no: 198W1A05B1

b. After you have downloaded and saved your key pair, click Launch Instance to start your
Amazon Linux AMI server instance.

Note: It can take a few minutes to launch your instance.

c. On the next screen, click View instance to view the instance you have just created and see its
status. The screen looks as follow after launching the instance.

After clicking at the instance we can see the Instance state as Pending , After some time the state
changes to Running state where we can start connecting our instance using Putty .

VR SIDDHARTHA ENGINEERING COLLEGE Page. No: 4


Cloud Computing Lab Date : 28-04-2022
IV/IV B.Tech CSE 2
Roll.no: 198W1A05B1

Before connecting to Putty first we need to convert .pem file into .ppk file using the below process
Open Putttygen - > Click File - > Click Load private key which is as follows:

After loading the file it looks as follows. After loading click on Save Private Key.

VR SIDDHARTHA ENGINEERING COLLEGE Page. No: 5


Cloud Computing Lab Date : 28-04-2022
IV/IV B.Tech CSE 2
Roll.no: 198W1A05B1

Step 5: Connect to Your Instance

After launching your instance, it’s time to connect to it using an SSH client using putty.

a. In order to connect to your Amazon virtual machine instance, you will need to use Host
name or public IP of the current running Instance. You can find the public IP of the running
instance in the description section of AWS Console.

VR SIDDHARTHA ENGINEERING COLLEGE Page. No: 6


Cloud Computing Lab Date : 28-04-2022
IV/IV B.Tech CSE 2
Roll.no: 198W1A05B1

Step 7:Connect to your Instance.


. Now inorder to connect to Amazon Linux AMI Server we need to proceed to putty’s
connection option -> SSH -> auth. Now we need to specify the path of Private Key file(i.e.,
Demo.ppk file) for Authentication.

VR SIDDHARTHA ENGINEERING COLLEGE Page. No: 7


Cloud Computing Lab Date : 28-04-2022
IV/IV B.Tech CSE 2
Roll.no: 198W1A05B1

We need to give the username the default user name to connect to Amazon Linux AMI Server is
login as : ec2 -user

VR SIDDHARTHA ENGINEERING COLLEGE Page. No: 8


Cloud Computing Lab Date : 28-04-2022
IV/IV B.Tech CSE 2
Roll.no: 198W1A05B1

Step 8: Working with a Current Instance

 Here we are trying to make use of the virtual machine instance that is created on AWS
 For our for our experiment we are creating a simple web server on ec2 instance and
dumping simple HTML files into that

VR SIDDHARTHA ENGINEERING COLLEGE Page. No: 9


Cloud Computing Lab Date : 28-04-2022
IV/IV B.Tech CSE 2
Roll.no: 198W1A05B1

 Inorder to create the web server the commands required are:

sudo su is to convert the permission to root.


yum install –y httpd for webserver creation.
chkconfig httpd on to check whether the service is on or not.
service httpd start to check if server is on then start the server.

 Now create simple HTML file called index.HTML using simple nano text editor in the
directory /var/www /html/

Now change the directory to html and verify.


cd /var/www/html – change the directory
ls – to list the files.

Step 9 : Viewing the output on a www

Inorder to check the output, open a web browser and type the specified URL: public dns of the
launched instance has to be copied from AWS Console and paste it as URL.

The output is as follows :

Step 10: Terminate Your Amazon Linux VM

You can easily terminate the Linux Server VM from the Amazon EC2 console. In fact, it is a best
practice to terminate instances you are no longer using so you don’t keep getting charged for them
a. Back on EC2 Console, select the box next to the instance you created. Then click the Action
button, navigate to Instance State, and click Terminate.
b. You will be asked to confirm your termination- select Yes, Terminate.
Note: This process can take several seconds to complete. Once your instance has been
terminated, the Instance State will change to terminated on your EC2 Console.

VR SIDDHARTHA ENGINEERING COLLEGE Page. No: 10


Cloud Computing Lab Date : 28-04-2022
IV/IV B.Tech CSE 2
Roll.no: 198W1A05B1

RESULT : You have successfully created, configured, and connected to your first Amazon Linux
Virtual Machine in the cloud with Amazon EC2.

VR SIDDHARTHA ENGINEERING COLLEGE Page. No: 11

You might also like