Giter Club home page Giter Club logo

Comments (13)

zpatten avatar zpatten commented on September 27, 2024

your identity file and client key should have the same value, also your aws_ssh_key_id should be the filename minus the extension of your pem:

client_key                    "#{ENV['HOME']}/.chef/#{user}.pem"
knife[:aws_ssh_key_id]        = user
knife[:identity_file]         = "#{ENV['HOME']}/.chef/#{user}.pem"

from cucumber-chef.

glenndavy avatar glenndavy commented on September 27, 2024

Thanks for replying zpatten

ok I'm a bit confused at this point, my client key is for the opscode account and the pem file downloaded there, the knife[:identity_file] and knife[:aws_ssh_key_id] file deal with the amazon account and the pem file down loaded there. Is that not right? I don't follow why they'd be the same.

from cucumber-chef.

zpatten avatar zpatten commented on September 27, 2024

Correction: Sorry in my hasty response I posted incorrect information; aws_ssh_key_id should be the name of the key pair you created in your AWS zone minus the '.pem'; set this in the AWS_SSH_KEY_ID environment variable.

If you named your AWS key pair 'cucumber-chef-us-east-1.pem' then for example:
Put your AWS key pair in your home '.chef' directory, for example: '~/.chef/cucumber-chef-us-east-1.pem'

Make sure you export the details and add the keypair to your ssh-agent via your '.bash_profile' for example:

export AWS_SSH_KEY_ID='cucumber-chef-us-east-1'
ssh-add ~/.chef/cucumber-chef-us-east-1.pem

Make sure you change your knife config to use the environment variable:

knife[:aws_ssh_key_id] = ENV['AWS_SSH_KEY_ID']

from cucumber-chef.

glenndavy avatar glenndavy commented on September 27, 2024

hey zpatten
No worries, and thanks.. so
this:
" aws_ssh_key_id should be the name of the key pair you created in your AWS zone minus the '.pem'"
is already the case.

this isn't:
"set this in the AWS_SSH_KEY_ID environment variable."

nor this:
"Put your AWS key pair in your home '.chef' directory, for example: '~/.chef/cucumber-chef-us-east-1.pem'"

I'll try each of these separately and see how it goes.
Thanks

from cucumber-chef.

glenndavy avatar glenndavy commented on September 27, 2024

Ok, so having set aws_ssh_key_id in bash:

env |grep AWS                                                                                      
AWS_SSH_KEY_ID=tdd-eg                                                                                                        
AWS_SECRET_ACCESS_KEY=xxxx                              
AWS_ACCESS_KEY_ID=yyyy

Added the key to the agent:

ssh-add -l  |grep tdd
2048 b3:d7:65:da:f4:b1:f3:de:00:fd:e5:1e:0f:ab:e0:d8 /Users/glenn/.chef/tdd-eg.pem (RSA)

relocated the key file to ~/.chef and picking key id up from env:

knife[:identity_file]         = "/Users/glenn/.chef/tdd-eg.pem"  
knife[:aws_ssh_key_id]  = ENV['AWS_SSH_KEY_ID']  

It still seems a smell to me that the failure occurs while trying to use a private key that is part of the cucumber-chef repo. Just for kicks i changed region to ireland as thats the one the book uses and used the ami quoted in the source code jic there is some majik baked in, but alas still hitting same issue.

keen to hear any other thoughts.

from cucumber-chef.

zpatten avatar zpatten commented on September 27, 2024

So the key pair is tied to the region you created it in; when you look at the instance in AWS; does it show 'tdd-eg' in the "Key Pair Name" for the instance cucumber-chef has created?

from cucumber-chef.

glenndavy avatar glenndavy commented on September 27, 2024

correct, it does. I can also login using ssh -i ~/.chef/tdd-eg.pem ubuntu@...

from cucumber-chef.

zpatten avatar zpatten commented on September 27, 2024

I'm at a loss; mine repo is working; but I've re-written about half of this code at this point; I'm in the process of getting everything up in my repo; if you want to give my code a try once I've got it in place (should be a day or two). I've found a pile of issues and bugs that i've fixed; so at this point my version has diverged pretty far from this.

from cucumber-chef.

zpatten avatar zpatten commented on September 27, 2024

Just as a stab in the dark; make sure you check the user:group and perms of all the files involved.

from cucumber-chef.

glenndavy avatar glenndavy commented on September 27, 2024

re perms, good call, but already checked.

re using divergent code; yeah no hurry, happy to wait.

from cucumber-chef.

Atalanta avatar Atalanta commented on September 27, 2024

OK - we have an RC now. Test ALL THE THINGS. You are teh winner.

from cucumber-chef.

glenndavy avatar glenndavy commented on September 27, 2024

Hey thanks for all you're help, just revisited this.. all is good now.

from cucumber-chef.

zpatten avatar zpatten commented on September 27, 2024

Awesome, good to hear; thanks for the feedback!

from cucumber-chef.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.