How to tunnel to bastion instance using ssh tunneling
Usually you are going to need this on jump server
or what we bastion
whitelist your IP to the corresponding server before you attempt to ssh tunnel to it.
How do I do that?
Go to your terminal and issue
ssh -i /PATH/TO/YOUR-PEM-FILE.pem -N -L 3308:YOUR-RDS-SERVER:3306 ec2-user@YOUR-AWS-SERVER-IP-OR-NAME
What is happening?
You will get your pem file and use that as a token to jump to your server. In this example I gave and RDS of mysql which by default has port of 3306. And I have given 3308 which will be used from my machine to jump to the server as needed.
what then?
Now, your local machine is configured to relay – forward – the port to the destination and whatever you throwing to your local machine’s 3308 port will be forwarded to the remote servers port and you can access the RDS.