大网数据广告活动
服务器运维问答

SSH forward from public EC2 to RDS not working

· 52CE 我爱测

So I am relatively new to the networking aspects of AWS and am having a problem. Here is a short description of what I have. I have a RDS that is not publicly accessible. The endpoint resolves to a private 10.X.X.X IP. I have an …

问题原文

原帖链接 · cinnafire · CC BY-SA 4.0

So I am relatively new to the networking aspects of AWS and am having a problem. Here is a short description of what I have.

I have a RDS that is not publicly accessible. The endpoint resolves to a private 10.X.X.X IP. I have an EC2 instance that is in the same VPC/subnet and is publicly accessible. I can SSH to this EC2 instance with no problems. Oddly, I have a process running on that EC2 instance that is able to successfully connect to RDS via JDBC.

However, since the RDS instance is not publicly accessible I want to use the EC2 instance to access the RDS instance from my dev PC. Everytime I do, I get "channel 2: open failed: administratively prohibited: open failed" on my PC.

Here is my command

ssh -i ~/key.pem -N -L 3307:rds-name-here.abcdefghi123.us-east-1.rds.amazonaws.com:3306 [email omitted]

Obviously I changed the details but thats the jist of the command. This is the only error I am getting and really don't know where else to look.

Any pointers in the right direction would he helpful. I am at a loss at the moment. I did confirm the security groups allow all traffic to and from each other. I did not modify the Network ACLs at all.

EDIT: I enabled some debug flags ( -vvv ) and it is responding with packet type 92?

debug2: fd 6 setting TCP_NODELAY
debug2: fd 6 setting O_NONBLOCK
debug3: fd 6 is O_NONBLOCK
debug1: channel 2: new [direct-tcpip]
debug3: send packet: type 90
debug3: receive packet: type 92
channel 2: open failed: administratively prohibited: open failed
debug2: channel 2: zombie
debug2: channel 2: garbage collecting

已采纳解答

原帖链接 · cinnafire · CC BY-SA 4.0

So I found the answer... apparently it was a typo. I found another post telling me to look in /var/log/secure and there were errors there about not being able to find the endpoint. My problem is I was using the endpoint of an old replica read node that I used initially to see the data in my master, that has since been deleted. I didn't realize it because the full hostname is near identical and thought I had copied/pasted it.

So for other people that are looking into potential problems, check /var/log/secure, grep it for sshd and look for errors "Name or service not known". That is what was happening to me.

It works now.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-06-12)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。