# Kitchen-EC2 Waiting for SSH Service" loop Error(Ubuntu Image)!

**URL:** <https://discourse.chef.io/t/kitchen-ec2-waiting-for-ssh-service-loop-error-ubuntu-image/9003>\
**Category:** Chef Infra (archive)\
**Created:** [July 23, 2016, 1:35pm UTC](https://discourse.chef.io/t/kitchen-ec2-waiting-for-ssh-service-loop-error-ubuntu-image/9003 "2016-07-23T13:35:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![imewish](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/imewish/32/1495_2.png) [@imewish](https://discourse.chef.io/u/imewish)\
**Post date:** [July 23, 2016, 1:35pm UTC](https://discourse.chef.io/t/kitchen-ec2-waiting-for-ssh-service-loop-error-ubuntu-image/9003/1 "2016-07-23T13:35:42Z")

</div>

Hi I was trying to create a ubuntu instance using kitchen-ec2,

It could successfully create EC2 instance. But after that it is getting into a loop like this,

```
_`-----> Starting Kitchen (v1.8.0)_
_-----> Creating <kitchen-logstash-ubuntu-1604>..._
_ Detected platform: ubuntu version 16.04 on x86_64. Instance Type: t2.micro. Default username: ubuntu (default)._
_ If you are not using an account that qualifies under the AWS_
_free-tier, you may be charged to run these suites. The charge_
_should be minimal, but neither Test Kitchen nor its maintainers_
_are responsible for your incurred costs._

   Instance <i-31f4e995> requested.
   Polling AWS for existence, attempt 0...
   Attempting to tag the instance, 0 retries
   EC2 instance <i-31f4e995> created.
   Waited 0/300s for instance <i-31f4e995> to become ready.
   Waited 5/300s for instance <i-31f4e995> to become ready.
   Waited 10/300s for instance <i-31f4e995> to become ready.
   Waited 15/300s for instance <i-31f4e995> to become ready.
   Waited 20/300s for instance <i-31f4e995> to become ready.
   Waited 25/300s for instance <i-31f4e995> to become ready.
   EC2 instance <i-31f4e995> ready.
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds
   Waiting for SSH service on 10.10.70.176:22, retrying in 3 seconds

```

`

The subnet in which EC2 instance runs is a private subnet. and its connected to internet through a NAT instance. And also that subnet is accessible from my work station through our VPN. I could manually ssh to the server easily. But test kitchen fails to SSH to it.

Helps would be appreciated.

---

<div class="post-metadata">

**Author:** ![kallistec](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/kallistec/32/23_2.png) [@kallistec](https://discourse.chef.io/u/kallistec)\
**Post date:** [July 26, 2016, 12:21am UTC](https://discourse.chef.io/t/kitchen-ec2-waiting-for-ssh-service-loop-error-ubuntu-image/9003/2 "2016-07-26T00:21:55Z")

</div>

> [@imewish](#):
>
> I could manually ssh to the server easily. But test kitchen fails to SSH to it.

Just guessing here, but do you have per-host configuration or anything in your SSH config? The ruby SSH library only understands some of the SSH config file.

---

<div class="post-metadata">

**Author:** ![imewish](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/imewish/32/1495_2.png) [@imewish](https://discourse.chef.io/u/imewish)\
**Post date:** [July 26, 2016, 4:52am UTC](https://discourse.chef.io/t/kitchen-ec2-waiting-for-ssh-service-loop-error-ubuntu-image/9003/3 "2016-07-26T04:52:34Z")

</div>

Hi @kallistec

i have tried removing my config(./ssh/config) file from my ssh directory and ran kitchen create. No luck. Same issue ☹

---

<div class="post-metadata">

**Author:** ![kallistec](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/kallistec/32/23_2.png) [@kallistec](https://discourse.chef.io/u/kallistec)\
**Post date:** [July 26, 2016, 5:03am UTC](https://discourse.chef.io/t/kitchen-ec2-waiting-for-ssh-service-loop-error-ubuntu-image/9003/4 "2016-07-26T05:03:08Z")

</div>

> [@imewish](#):
>
> i have tried removing my config(./ssh/config) file from my ssh directory and ran kitchen create. No luck.

Again, I'm just guessing since I can't find any clues in your logs. But my suspicion was that your manual `ssh` command worked correctly because of something in your ssh config, which you might need to apply in some way to kitchen. Can you ssh in manually with a default config?

---

<div class="post-metadata">

**Author:** ![imewish](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/imewish/32/1495_2.png) [@imewish](https://discourse.chef.io/u/imewish)\
**Post date:** [July 26, 2016, 5:46am UTC](https://discourse.chef.io/t/kitchen-ec2-waiting-for-ssh-service-loop-error-ubuntu-image/9003/5 "2016-07-26T05:46:43Z")

</div>

Manual SSH is nothing related with config. i just put this to manual ssh,

`ssh -i "sysadmin.pem" ubuntu@10.10.70.176`  
Here’s my kitchen.yml file here. Please chef if anything is wrong in it,

```
---
driver:
  name: ec2
  aws_ssh_key_id: sysadmin
  region: ap-south-1
  instance_type: t2.micro  
  security_group_ids: ["sg-xxxxx"]
  subnet_id: subnet-xxxxx
  require_chef_omnibus: true

transport:
  ssh_key: .ssh/sysadmin.pem
  

provisioner:
  name: chef_zero

platforms:
  - name: ubuntu-16.04
    image_id: ami-fbe83c98
  

suites:
  - name: default
    run_list:
      - recipe[my-elasticsearch::default]
    attributes:
      java:
        jdk_version: "8"
```

---

<div class="post-metadata">

**Author:** ![ameir](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@ameir](https://discourse.chef.io/u/ameir)\
**Post date:** [July 26, 2016, 6:02am UTC](https://discourse.chef.io/t/kitchen-ec2-waiting-for-ssh-service-loop-error-ubuntu-image/9003/6 "2016-07-26T06:02:33Z")

</div>

Try using the full path to your SSH key in your kitchen config. You can  
also specify the SSH user, although I don’t think that’s the problem.

---

<div class="post-metadata">

**Author:** ![imewish](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/imewish/32/1495_2.png) [@imewish](https://discourse.chef.io/u/imewish)\
**Post date:** [July 26, 2016, 6:37am UTC](https://discourse.chef.io/t/kitchen-ec2-waiting-for-ssh-service-loop-error-ubuntu-image/9003/7 "2016-07-26T06:37:12Z")

</div>

That worked 🙂 Thanks alot
