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?

ohlr
已提问 5 年前519 查看次数
3 回答
0

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

AWS
审核人员
philaws
已回答 5 年前
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

ohlr
已回答 5 年前
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

HalTemp
已回答 5 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则