Updated: Jul 22, 2021
Provision a Linux instance & connect using SSH
Note: This document is for connecting to Linux instance using windows machine only.
Objective: Learn to launch Amazon EC2 Linux instance & connect using SSH client.
Step 1: Log in to the AWS management console. Find for ec2 service in the search bar provided on the page. Navigate to the Key Pairs options in the left navigation bar and then click on Create Key Pair button on top right corner.
Step 2: Create Key Pair in ppk format (this key is only to be used while connecting from windows machine to Linux server).
Provide the name for the key pair.
Select file format type as ppk.
Click on the Create Key Pair button on bottom right.
Step 3: Click on Instances option in left navigation pane so as to be directed to following page.
Click on Launch Instance button on top left.
Step 4: After clicking on the launch instance you will be redirected to this page. Here search/select Amazon Linux 2 AMI.
Step 5: Choose an Instance Type over here.
Select General purpose type t2.micro Instance Type.
Click on Next: Configure Instance Details at the bottom right of the screen.
Step 6: Here you will Configure Instance Details.
In the Subnet field select on the drop down list and select any one of the Subnets.
In the Auto-assign Public IP field select on the drop down list and select Enable option.
Click Next : Add Storage at bottom right of screen.
Step 7: Add Storage
In this step keep all the default settings as they are and click on the Next : Add Tags button at the bottom right of the screen.
Step 8: Add Tags
Click on the Next : Configure Security Group at the bottom right of the screen.
Step 9: Configure Security Group
Create a new security group and name it as LinuxSG
In the description enter the following text: Security Groups for Linux Servers
Keep the default SSH rule.
Warning: Rules with source of 0.0.0.0/0 allow all IP addresses to access your instance. We recommend setting security group rules to allow access from known IP addresses only.
While using this feature for production make sure the known IP address is entered.
Click on Review and Launch button on the bottom right corner
Step 10: Review Instance Launch
Here are all the details regarding your instance. Read them once and check if all the configurations are correct
Click on the Launch button at the bottom right corner. This will launch your instance
After you click the Launch button here you will be asked to select/create KEY-PAIR.
Choose an existing key pair option from the drop down. Then select the key pair that we created in step 2 above.
Acknowledge the key pair and launch the instance.
CONGRATULATIONS!! Now your instance is getting launched. Scroll down the page and click View Instance button at bottom right of the screen to see your launched instance
You will be redirected to the page below
Copy the public IP address of the running instance in the clipboard.
Step 11: In order to connect to Linux server from windows machine you will need Putty utility. In case you do not have Putty download from here.
Run Putty utility from command prompt.
In the Host-name field type ec2-user@public IP address (copied above in the clipboard of the above launched instance).
Copy the entire host name and paste it in Saved Sessions. Then save the session.
On the left navigation pane expand SSH and select Auth. On the right side of the Putty screen click on Browse button and browse to the ppk file we downloaded in step 2.
Step 12: Before you are connected to the instance you will see a following pop-up.
Select Yes button in the pop-up window to connect to the instance.
You should see a similar window as per below screenshot.
Step 13: If you no longer need this instance make sure to terminate the instance
Click on drop-down menu besides Actions button
Select the Instance State and click on Terminate
This will terminate your instance
Was this document helpful? How can we make this document better. Please provide your insights. You can download PDF version for reference.
For your aws certification needs or for aws learning contact us.