I am getting below error. Can you please suggest me what to do to fox this issue.
amazon-ebs output will be in this color. ==> amazon-ebs: Prevalidating AMI Name... amazon-ebs: Found Image ID: ami-6d1c2007 ==> amazon-ebs: Using SSH Agent with key pair in Source AMI ==> amazon-ebs: Launching a source AWS instance... amazon-ebs: Instance ID: i-0ba9189303f694c4f ==> amazon-ebs: Waiting for instance (i-0ba9189303f694c4f) to become ready... ==> amazon-ebs: Adding tags to source instance ==> amazon-ebs: Waiting for SSH to become available... ==> amazon-ebs: Timeout waiting for SSH. ==> amazon-ebs: Terminating the source AWS instance... ==> amazon-ebs: Cleaning up any extra volumes... ==> amazon-ebs: Destroying volume (vol-0548b24c3295c3acd)... Build 'amazon-ebs' errored: Timeout waiting for SSH. ==> Some builds didn't complete successfully and had errors: --> amazon-ebs: Timeout waiting for SSH. ==> Builds finished but no artifacts were created. sh-3.2# Thanks, Rakesh On Wednesday, February 22, 2017 at 11:11:16 AM UTC-8, notmyrealname wrote: > > Packer v0.12.2 > Mac OS X 10.11.6 > > As suggested, I've moved this from the Github issues page to here as this > is probably the best place for it. > > Here are my 2 AWS key pairs on the host machine with sensible permissions: > > ls -l ~/.ssh | grep key > -rw-------@ server_key.pem > -rw-r--r-- server_key.pub > -rw-------@ aws-key.pem > -rw-r--r-- aws-key.pub > > Here they are existing in AWS: > > aws ec2 describe-key-pairs > { > "KeyPairs": [ > { > "KeyName": "server_key", > "KeyFingerprint": "xxxxxxxxxx" > }, > { > "KeyName": "aws-key", > "KeyFingerprint": "xxxxxxxxxx" > } > ] > } > > The build part of my packer.json. The ami is stock ubuntu. > > { > "variables": { > "env": null > }, > "builders": [{ > "type": "amazon-ebs", > "region": "eu-west-1", > "source_ami": "ami-98ecb7fe", > "instance_type": "t2.micro", > "ssh_username": "ubuntu", > "ssh_agent_auth": true, > "ssh_keypair_name": "aws-key", > "ami_name": "{{user `env`}}-server-{{isotime \"2006-01-02_15-04-05\"}}", > "run_tags": {"Name": "{{user `env`}}-server"}, > "run_volume_tags": {"Name": "{{user `env`}}-server"} > }] > } > > Everything runs fine when I set "ssh_keypair_name": "aws-key" (full log > <https://gist.github.com/newtonne/be9c1bf107eadf3e5ff1daad2a4f18be>) > > 2017/02/21 19:54:04 ui: ==> amazon-ebs: Using SSH Agent for existing key pair > aws-key > ==> amazon-ebs: Using SSH Agent for existing key pair aws-key > 2017/02/21 19:54:04 ui: ==> amazon-ebs: Creating temporary security group for > this instance... > ... > ... > 2017/02/21 19:54:21 ui: ==> amazon-ebs: Waiting for SSH to become available... > ==> amazon-ebs: Waiting for SSH to become available... > 2017/02/21 19:54:36 packer: 2017/02/21 19:54:36 [DEBUG] TCP connection to SSH > ip/port failed: dial tcp 34.249.20.107:22: i/o timeout > 2017/02/21 19:54:41 packer: 2017/02/21 19:54:41 [DEBUG] TCP connection to SSH > ip/port failed: dial tcp 34.249.20.107:22: getsockopt: connection refused > 2017/02/21 19:54:46 packer: 2017/02/21 19:54:46 [INFO] Attempting SSH > connection... > 2017/02/21 19:54:46 packer: 2017/02/21 19:54:46 reconnecting to TCP > connection for SSH > 2017/02/21 19:54:46 packer: 2017/02/21 19:54:46 handshaking with SSH > 2017/02/21 19:54:46 packer: 2017/02/21 19:54:46 handshake complete! > 2017/02/21 19:54:46 packer: 2017/02/21 19:54:46 opening new ssh session > 2017/02/21 19:54:47 packer: 2017/02/21 19:54:47 [INFO] agent forwarding > enabled > 2017/02/21 19:54:47 ui: ==> amazon-ebs: Connected to SSH! > > However, for any new keys that I create and then set as my > "ssh_keypair_name" (in this case "server_key"), I get the following ssh > authentication error: (full log > <https://gist.github.com/newtonne/0c2ed30182e058fcac18f2217f21c494>) > > 2017/02/21 19:50:59 ui: ==> amazon-ebs: Using SSH Agent for existing key pair > server_key > 2017/02/21 19:50:59 ui: ==> amazon-ebs: Creating temporary security group for > this instance... > ==> amazon-ebs: Using SSH Agent for existing key pair server_key > ... > ... > 2017/02/21 19:51:16 ui: ==> amazon-ebs: Waiting for SSH to become available... > ==> amazon-ebs: Waiting for SSH to become available... > 2017/02/21 19:51:31 packer: 2017/02/21 19:51:31 [DEBUG] TCP connection to SSH > ip/port failed: dial tcp 34.251.38.229:22: i/o timeout > 2017/02/21 19:51:39 packer: 2017/02/21 19:51:39 [DEBUG] TCP connection to SSH > ip/port failed: dial tcp 34.251.38.229:22: getsockopt: connection refused > 2017/02/21 19:51:44 packer: 2017/02/21 19:51:44 [DEBUG] TCP connection to SSH > ip/port failed: dial tcp 34.251.38.229:22: getsockopt: connection refused > 2017/02/21 19:51:49 packer: 2017/02/21 19:51:49 [INFO] Attempting SSH > connection... > 2017/02/21 19:51:49 packer: 2017/02/21 19:51:49 reconnecting to TCP > connection for SSH > 2017/02/21 19:51:49 packer: 2017/02/21 19:51:49 handshaking with SSH > 2017/02/21 19:51:50 packer: 2017/02/21 19:51:50 handshake error: ssh: > handshake failed: ssh: unable to authenticate, attempted methods [publickey > none], no supported methods remain > 2017/02/21 19:51:50 packer: 2017/02/21 19:51:50 [DEBUG] SSH handshake err: > ssh: handshake failed: ssh: unable to authenticate, attempted methods > [publickey none], no supported methods remain > 2017/02/21 19:51:50 packer: 2017/02/21 19:51:50 [DEBUG] Detected > authentication error. Increasing handshake attempts. > 2017/02/21 19:51:57 packer: 2017/02/21 19:51:57 [INFO] Attempting SSH > connection... > 2017/02/21 19:51:57 packer: 2017/02/21 19:51:57 reconnecting to TCP > connection for SSH > 2017/02/21 19:51:57 packer: 2017/02/21 19:51:57 handshaking with SSH > 2017/02/21 19:51:57 packer: 2017/02/21 19:51:57 handshake error: ssh: > handshake failed: ssh: unable to authenticate, attempted methods [none > publickey], no supported methods remain > 2017/02/21 19:51:57 packer: 2017/02/21 19:51:57 [DEBUG] SSH handshake err: > ssh: handshake failed: ssh: unable to authenticate, attempted methods [none > publickey], no supported methods remain > 2017/02/21 19:51:57 packer: 2017/02/21 19:51:57 [DEBUG] Detected > authentication error. Increasing handshake attempts. > > > Also, whilst the instance is up, I am able to SSH into it (note that the > IP address is different to the above failed log as it was a different > failed build): > > > ssh ubu...@34.250.136.97 <javascript:> -i ~/.ssh/server_key.pem > The authenticity of host '34.250.136.97 (34.250.136.97)' can't be established. > ECDSA key fingerprint is xxxxxx. > Are you sure you want to continue connecting (yes/no)? yes > Warning: Permanently added '34.250.136.97' (ECDSA) to the list of known hosts. > Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-62-generic x86_64) > > * Documentation: https://help.ubuntu.com > * Management: https://landscape.canonical.com > * Support: https://ubuntu.com/advantage > > Get cloud support with Ubuntu Advantage Cloud Guest: > http://www.ubuntu.com/business/services/cloud > > 0 packages can be updated. > 0 updates are security updates. > > > Any idea what's going on here or what I could try? > > Thanks. > -- This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list. GitHub Issues: https://github.com/mitchellh/packer/issues IRC: #packer-tool on Freenode --- You received this message because you are subscribed to the Google Groups "Packer" group. To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/e0e471a1-755b-45aa-8059-787099438fec%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.