无法使用 PuTTY 连接到 Amazon EC2 实例

Can't connect to Amazon EC2 instance with PuTTY

我已经能够使用免费套餐连接到 Amazon Web Services EC2 并使用它连接 运行 R 程序。现在我正在尝试将实例与 Spot 请求一起使用。实例已创建并且 运行ning 和两个状态检查均正常。但是,PuTTY 不会连接。 PuTTY 仍将使用相同的步骤和相同的 key pair.

连接到免费实例

谁能指出我做错了什么?如果此信息可能有帮助,请参阅以下两个实例的详细信息。我隐藏了 Instance IDsIPsOwner IDReservations 的部分内容,并提供了一个假的 key pair 名称。

以下是我无法连接到 PuTTY 的 Spot 实例的详细说明:

Instance ID: i-XXXXXa30498b1b9ca
Public DNS (IPv4): ec2-XX-XXX-XXX-XXX.us-east-2.compute.amazonaws.com
Instance state: running
IPv4 Public IP: XX.XXX.XXX.XXX
Instance type: r4.xlarge
IPv6 IPs: -
Elastic IPs:
Private DNS: ip-XXX-XX-XX-XX.us-east-2.compute.internal
Availability zone: us-east-2b
Private IPs: XXX.XX.XX.XX
Security groups: default. view inbound rules. view outbound rules
Secondary private IPs
Scheduled events: No scheduled events
VPC ID: vpc-ce0c17a6
AMI ID: ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-20191002 (ami-0d5d9d301c853a04a)
Subnet ID: subnet-b3f881c9
Platform: -
Network interfaces: eth0
IAM role: -
Source/dest. Check: True
Key pair name: mykeyb
T2/T3 Unlimited: -
Owner: XXXXXXXXXXXX
EBS-optimized: False
Launch time: November 26, 2019 at 5:43:37 PM UTC-5 (1 hour)
Root device type: ebs
Termination protection: False
Root device: /dev/sda1
Lifecycle: spot
Block devices: /dev/sda1
Monitoring: basic
Elastic Graphics ID: -
Alarm status: None
Elastic Inference accelerator ID: -
Kernel ID: -
Capacity Reservation: -
RAM disk ID: -
Capacity Reservation Settings: Open
Placement group: -
Partition number: -
Virtualization: hvm
Reservation: r-XaecaXXbfXacXXXXX
AMI launch index: 0
Tenancy: default
Host ID: -
Affinity: -
State transition reason: -
State transition reason message: -
Stop - Hibernation behavior: Disabled
Number of vCPUs: 4

以下是我可以使用 PuTTY 连接的免费实例的详细说明:

Instance ID: i-ZZdZZZZZ41cZZZZZZ
Public DNS (IPv4): ec2-X-XXX-XXX-XX.us-east-2.compute.amazonaws.com
Instance state: running
IPv4 Public IP: X.XXX.XXX.XX
Instance type: t2.micro
IPv6 IPs: -
Elastic IPs:
Private DNS: ip-XXX-XX-XX-XXX.us-east-2.compute.internal
Availability zone: us-east-2b
Private IPs: XXX.XX.XX.XXX
Security groups: launch-wizard-5. view inbound rules. view outbound rules
Secondary private IPs:
Scheduled events: No scheduled events
VPC ID: vpc-ce0c17a6
AMI ID: ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-20191002 (ami-0d5d9d301c853a04a)
Subnet ID: subnet-b3f881c9
Platform: -
Network interfaces: eth0
IAM role: -
Source/dest. check: True
Key pair name: mykeyb
T2/T3 Unlimited: Disabled
Owner: XXXXXXXXXXXX
EBS-optimized: False
Launch time: November 22, 2019 at 12:16:56 AM UTC-5 (less than one hour)
Root device type: ebs
Termination protection: False
Root device: /dev/sda1
Lifecycle: normal
Block devices: /dev/sda1
Monitoring: basic
Elastic Graphics ID: -
Alarm status: None
Elastic Inference accelerator ID: -
Kernel ID: -
Capacity Reservation: -
RAM disk ID: -
Capacity Reservation Settings: Open
Placement group: -
Partition number: -
Virtualization: hvm
Reservation: r-XXaXXXdfXXXXfXXXX
AMI launch index: 0
Tenancy: default
Host ID: -
Affinity: -
State transition reason: -
State transition reason message: -
Stop - Hibernation behavior: Disabled
Number of vCPUs: 1

您的两个 EC2 实例上的安全组不同。安全组是防火墙规则集。您需要允许入站端口 22 (SSH) 到 Spot 实例。假设两个实例都在同一个 VPC 中,您可以做到这一点的一种简单方法是将 launch-wizard-5 安全组添加到 spot 实例。或者创建一个具有等效入口规则集的新安全组,并将其添加到 spot 实例。