Launch EC2 Instance On Amazon Cloud Using Private subnets

In our previous article, we have already created EC2 instances for public subnets. Now I will use private subnets to launch EC2 instance. you can launch servers in private subnets in AWS.

You can directly be connected to the internet using public subnets because you keep the servers that will be facing public traffic.

Check Out: How To Create Security Group For Server On Amazon Web Service

You can follow the steps to launch the server, I’m skipping a few steps

Click on Launch -> launch instance -> choose Linux AMI -> Instance type

Now you need to choose your VPC network and Private subnets here

launch ec2 instance

Add storage to install the Linux OS

Check Out: How To Launch EC2 Instances(server) On Amazon Cloud

launch ec2 instance  private

Define a tag to recognize the server later and Give it any name.

servers in private subnets

You need to create a security group separately for your private server. In inbound rules, you need to define the IP or network. So servers that are in other subnets can talk to your private servers. You can’t directly access your private subnets servers.

aws launch private server

Check Out: How To Create Route Tables In VPC Network On Amazon cloud

Now review your server configuration and choose a key to launch the server. I used an already existing key pair. You can use the same key for all your servers.

launch server with private

Your instance created for private subnets.

Check Out: How To Setup Multi-Factor authentication In Amazon Web Service

If you want to access your private subnets server, you need to come on public then do ssh to private servers. Now access your public server instance.

You will need a pem key to access the private servers from the public and paste the key in this file.

Check Out: How to Create VPC Network In The Amazon cloud

Change file permission,

chmod 600 websrv.pem

Now login to your private subnet server using the below command.

ssh -i websrv.pem [email protected]

Check Out: How To Delete File And Logs Older Than 30 Days In Linux

You have successfully logged in to the private server which has the IP 
10.0.2.171 and makes sure port 22 should be open on the private 
subnets and network or IP should be whitelisted to connect the server
within your network.

You’re done aws launch private server launch server with private

LEAVE A REPLY

Please enter your comment!
Please enter your name here