AWS Bastion Setup

 

A bastion host is a server whose purpose is to provide access to a private network from an external network, such as the Internet.


This is going to be our setup.

1) Create a VPC.

2) Create 2 subnets. One as Public and another one as Private.

3) Public Subnet is attached to INTERNET GW -> To allow 2-way internet access from Public Subnet.

4) Public Subnet is attached to NAT GW -> To allow instances on a PRIVATE subnet to access the Internet on 1 way - OUTBOUND.







Attached is the IGW to VPC.

Create 2 route tables.

The public route table is attached to the public subnet and with the route to Internet GW.



Let's create another route table called private subnet.



Not adding any route at the moment. It's associated with the Private Subnet.

Creating 2 instances. One is each subnet. 

Named the instance called "bastion" in the public subnet and "webserver" in the private subnet.


Connecting to the bastion EC2 instance using public IP.



Let's connect to the webserver from the bastion.



Checking internet connection from the webserver instance.


Which is expected. So, We are going to set up NAT GW.


NAT GW should be on the public subnet.

Update the Private route table to route traffic to NAT GW.




We are online from webserver on PRIVATE VPC.

Advantage of NAT GW. It allows OUTBOUND connection. No INBOUND connection is allowed.





Comments

Popular posts from this blog

SRE/DevOps Syllabus

AWS Code Commit - CI/CD Series Part 1

Docker - Preventing IP overlapping