amazon-web-services - ssh : connect to host ec2-xxxxxxxx. compute-1.amazonaws.com 端口 22:连接被拒绝

标签 amazon-web-services amazon-ec2 emr amazon-emr

我先列出emr集群:

✗ aws emr list-clusters
{
    "Clusters": [
        {
            "Id": "j-MQIKB378OARL",
            "Name": "Spark cluster",
            "Status": {
                "State": "WAITING",
                "StateChangeReason": {
                    "Message": "Cluster ready after last step failed."
                },
                "Timeline": {
                    "CreationDateTime": 1524200251.319,
                    "ReadyDateTime": 1524201100.225
                }
            },
            "NormalizedInstanceHours": 6
        },

然后我尝试连接:

✗ aws emr ssh --cluster-id j-MQIKB378OARL --key-pair-file ~/.ssh/keys/key-pair.pem
ssh -o StrictHostKeyChecking=no -o ServerAliveInterval=10 -i /Users/myuser/.ssh/keys/key-pair.pem hadoop@ec2-xxxxxxxxxx.compute-1.amazonaws.com -t
ssh: connect to host ec2-xxxxxxxxxx.compute-1.amazonaws.com port 22: Connection refused

我错过了什么吗?

最佳答案

您的实例的安全组似乎不允许传入的 ssh 流量。

来自 AWS Documentation

Security groups enable you to control traffic to your instance, including the kind of traffic that can reach your instance. For example, you can allow computers from only your home network to access your instance using SSH. If your instance is a web server, you can allow all IP addresses to access your instance using HTTP or HTTPS, so that external users can browse the content on your web server.

使用控制台为通过 IPv4 的入站 SSH 流量向安全组添加规​​则:

  1. 在 Amazon EC2 控制台的导航 Pane 中,选择实例。选择您的实例并查看 Description 选项卡;安全组列出与实例关联的安全组。选择查看规则以显示对实例有效的规则列表。

  2. 在导航 Pane 中,选择安全组。选择与您的实例关联的安全组之一。

  3. 在详细信息 Pane 的“入站”选项卡上,选择“编辑”。在对话框中,选择添加规则,然后从类型列表中选择 SSH。

  4. 在“源”字段中,选择“我的 IP”以使用本地计算机的公共(public) IPv4 地址自动填充该字段。或者,选择自定义并以 CIDR 表示法指定您的计算机或网络的公共(public) IPv4 地址。例如,如果您的 IPv4 地址是 203.0.113.25,请指定 203.0.113.25/32 以 CIDR 表示法列出此单个 IPv4 地址。如果贵公司从一个范围内分配地址,请指定整个范围,例如 203.0.113.0/24。

  5. 选择保存。

关于amazon-web-services - ssh : connect to host ec2-xxxxxxxx. compute-1.amazonaws.com 端口 22:连接被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49935403/

相关文章:

javascript - 如何使用 AWS Cognito 在浏览器中对用户进行身份验证?

amazon-web-services - 如何在由 elastic-beanstalk 创建的 ec2 实例上设置标签

node.js - 在 AWS EC2 上部署 Angular 5 应用程序

amazon-web-services - 如何使用多个AWS账户同步多个S3存储桶?

amazon-web-services - AWS ECS Docker : Not pointing to Drupal path and giving error You don't have permission to access this resource

linux - NGINX docker 容器无法在网络浏览器中访问

amazon-web-services - Terraform 无法让 docker 加入 swarm

amazon-web-services - 新 EMR 集群上出现 java.io.FileNotFoundException 错误

hadoop - 如何在 Amazon EMR 上调整 Hadoop MapReduce 参数?