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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠