DEV Community

Kamrul Hasan
Kamrul Hasan

Posted on

How to Create EC2 instance for Linux Machine in AWS and How to Access that Machine Through PuTTY.

How to Create EC2 instance for Linux Machine in AWS and How to Access that Machine Through PuTTY.

In this lab we will explore how to create linux ec2 instances in aws and how to access that machine through putty software and how to terminate the linux machine.

Step1: Go to your AWS Management Console and select a region where you want to create an instance of Windows machine.

Image description


Step 2: Now go to the search bar and type EC2 . Then you will find EC2 service and click on it.

Image description


Step 3: You will find EC2 Dashboard like this image and click on “Launch instance”. You can also create instances by clicking the “Instance (running)” option.

Image description


Step 4: Now you will find the Launch an instance page for filling up necessary information for creating a Linux instance. Follow the below instructions :

⇒ Provide the name of your Linux machine. Here I provided a name as “linux-ec2”.

Image description


⇒ Select your desired Linux machine. I selected Amazon Linux and I am using free tier eligible service.

Image description


⇒ Select your desired instance type. I selected t2.micro type which is free. You can also take other instance type by clicking “compare instance types”

Image description


⇒ Now you have to create a login key pair for login through PuTTY. Click on “Create new key pair”. And you will find a window.

Image description


⇒ Provide a key pair name, key pair type RSA and private key file format should .ppk **accessed through **PuTTY. By this key pair you can access your Linux machine through PuTTY. Now click on “Create key pair” and the key pair will be downloaded. The key pair must be saved in a secure place.

Image description


⇒ Now Setup your Network settings. Click on the “Edit” button to enable the edit option.

Image description


⇒ Now select a VPC . I selected a default VPC (Virtual Private Cloud). Then Select Subnet in your availability zone (or you can create a new subnet). Then Enable “Auto-assign public IP”. Now create a security group or you can use default security group or newly created security group by selecting existing security group option. I created a new security group. Provide a security group name and description as your purpose.

Image description


⇒ Now add inbound security group rules. Click on the “Add security group rule” button .

Image description


⇒ Now add Inbound Security Group Rules for public access. Add Rules for SSH (port: 22), HTTP(port: 80) and assign source type anywhere so that anyone can send requests and get responses from anywhere via Internet.

Image description


⇒ You can configure storage from this storage setting. And There is an Advanced details option for allowing advanced configuration. In this Lab we are not going to set up this advanced feature.

Image description


⇒ Now click on “Launch instance”. After that Linux ec2 instance will be created within a few seconds.

Image description


⇒ Now click on “View all instances”. After that will be redirected to the instances list page. Where your will find all instances.

Image description


⇒ Wait until the status 2/2 checks pass . It means your instance is ready to use.

Image description


Step 5: Select “linux-ec2” machine and Click on the right bottom upper sign icon for the details of the ec2 machine.

Image description


⇒ Now copy the public ip address for login with PuTTY.

Image description


                  **Access Through PuTTY**
Enter fullscreen mode Exit fullscreen mode

Step 6: Go to google and search putty download for windows. And go to www.putty.org then click on “Download PuTTY”.

Image description


⇒ Download the putty.exe file according to your computer configuration

Image description


⇒ Open putty.exe file by double click.

Image description


⇒ your will find this window as like as below image.

Image description


⇒ Click on +SSH tab

Image description


⇒ Then Click +Auth > Credentials. You will find your computer browsing option. Click on Browse.

Image description


⇒ Now upload your ec2 machine’s private key when you downloaded it at the time of creating an ec2 instance. Now Scroll up and find “Session” tab

Image description


⇒ Click on “Session” tab and put your ec2 machine’s public IP address (follow step 5 for getting public IP address) and click on “Open”.

Image description


⇒ Click on “Accept”.

Image description


Step 7: Now will find your ect2 instance Linux machine’s terminal. For login type: ec2-user and press enter.

Image description


⇒ Now you are eligible to access Linux ec2 instance of your AWS account

Image description


⇒ Create a text file for testing.
touch testfile
ls

Image description


               **Terminate This EC2 Machine**
Enter fullscreen mode Exit fullscreen mode

Step 8: Go to Instances list page and click on “Instance state” and click “Terminate instance”

Image description


⇒ Click on Terminate. The Linux ec2 instance machine will be terminated within a few seconds.

Image description


                  **Thank You and Pray for me**
Enter fullscreen mode Exit fullscreen mode

Related Keywords:
AWS EC2 instance creation for Linux;
How to create EC2 instance in AWS;
Linux EC2 instance setup on AWS;
Access AWS EC2 Linux instance with PuTTY;
Connecting to AWS EC2 Linux using PuTTY;
Step-by-step guide for AWS EC2 Linux setup PuTTY;
AWS EC2 SSH connection PuTTY tutorial;
AWS EC2 PuTTY private key setup;
Amazon Web Services EC2 Linux instance SSH access;
AWS EC2 Linux machine configuration for PuTTY access;

Kamrul devops; kamrul-hasan-devops; kamrul-hasan-aws-solution-architect; kamrul-devops; kamrul-cloud; kamrul-hasan-devops; kamrul-devops-engineer; devops-engineer; kamrul-hasan-devops-engineer;

Top comments (0)