aws:can can can Connect to Amazon Linux EC2实例
我正在与AWS合作,我有一个EC2实例(Amazon Linux),但是我无法连接到它,我检查了所有VPC参数,并且启用了这些参数,但是当我尝试使用它使用它时ec2实例连接我收到此消息:
net/wcruo.png“ rel =” nofollow noreferrer“>
也,会话经理无法连接。
所以我的问题是:我需要更新或检查哪些设置才能连接到我的EC2实例?
非常感谢您的评论。
I'm working with AWS, I have an EC2 instance (Amazon Linux) but I can't connect to it, I've checked all VPC parameters and they are enabled as well as the instance, but when I try to connect it using EC2 Instance Connect I get this message:
I'm using the default user account, also I generated a key pair however I'm getting this other message:
Also, session manager can't connect.
So my question is: what settings do I need to update or check in order to connect to my EC2 instance?
Thanks a lot for your comments.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(1)
有多种登录到Amazon EC2实例的方法。
SSH
您的屏幕截图表明您想通过SSH登录,但据说在启动实例时没有选择Keypair。因此,此选项不适合您。
EC2实例连接
如果您想使用 EC2实例Connect 登录到Amazon EC2实例,并且正在遇到连接问题,请确保您的安全组允许从IP地址范围内从端口22上入站访问EC2实例连接服务(不是您自己的IP地址)的。
这是因为计算机上的EC2实例连接客户端连接到端口443上的AWS(作为Web连接),然后流量从EC2实例连接 Service 到EC2实例作为正常的SSH因此,端口22上的连接。因此,安全组需要从EC2实例连接服务的IP地址范围内允许端口22上的入站连接(或者您可以懒惰,只需选择
0.0.0.0.0.0/0
,但这是较低的安全级别)。您可以在以下位置找到AWS服务的IP地址范围: AWS IP地址范围 - AWS常规参考
请注意,您的EC2实例必须在A 公共子网中,并且必须通过A 公共IP地址进行连接。
AWS Systems Manager会话管理器
会话管理器以完全不同的方式连接,而无需使用SSH。它要求在EC2实例上安装一个代理(默认情况下,如果您从Amazon Linux AMI启动)。然后,该代理会创建与AWS的出站连接,因此它不需要任何入站安全规则(但确实需要默认的“允许所有”出站规则)。
Session Manager还具有的其他好处,即只要EC2实例可以通过NAT Gateway 或如果VPC具有系统管理器的VPC端点。
There are multiple ways to login to an Amazon EC2 instance.
SSH
Your screenshot shows that you are wanting to login via SSH, but it is saying that no Keypair was selected when the instance was launched. Therefore, this option is not available for you.
EC2 Instance Connect
If you ware wanting to login to the Amazon EC2 instance using EC2 Instance Connect and you are experiencing connectivity problems, then make sure that your Security Group permits Inbound access on port 22 from the IP address range of the EC2 Instance Connect service (not your own IP address).
This is because the EC2 Instance Connect client on your computer connects to AWS on port 443 (as a web connection), and then the traffic goes from the EC2 Instance Connect service to the EC2 instance as a normal SSH connection on port 22. Therefore, the Security Group needs to permit Inbound connections on port 22 from the IP address range of the EC2 Instance Connect service (or you can be lazy and just select
0.0.0.0/0
, but that is a lower level of security).You can find the IP address ranges for AWS services at: AWS IP address ranges - AWS General Reference
Please note that your EC2 instance must be in a public subnet and you must connect via a public IP address.
AWS Systems Manager Session Manager
The Session Manager connects in a totally different way, without using SSH. It requires an Agent to be installed on the EC2 instance (and it is there by default if you launched from an Amazon Linux AMI). This Agent then creates an Outbound connection to AWS, so it does not require any Inbound security rules (but it does require the default "Allow All" Outbound rule).
Session Manager has the additional benefit that it allows you to connect to EC2 instances that are in private subnets, as long as the EC2 instance can access the Internet via a NAT Gateway or if the VPC has a VPC endpoint for Systems Manager.