AWS EC2 Kitchen initialize issue - ssh key not found


#1

Hello all,

I followed the steps listed on the link but hit some issue preventing me from going forward…Not sure if you have encounter it or not.

My laptop environment is macOs with Chef latest version, I was planning to use EC2 instances for my test kitchen. however, while creating/converging the kitchen, it threw out errors showing the key pair doesn’t exist…
But in face, the files are in place and the configuration looks fine in .kitchen.yaml, I can also manually connect to the EC2 instances with the ssh_key pair…

please have a look and advise.Thanks.

jamson$ ls ~/.ssh/jamson.pem
/Users/jamson/.ssh/jamson.pem


driver:
name: ec2
aws_ssh_key_id: jamson
instance_type: t2.micro
retryable_tries: 120
provisioner:
name: chef_solo

transport:
ssh_key: ~/.ssh/jamson.pem

------Exception-------
Class: Kitchen::ActionFailed
Message: 1 actions failed.
Failed to complete #create action: [The key pair ‘jamson’ does not exist] on default-windows-2012r2

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


#2

The keypair it is referring to exists on the AWS EC2 side, every key-pair on EC2 has a name and that needs to match what is on the remote end.


#3

Thank you, I removed the key pair ‘aws_ssh_key_id: jamson’, it works.