ssh -i "key_pair.pem" ec2-user@ec2-xy-xyz-201-00.ap-southeast-1.compute.amazonaws.com
我想使用DB,比如cms我想通过命令
来使用它-L 3000:xyz.ap-southeast-1.rds.amazonaws.com:3306 -N
我完全糊涂了。
执行本地转发(从ec2到您的系统)
ssh -i <pem key> -NfL localhost:<your local port>:<instanceip>:<your sql port> <user>@<instance ip>
执行远程转发(从本地系统到EC2)
确保AllowTCPForwarding yes
存在于/etc/ssh/sshd_config
文件中默认不启用
Ref: Remote port forwarding failed on Amazon EC2
ssh -i keyPair.pem -R <remote_EC2_port>:localhost:<localhost_port> ec2-user@address.amazonaws.com
同时,确保你的EC2安全组允许访问MySql端口默认值(3306)