Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSH access failing to EC2 instance through kitchen (Windows) #580

Closed
Jetwash1 opened this issue Feb 17, 2022 · 1 comment
Closed

SSH access failing to EC2 instance through kitchen (Windows) #580

Jetwash1 opened this issue Feb 17, 2022 · 1 comment

Comments

@Jetwash1
Copy link

Hello there, thanks for taking the time to read. When creating an EC2 instance via kitchen, I cannot SSH into the host. I'd like to try and manually SSH into the host but have yet to find the code for not destroying an instance upon failure. This is similar to #398.

Also, I have followed the prescribed solution here but to no avail. - net-ssh/net-ssh#565

Software versions:
OS: Windows 10
Chef Infra Client version: 17.9.26
Chef InSpec version: 4.52.9
Chef CLI version: 5.5.6
Chef Habitat version: 1.6.420
Test Kitchen version: 3.2.2
kitchen-ec2 (3.12.0)
aws-cli/2.4.16 Python/3.8.8 Windows/10 exe/AMD64 prompt/off

Gems:
ed25519 (1.3.0)
bcrypt_pbkdf (1.1.0 x64-mingw32)
berkshelf (7.2.2)

.kitchen.yml:

driver:
name: ec2
iam_profile_name:
security_group_ids:
subnet_id:
region: us-west-2
availability_zone: us-west-2b
instance_type: t1.micro
associate_public_ip: false
shared_credentials_profile: <%= ENV['AWS_PROFILE'] %>
instance_initiated_shutdown_behavior: terminate
block_duration_minutes: 60
aws_ssh_key_id: -sshkey

provisioner:
name: chef_zero
use_policyfile: false
client_rb:
chef_license: accept
product_version: 16

transport:
connection_timeout: 10
connection_retries: 5

verifier:
name: inspec

platforms:

  • name: amaz2
    driver:
    image_id: ami-0496b6c315bfe234c
    user_data: ./instance_user_script_amaz2.sh
    tags: {"Name": ""}
    transport:
    username: ec2-user
    ssh_key: C:\Users<user>.aws<user>-sshkey.pem

suites:

  • name: cloud
    run_list:

    - recipe[createdir-ec2::default]

    verifier:
    inspec_tests:

    • test/integration/default

kitchen converge output:
createdir-ec2> kitchen converge
-----> Starting Test Kitchen (v3.2.2)
-----> 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.

   Instance <i-0f9c8eda1819e6e06> requested.
   Polling AWS for existence, attempt 0...
   EC2 instance <i-0f9c8eda1819e6e06> created.
   Waited 0/300s for instance <i-0f9c8eda1819e6e06> to become ready.
   Waited 5/300s for instance <i-0f9c8eda1819e6e06> to become ready.
   Waited 10/300s for instance <i-0f9c8eda1819e6e06> to become ready.
   Waited 15/300s for instance <i-0f9c8eda1819e6e06> to become ready.
   Waited 20/300s for instance <i-0f9c8eda1819e6e06> to become ready.
   Waited 25/300s for instance <i-0f9c8eda1819e6e06> to become ready.
   Waited 30/300s for instance <i-0f9c8eda1819e6e06> to become ready.
   Waited 35/300s for instance <i-0f9c8eda1819e6e06> to become ready.
   Waited 40/300s for instance <i-0f9c8eda1819e6e06> to become ready.
   EC2 instance <i-0f9c8eda1819e6e06> ready (hostname: 172.18.39.94).
   Waiting for SSH service on 172.18.39.94:22, retrying in 3 seconds
   EC2 instance <i-0f9c8eda1819e6e06> destroyed.

------Exception-------
Class: Kitchen::ActionFailed
Message: 1 actions failed.
Failed to complete #create action: [OpenSSH keys only supported if ED25519 is available
net-ssh requires the following gems for ed25519 support:


Please see .kitchen/logs/kitchen.log for more details
Also try running kitchen diagnose --all for configuration

@Jetwash1
Copy link
Author

Update:
I was able to resolve the issue by first uninstalling Ubuntu WSL and chef workstation. Reinstalling chef workstation and leaving out the key settings under 'Driver' and 'Transport' as mentioned in issue #398.

Though, this does seem to meet bug criteria, as I'd like to be able to specify my own key. Regardless, it works within reasonable security guidelines.

-thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant