


SSH TUNNEL BASTION HOW TO
The example project shows how to configure a project to setup a public and private network. The connection is encrypted and all data will be sent encrypted via the tunnel to your local computer. The tunnel is bidirectional which means that the private instance can answer with a web page that will be rendered by the web browser. When a SSH tunnel is created, open a browser and open The browser will connect to the local computer, and all data to port 8080 will be forwarded from the SSH server to the private instance. To setup SSH local port forwarding from localhost:8080 to the private host :80 type: $ ssh -N -L8080::80 -i bastion.pem to the private instance We will connect to the bastion host via SSH and setup a tunnel to the private instance so that the webpage is reachable from our local computer only. The public subnet is reachable via SSH using RSA keys. The private instance can connect to a basion host in the public subnet. The private instance will host a simple webpage on port 80.

We will create an EC2 instance in a private subnet that has NAT connectivity. With SSH tunnels we can access servers in AWS that do not have public network connectivity. In this blog we will use SSH to setup a SSH tunnel to the virtual network in AWS. With the KeyPair we can initiate a connection to the instance and get access to the terminal. In my last blog about AWS Secure Shell (SSH) setup with EC2 and CloudFormation we have automated creating an EC2 instance with a KeyPair.
