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年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ