2016-12-18 22 views
0

以下配置將啓動一個實例,但無法連接它......但vpc-id,子網ID和安全組ID在同一個測試菜單中工作時沒有問題。打包程序構建不能ssh到aws實例

{ 
    "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... 

鑑於這部作品在試驗廚房,沒有額外的變量,我不知道我錯過了什麼?有任何想法嗎?

+0

您確定您使用相同的SSH公鑰啓動了ec2實例嗎?你不可能把錯誤的公鑰放在實例上?這通常意味着什麼。 –

+0

問題解決了 - 錯誤的默認用戶名:) – TyMac

+0

@TyMac然後你應該回答你自己的問題,並標記你的答案爲接受。 –

回答

0

問題是錯誤的默認用戶名。