如果我的安全组允许端口 22 上的 TCP 并且没有网络访问控制列表,为什么我不能通过 SSH 连接到我的 EC2 实例?

Why can't i SSH into my EC2 instance if my security group is allowing TCP on Port 22 and there is no Network Access Control List?

我有一个 ec2 实例,我想用作 MySQL Workbench.

的 SSH 隧道

它的访问被锁定到我的 IP,用于 TCP 流量的端口 22。没有NACL。

我可以在 Systems Manager 会话管理器中启动会话并查看实例是否正常工作并且可以 ping public 个 URL。

密钥对在我所在的文件夹中 运行 以下命令:

ssh -i "key-pair.pem" ec2-user@11.22.33.44 

但是,我的终端操作超时,当我尝试通过 MySQL Workbench 连接时也是如此。有人可以帮忙吗?

如果我将 -vvv 添加到命令中,我会得到以下输出

debug1: Reading configuration data /Users/xxxx/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug2: resolve_canonicalize: hostname 11.22.33.44 is address
debug2: ssh_connect_direct
debug1: Connecting to 11.22.33.44  [11.22.33.44] port 22.
debug1: connect to address 11.22.33.44 port 22: Operation timed out
ssh: connect to host 11.22.33.44 port 22: Operation timed out

这里的问题是我的 VPN 使用的 IP 与安全组中的 MyIP 选项选择的不同,因此我的请求在安全组级别被拒绝。