I am new to Chef and am evaluating it for future use at my company. Over the last week I have found a few useful tutorials to get me going. One in-particular is the EC2 Bootstrap guide which I’ve used with varied success.
I have followed the instructions from this and have successfully spun up a small ubuntu server using the following options in my knife.rb file
knife[:image] = 'ami-70f96e40’
knife[:user] = 'ubuntu’
knife[:availability_zone] = 'us-west-2b’
knife[:region] = 'us-west-2’
knife[:aws_access_key_id] = "secret"
knife[:aws_secret_access_key] = "secret"
knife[:aws_ssh_key_id] = "secret"
knife[:identity_file] = "/Users/jandrews/.ssh/secret.pem"
knife[:ssh_user] = “ubuntu”
Next I create a run list to install the apache2 cookbook since that is the web server I am most comfortable with. The run list looks good so I move to Step 6 of the tutorial which allows me to execute “chef-client” remotely for the node I spun up. The command it says to use is:
knife ssh name:NODENAME -x ubuntu “sudo chef-client” -a ec2.public_hostname
The “-a ec2.public_hostname” is suppose to tell knife to use the public hostname of the server since the FDQN is set to the internal ip address. The problem is that it does not work. I instead get the following error
“FATAL: 1 node found, but does not have the required attribute to establish the connection. Try setting another attribute to open the connection using --attribute.”
Googling has given me no useful information. I looked at the node attributes via the web browser on opscode.com and notice an ec2 node attributes with no value, and wonder if that’s suppose to be a json valued key/pair list.
So it seems either something is broken with knife-ec2 or I am missing something minor. I would really appreciate any insight anyone has on how to get this command to work.