繁体   English   中英

Packer构建无法SSH到AWS实例

[英]packer build cannot ssh to aws instance

以下配置将启动实例,但无法连接该实例...但是相同的密钥,vpc-id,子网ID和安全组ID在测试厨房中可以正常工作。

{
  "variables": {
  "aws_access_key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "aws_secret_key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
    "builders": [{
        "type": "amazon-ebs",
        "access_key": "{{user `aws_access_key`}}",
        "secret_key": "{{user `aws_secret_key`}}",
        "region": "us-east-1",
        "source_ami": "ami-146e2a7c",
        "instance_type": "t2.micro",
        "ssh_username": "ubuntu",
        "ami_name": "packer-example {{timestamp}}",
        "ssh_keypair_name": "xxx",
        "ssh_private_key_file": "xxx.pem",
        "vpc_id": "vpc-xxxxxxx",
        "subnet_id": "subnet-xxxxxxx",
        "security_group_id": "sg-xxxxxxx",
        "associate_public_ip_address": "true"

    }]
}

我收到以下调试错误:

2016/12/17 20:10:50 packer: 2016/12/17 20:10:50 [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [publickey none], no supported methods remain
2016/12/17 20:10:50 packer: 2016/12/17 20:10:50 [DEBUG] Detected authentication error. Increasing handshake attempts.
2016/12/17 20:10:57 packer: 2016/12/17 20:10:57 [INFO] Attempting SSH connection...
2016/12/17 20:10:57 packer: 2016/12/17 20:10:57 reconnecting to TCP connection for SSH
2016/12/17 20:10:57 packer: 2016/12/17 20:10:57 handshaking with SSH
2016/12/17 20:10:59 packer: 2016/12/17 20:10:59 handshake error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
2016/12/17 20:10:59 packer: 2016/12/17 20:10:59 [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
2016/12/17 20:10:59 ui error: ==> amazon-ebs: Error waiting for SSH: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
2016/12/17 20:10:59 ui: ==> amazon-ebs: Terminating the source AWS instance...

鉴于这可以在没有额外变量的测试厨房中正常工作,我想知道我缺少什么? 有任何想法吗?

问题是默认用户名错误。

我通过忘记添加(aws帐户的)public_key_pair来解决了这一问题,我收到了相同的错误消息“ amazon-ebs:等待SSH时出错:ssh:握手失败:ssh:无法验证,尝试的方法[none publickey],仍然没有受支持的方法”,问题是我忘记向dockerized Packer提供SSH_KEYPAIR_NAME。 添加kaypair名称后,即可使用!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM