2

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.

1
  • 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. Oct 8, 2013 at 20:27

2 Answers 2

3

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.

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .