'knife ec2 server create' through gateway hangs, but 'knife bootstrap' works fine


#1

I followed the Server Fault answer here:

But it still doesn’t work.

The instance is launched fine, but it waits forever on the “waiting for
sshd” step.

The weird part is that if I run knife bootstrap directly on the private ip
(using the --ssh-gateway) option, it works fine.

Here is the knife command I’m using:

bundle exec knife ec2 server create
–environment edge
–node-name edge-db-e-clients-01
–subnet subnet-xxx
–flavor m3.medium
–image ami-xxx
–security-group-ids sg-xxx
–iam-profile node
–ssh-user ubuntu
–ssh-key provisioner
–ssh-gateway ubuntu@bastion.blah.com
–server-connect-attribute private_ip_address
–no-host-key-verify
–ebs-size 50
–ephemeral /dev/sdb,/dev/sdc,/dev/sdd,/dev/sde
–json-attributes ‘{“route53”:{“value_src”:“local_ipv4”,“type”:“A”}}’
–run-list recipe[aw_base::default],recipe[aw_base::auto_dns]

The output of that gets stuck here:

Waiting for sshd access to become available
DEBUG: Using ssh gateway ubuntu@bastion.blah.com from knife config

Here is the knife bootstrap command that works fine through the gateway:

bundle exec knife bootstrap 10.x.x.x
–environment edge
–node-name edge-db-e-clients-01
–ssh-user ubuntu
–ssh-gateway ubuntu@bastion.blah.com
–sudo
–json-attributes ‘{“route53”:{“value_src”:“local_ipv4”,“type”:“A”}}’
–run-list recipe[aw_base::default],recipe[aw_base::auto_dns]

Any ideas? Thanks for the help.


#2

Nevermind, figured it out (by reading the source of course). knife ec2 server create doesn’t honor your .ssh/config file, so I had to manually
specify the right port and identity file for the ssh gateway:

–ssh-gateway ubuntu@bastion.blah.com:2222
–ssh-gateway-identity /path/to/correct/identity/file

With those two options corrected, it works now.

On Mon, Jan 19, 2015 at 11:54 AM, Christopher J. Bottaro <
cjbottaro@academicworks.com> wrote:

I followed the Server Fault answer here:
http://serverfault.com/questions/641951/knife-cant-ssh-into-newly-instantiated-ec2-server

But it still doesn’t work.

The instance is launched fine, but it waits forever on the “waiting for
sshd” step.

The weird part is that if I run knife bootstrap directly on the private ip
(using the --ssh-gateway) option, it works fine.

Here is the knife command I’m using:

bundle exec knife ec2 server create
–environment edge
–node-name edge-db-e-clients-01
–subnet subnet-xxx
–flavor m3.medium
–image ami-xxx
–security-group-ids sg-xxx
–iam-profile node
–ssh-user ubuntu
–ssh-key provisioner
–ssh-gateway ubuntu@bastion.blah.com
–server-connect-attribute private_ip_address
–no-host-key-verify
–ebs-size 50
–ephemeral /dev/sdb,/dev/sdc,/dev/sdd,/dev/sde
–json-attributes ‘{“route53”:{“value_src”:“local_ipv4”,“type”:“A”}}’
–run-list recipe[aw_base::default],recipe[aw_base::auto_dns]

The output of that gets stuck here:

Waiting for sshd access to become available
DEBUG: Using ssh gateway ubuntu@bastion.blah.com from knife config

Here is the knife bootstrap command that works fine through the gateway:

bundle exec knife bootstrap 10.x.x.x
–environment edge
–node-name edge-db-e-clients-01
–ssh-user ubuntu
–ssh-gateway ubuntu@bastion.blah.com
–sudo
–json-attributes ‘{“route53”:{“value_src”:“local_ipv4”,“type”:“A”}}’
–run-list recipe[aw_base::default],recipe[aw_base::auto_dns]

Any ideas? Thanks for the help.