Renaming a Chef Node
Chef Node Names
After spending enough time on EC2 with Chef, you'll probably end up with a few machines that you don't really want to wait out rebuilding, but that interrim name you picked while testing just doesn't make sense moving forward. Renaming a Chef node is not the most straightforward process. I've used the following steps to accomplish the renaming activity successfully.
1 knife node show [name] > node.txt
2 knife client delete [name]
3 knife node delete [name]
4 ssh [node]
5 rm /etc/chef/client.pem
6 sudo sed -i 's/[oldname]/[newname]/g' /etc/chef/client.rb
7 chef-client -N [newname]
8 exit
9 knife node edit [newname] # add run list back in from node.txt above