Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've been thrown into the deep end of Chef this past week, and I'm stuck on one thing at the moment. I've created an instance in AWS (many times at this point) and when chef kicks in to do its thing I get an compilation error. Fine, I'll figure out what's up and then reapply.

My question: How can I update an existing instance? I can use $ knife ec2 server create [coptions] but is there a corresponding update command? My brain wants to execute something like $ knife ec2 server update [AWS instance ID] -x userXXX -r 'recipe[yyy::zzzz]' I don't see update as an option so is there anything similar?

I don't want to keep creating and terminating instances while I troubleshoot what is going on with the recipe, I would rather apply changes to an existing instance.

share|improve this question
1  
You can use knife to modify the run_list for the node (e.g. 'knife node edit <node_name>', and then run the chef-client from the system. Alternatively if you've got the client running as a daemon or automatically driven by cron, you just update the run_list and then wait and let the chef client do it for you. –  Joshua Miller Oct 8 '13 at 20:27
add comment

2 Answers 2

up vote 2 down vote accepted

Try knife solo which allows you to update remote server with chef-solo (not chef-client) like:

knife solo cook ec2-user@your-node-fqdn -o "your-run-list"

In the context of chef server, you're not update the remote ec2 server, instead, you just update the node object of your ec2 server, and chef-client will sync your changes when it starts. So you just need to update your node/role/environment via knife.

share|improve this answer
add comment

If Chef is bootstrapped successfully on the server, run

knife ssh -m [server-id] chef-client

http://docs.opscode.com/knife_ssh.html

With EC2, the server-id is the instance id assigned by AWS.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.