簡體   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