How to connect ec2 instance in a private subnet

How to connect ec2 instance in a private subnet

This tutorial will help you to understand the connectivity of private server (ec2-instance) in private subnet using NAT gateway from an example. Here we will create a network address translation (NAT) gateway to enable connectivity to the internet.

Note: You could see previous part of this tutorial

VPC Hands-On Lab -3

Create a NAT Gateway in public subnet

  1. Create a NAT Gateway in public subnet
    aws-vpc-nat-gateway-home
    aws-vpc-nat-gateway-create

Configure Private Route Table for NAT gateway

  1. Configure Private Route Table for NAT gateway
    aws-vpc-nat-gateway-route-edit
    aws-vpc-nat-gateway-route-edited

Add default security group of your VPC to private server

  1. Add default security group of your VPC to private server. Also, edit and add SSH inbound rule to database security group (i.e. CloudiofyDatabaseSG)edit-private-server-security-group

SSH to private server from public server and Install MySQL database

  1. SSH private server from public server
    SSH-to-private-serverSSH-to-private-serverSSH-to-private-server

Next part of VPC Lab

VPC Hands-On Lab -4 – How to control network traffic using Network ACL

How to connect ec2 instance in a private subnet