Introduction
Table of Contents
AWS we can create Public EC2 Machine and Private EC2 Machine. Therefore, we have to create two subnets one Public Subnet and other Private Subnet. In these tutorials, two EC2 machines get launched in each subnet. Public EC2 machine gets launched in Public Subnet and Private EC2 machine get launched in Private Subnet.
However, to access the Private EC2 machine we will use AWS ssh Key Management to Login to Private EC2 machine.
How to create an EC2 Instance?
- First, we have to login to “AWS Root User”. The AWS Management Console will open.
- In AWS Management Console go to “Services”.
- There click on “EC2”.




- Dashboard right side we see Events, Tags, Reports, Limits, Instance, Images, EBS (Elastic Block Storage), etc.
- In the middle of the dashboard, we see Resources.
- Now click on “Running Instance”.


- Click on Launch “Instance”.

- Here we see AMIs it contains the software configuration system to launch instance.
- In this operating system we have to choose one.
- There are some free AMIs which we can access freely.
- We have to choose free AMIs to launch instance.
- Choose “Amazon Linux”, and click on “Select”.
- Select bits according to your computer configuration.

- Here we see various instance types these are virtual services that can run applications.
- There are families like General purpose, Compute-optimized, GPU instance, Memory-optimized (to see these families, scroll down).
- Many Types like t2. micro, t2.micro, t2.small, t2.medum, etc. these all define the storage capacity of an instance selected which according to your needs.
- But except t2.micro remaining all instance types will be charged.
- So, select “General purpose, t2. micro”.
- Then click on “Next”.


Rest All Settings Keep as Follows
- We have to give “Number of instances” we want according your needs (as per now give one instance).
- Don’t give purchasing option. (if we give, we have to purchase)
- Give networking VPC you have created Give VPC.
- Select subnet you have created first select the public subnet.
- “Enable” Public IP.
- Don’t give Placement group.
- Give Shutdown Behavior as “Terminate” (because when we shutdown the instance it will run in background, so for this we have to give terminate option).
- Remaining all keep it as it is.
- Click on “Next”.

- Root it is like an C drive in our computer.
- We can give any storage size.
- IPOS (Input output service) it will increase according to the storage size.
- We can add the storage to the system by clicking on “Add New Volume”. (like we are adding drives to the computer)

- Click on “Next”.

- Give tags to the Instance.
- Click on “Next”.

- Select the security group that existing, select both Default and created security group

- Here we can see the details which we given.
- Click on “Lunch”.

Key Pair Setup
- The Key pair which is used to run the Linux instance.
- Amazon EC2 uses public key cryptography to encrypt and decrypt login information.
- Create new key pair and give the name to key pair.
- Click on “Download key pair”. download the key pair file to login to instance.
- Now “Lunch”.

- The instance has crated.
- To see that go back to the instance page.

EC2 Dashboard
- We can see that instance ID, IP address, ect.
- Let’s run the EC2 machine in Linux.
- In order to use the key-pair which we have downloaded previously, we need to convert the pem file to ppk file. Puttygen is used to convert the pem file to ppk file.
- Like this create another EC2 instance for private.
- But there are some Changes has to be done.
- Go to EC2 instance and click on Launch Instance.
- Select AMI as same.
- Now select he same Instance.
- But in the configuration in select created VPC.
- In subnet select Private subnet you have created and disable the Auto-assign Public IP.

Remaining all settings are same and Launch instance

- We see that that there is no public IP address only private IP address.
How to login to the Private EC2 instance?
- First, we have to login to the Public instance by using putty.
- Now open PUTTY.

- Now copy the IP address and past it in the putty

- Paste this IP address at “Host Name” in Putty

- Click on the “SSH category” appearing on the left side of the Putty.
- Then click on the “Auth”.

- Click on the “Browse” to open the ppk file.
- Now on “Open”.

- Click on “Yes”.

- Give “ec2-user” command to connect to ec2 instance, and press “Enter”.

SSH to Private EC2 machine
By giving the command ssh ec2-user@10.0.2.42.





Conclusion
Therefore, AWS SSH Key Management helps to get access to EC2 machine. EC2 machine which creates in Private Subnet needs an additional setup to login. AWS ssh Key Management helps to login to Private EC2 machine. A new ssh key file created and upon giving 400 access, we can login to Private EC2 machine.
Pingback: EC2 Inbound Outbound Rules in the Security Groups
Pingback: Snapshot in Amazon EC2 ( Create, Attach, Update Snapshot)
Can you make screenshots bigger or higher quality? Even enlarging them does not work or viewing as images brings unreadable picture what you are doing. Should we guess what is in PuTTY in spots that we barely see in this guide? The guide is good, but not usable without proper quality corrections.
Thanks for the feedback. We have tried to enlarge the screenshots.