Search code examples
amazon-ec2papertrail-app

Set computer name when starting an instance


I'm using a windows AMI to start an instance that is hosting a java application. I'm using papertrail for logging which uses the name of the computer to display the system associated with a log stream. Right now computer's name is an auto-generated value, but I want to give it a specific value. How can I do this?

Setting the name on the AMI is not an option since I'm using the same AMI to launch a number of instances that all must have different computer names.

Conclusion

In the end, since my main concern was to change the name for papertrail's sake, I can do that via http://help.papertrailapp.com/kb/configuration/java-logback-logging/ Thank you all for your help


Solution

  • Try this. First disable the "Set Computer name" option. More details here http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/UsingConfig_WinAMI.html (Look for "To change settings using the Ec2 Service Properties dialog box" section).

    Then configure the AMI to rename the instance.

    http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#user-data-execution

    If you want different names for the computer, then use a shell script to generate the computer name.