

We are using VPC peering to establish connection between the lambda functions and MongoDB. I am working on an interesting project which involves lots of integrations where AWS Lambda functions and a document database (MongoDB) are deployed in two separate VPC networks. Log story short, Yes its possible with the help of AWS Systems Manager Session Manager. Ssh -i obsite.pem -L 9000:127.0.0.How awesome is to access either a MongoDB or MySQL deployed in a VPC network locally using MongoDB Compass or MySQL Workbench ?Īt this point you might think that, how is it possible to tunnel to another resource within VPC directly from your local machine? It's the same as before, but using the "-i" flag to pass the key. If the SSH connection were using a key-pair, we might do the following instead. Ssh -L 9000:127.0.0.1:9000 could then access the service on the remote server using the following URL on my PC. This would require SSH authentication in the normal way. I could issue to the following command to associate port 9000 on my PC with port 9000 on the remote server. Let's assume we have a web service listening on port 9000 on the server, but port 9000 is not opened on the server's local firewall, so it's not accessible to my PC. It may sound a little like a security hole, but remember it can only be done by someone with direct SSH access to the server, so it's pretty simple to police.

All the traffic is tunnelled through port 22, so you don't have to worry about not having direct access to ports through the local firewall on the server. The Solution (SSH Tunnel)Ī SSH tunnel, or port forwarding, allows you to associates a local port on your PC with a remote port on a server. There are times where you have SSH access to a server, but you don't have direct access to a number of other ports on the server, as they are locked down by a local firewall and only available from the local machine or from specified servers and load balancers. This post only considers the scenario of a client PC connecting to a server. There are a number of different types of port forwarding. This short post will demonstrate opening a SSH tunnel to get to a port on a remote server, which you don't have firewall access to reach. Home » Articles » Linux » Here SSH Tunnel (Port Forwarding) to access
