I am new to Puppet and I'm trying to get Puppet to configure my EC2 instances after they're started from a Cloud Formation Template in AWS. The problem is that all the nodes that get started from the Cloud Formation Template all have the same name (the name from the AMI that the new nodes derive from).

I would love to find a way to have puppet rename the nodes when the nodes start up. (although, as far as I know, a Computer Name change requires reboot, a separate issue...)

If you can point me to some documentation that can help me figure this out or if you have any ideas that would be great. My ultimate goal is to have each EC2 start with a unique name so that I can use New Relic server monitoring to report the different servers.

I ultimately need to achieve this for Linux and Windows Server 2008 R2, but I think I've already gotten the Linux side figured out.

I spoke with New Relic about the issue and they confirmed that there is no way in New Relic currently to report with something other than the machine name. So approaching the problem from the New Relic side isn't an option just yet.
I also want to avoid having to change the machine name after the machine is created because I don't want to reboot the machine after it spins up.
My ideal option would be to have Cloud Formation be able to generate the new EC2 instances from the AMI, but use a specific machine name during creation (like set the machine name to the instance Id or something).

  • When in doubt, you can always use an Exec. A search for command line windows change computer name returned stackoverflow.com/questions/54989/… – Zoredache Oct 24 '12 at 18:41
  • Yeah, I thought about simply adding an exec for changing the machine name on the node when it's being configured by puppet, but unfortunately changing the machine name in windows requires a system reboot and I'm trying to prevent rebooting my systems just to install new relic. – David Sulpy Oct 25 '12 at 15:27

For new relic, you just need to change your hostname as that is the identifier they use. Hostname changes do not require any restart, not at least for Linux. You can do following in puppet exec:

hostname `ifconfig eth0|grep "inet addr"| awk -F ":" '{print $2}'|awk '{print $1}'`

This will set your hostname as IP address and newrelic can use this as identifier. It would be easier for you too to diagnose issues as they will be shown against IP address of the machine.

  • thanks for the answer, I guess I should update my question to specify that I am trying to do this both for Linux nodes and Windows Server 2008 R2 nodes. – David Sulpy Oct 23 '12 at 14:18

EC2 will start with a unique name if the AMI that's starting it has been configured to set the Computer Name to the ip- in the EC2 Config Service.

See this: http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/UsingConfig_WinAMI.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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