By using AWS re:Post, you agree to the Terms of Use
/EB-Cli SSH Tunnel to RDS Database/

EB-Cli SSH Tunnel to RDS Database

0

I am trying to follow this http://medium.com/@michalisantoniou6/connect-to-an-aws-rds-using-an-ssh-tunnel-22f3bd597924 to setup a ssh tunnel to my rds database via a ec2 instance managed by beanstalk.

In particular I want to use this command:

ssh -N -L localPort:rdsHost:remotePort user@remoteHost -i ~/path/to/key

However, I am using aws-elastic-beanstalk with the eb-cli.

The eb cli provides eb -ssh to connect via ssh to an instance.
So I tried to achive the same with:

eb ssh -e '-N -L localPort:rdsHost:remotePort'

from the eb documentation:

-e CUSTOM, --custom CUSTOM
Specify an SSH command to use instead of 'ssh -i
keyfile'. Do not include the remote user and hostname.

However, this only yields the following output and terminates instead of creating a tunnel.

INFO: Attempting to open port 22.
INFO: SSH port 22 open.
INFO: Running -N -L localPort:rdsHost:remotePort ec2-user@ip-of-instance

Is it possible to create a tunnel with the eb-cli?

asked 3 years ago1 views
3 Answers
0

RDS does not support ssh to a RDS host.
-Phil

answered 3 years ago
0

Hello Phil,

I'm not talking about direct ssh access but via a tunnel from an ec2 instance managed by beanstalk with the eb-cli.

And yes, it is possible: https://superuser.com/a/1425910/1012383
Here the solution is given, maybe you should consider updating the documentation of the eb-cli.

Best regards
Oskar

answered 3 years ago
0

As Phil said, you can’t SSH into an RDS host. You can port forward using SSH Tunneling via an EC2 host as an alternative to opening up an internet-accessible port to your RDS instance. In that case RDS isn’t participating in SSH at all it just sees a normal connect on its regular port from within the VPC.

Although I’ve never tried to follow the instructions, here is another good article on using SSH Tunneling to connect to RDS https://medium.com/@deepspaceprog/how-to-connect-via-ssh-to-an-amazon-rds-instance-running-postgresql-5e7661cdd37e

answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions