test-kitchen / kitchen-ec2

A Test Kitchen Driver for Amazon EC2
Other
221 stars 202 forks source link

Cannot SSH into EC2 instance. #588

Open kevinaloys opened 2 years ago

kevinaloys commented 2 years ago

Brief Description

Kitchen EC2 driver is unable to SSH into EC2 instance.

Version

Chef Workstation version: 22.7.1006 Chef Habitat version: 1.6.420 Test Kitchen version: 3.3.1 Cookstyle version: 7.32.1 Chef Infra Client version: 17.10.0 Chef InSpec version: 4.56.20 Chef CLI version: 5.6.1

Environment

MacOS 12.5

Scenario

Used automated keypair generation & security group in the kitchen.yml file but apparently I'm able to manually SSH into the ec2 instance after retrieving the kitchen generated keypair via kitchen debug mode. But kitchen is unable to SSH into the instance. Tried this also by manually providing an SSH keypair but kitchen is unable to SSH, times-out waiting for the instance.

Steps to Reproduce

Regular EC2 SSH from kitchen seems to be not working.

Expected Result

Kitchen SSH into the ec2 instance to start kitchen convergence process.

Actual Result

-----> Starting Test Kitchen (v3.3.1) WARNING: Nokogiri was built against libxml version 2.9.4, but has dynamically loaded 2.9.13 -----> Creating ... 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.

   Created automatic security group sg-07e90946be11a7b1c
   Created automatic key pair kitchen-defaultal2022-root-KevinsMacBookPro2loca-2022-08-09T06:12:17Z-sx7x46v3
   Instance <i-08cd1c46fae0fbfd7> requested.
   Polling AWS for existence, attempt 0...
   Polling AWS for existence, attempt 1...
   EC2 instance <i-08cd1c46fae0fbfd7> created.
   Waited 0/300s for instance <i-08cd1c46fae0fbfd7> to become ready.
   Waited 5/300s for instance <i-08cd1c46fae0fbfd7> to become ready.
   Waited 10/300s for instance <i-08cd1c46fae0fbfd7> to become ready.
   EC2 instance <i-08cd1c46fae0fbfd7> ready (hostname: ec2-54-161-191-150.compute-1.amazonaws.com).
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
   Waiting for SSH service on ec2-54-161-191-150.compute-1.amazonaws.com:22, retrying in 3 seconds
vkarve-chef commented 2 years ago

@kevinaloys can you please share the kitchen.yml (with credentials masked) that you used here?