【发布时间】:2022-01-06 10:09:52
【问题描述】:
我有一个带有私有子网的私有 VPC,一个私有 jumpbox 在 1 个私有子网中,我的私有 RDS aurora MySql 无服务器实例在另一个私有子网中。
我在本地笔记本电脑上执行了这些命令,以尝试通过端口转发连接到我的 RDS:
aws ssm start-session --target i-0d5470040e7541ab9 --document-name AWS-StartPortForwardingSession --parameters "portNumber"=["5901"],"localPortNumber"=["9000"] --profile myProfile
aws ssm start-session --target i-0d5470040e7541ab9 --document-name AWS-StartPortForwardingSession --parameters "portNumber"=["22"],"localPortNumber"=["9999"] --profile myProfile
aws ssm start-session --target i-0d5470040e7541ab9 --document-name AWS-StartPortForwardingSession --parameters "portNumber"=["3306"],"localPortNumber"=["3306"] --profile myProfile
与服务器的连接挂起。
我的本地笔记本电脑出现了这个错误:
Starting session with SessionId: myuser-09e5cd0206cc89542
Port 3306 opened for sessionId myuser-09e5cd0206cc89542.
Waiting for connections...
Connection accepted for session [myuser-09e5cd0206cc89542]
Connection to destination port failed, check SSM Agent logs.
以及/var/log/amazon/ssm/errors.log 中的那些错误:
2021-11-29 00:50:35 ERROR [handleServerConnections @ port_mux.go.278] [ssm-session-worker] [myuser-017cfa9edxxxx] [DataBackend] [pluginName=Port] Unable to dial connection to server: dial tcp :3306: connect: connection refused
2021-11-29 14:13:07 ERROR [transferDataToMgs @ port_mux.go.230] [ssm-session-worker] [myuser-09e5cdxxxxxx] [DataBackend] [pluginName=Port] Unable to read from connection: read unix @->/var/lib/amazon/ssm/session/3366606757_mux.sock: use of closed network connection
我尝试像这样连接到 RDS:
我什至尝试使用 ssh Tunnel 放置 RDS Endpoint,但它不起作用:
在远程服务器 ec2-instance 上是否需要执行任何其他步骤?
似乎连接被接受,但到目标端口的连接不起作用。
感谢您对此的帮助!
【问题讨论】:
标签: amazon-ec2 nestjs portforwarding aws-ssm aws-aurora-serverless