【问题标题】:AWS, using ec2-ssh failsAWS,使用 ec2-ssh 失败
【发布时间】:2017-12-20 21:08:33
【问题描述】:

我安装了 instagram ec2-ssh 实用程序,如下所述:http://instagram-engineering.tumblr.com/post/11399488246/simplifying-ec2-ssh-connections

ec2-host 运行良好,并列出了主机。例如:

legolas ec2-xx.xx.xx.xx.us-west-1.compute.amazonaws.com

但是,当我尝试通过名称登录时,出现错误:

[root@ip-xx.xx.xx.xx ec2-user]# ec2-ssh legolas
Connecting to send: 'POST / HTTP/1.1\r\nAccept-Encoding: identity\r\nContent-Length: 93\r\nUser-Agent: Boto/2.35.1 Python/2.6.9 Linux/3.14.27-25.47.amzn1.x86_64\r\nHost: ec2.us-west-1.amazonaws.com\r\nX-Amz-Date: 20150216T182656Z\r\nContent-Type: application/x-www-form-urlencoded; charset=UTF-8\r\nAuthorization: AWS4-HMAC-SHA256 Credential=AKIAxxx/20150216/us-west-1/ec2/aws4_request,SignedHeaders=host;x-amz-date,Signature=xxx\r\n\r\n'
send: 'Action=DescribeInstances&Filter.1.Name=tag%3AName&Filter.1.Value.1=legolas&Version=2014-10-01'
reply: 'HTTP/1.1 200 OK\r\n'
header: Content-Type: text/xml;charset=UTF-8
header: Transfer-Encoding: chunked
header: Vary: Accept-Encoding
header: Date: Mon, 16 Feb 2015 18:26:55 GMT
header: Server: AmazonEC2
ec2-xx.xx.xx.xx.us-west-1.compute.amazonaws.com.
ssh: Could not resolve hostname send:: Name or service not known
sh: line 1: send:: command not found
sh: line 2: reply:: command not found
sh: line 3: header:: command not found
sh: line 4: header:: command not found
sh: line 5: header:: command not found
sh: line 6: header:: command not found
sh: line 7: header:: command not found
sh: line 8: ec2-xx.xx.xx.xx.us-west-1.compute.amazonaws.com: command not found

【问题讨论】:

  • 我想第一个明显的问题是:legolas 是否有一个安全组,其传入端口 22 为 SSH 开放?
  • @monkeymatrix - 是的,如果我只是 ssh 到主机名,它就可以工作,就像ssh ec2-user@ec2-xx.xx.xx.xx.us-west-1.compute.amazonaws.com
  • 好的。看起来错误是主机名无法解析。您运行它的机器上的端口 53 是否打开以允许它进行 DNS 查找?

标签: amazon-web-services ssh amazon-ec2


【解决方案1】:

应在您的 VPC 上启用 DNS 解析。请按照以下步骤尝试

  1. 在 AWS Web 控制台上右键单击您的 VPC
  2. 选择“编辑 DNS 解析”
  3. 选择“是”单选按钮
  4. 点击“保存”
  5. 然后再次尝试 ec2-ssh。它应该工作

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-06-24
    • 2016-06-07
    • 2021-01-10
    • 2019-07-15
    • 2021-07-16
    • 2018-10-12
    • 1970-01-01
    相关资源
    最近更新 更多