I was playing around with CloudFormation from Amazon Web Services (AWS) tonight (blog posts coming soon™) and remembered an issue we regularly have at work with our Windows Servers; whenever we create a new image from an AMI the machine restarts after it’s created.
Now ordinarily this wouldn’t be a problem, but our application deployment tool, embedded in the AMI, starts to pull down the applications for the server as soon as it starts but before it restarts. This effectively means we have some apps installed correctly and, more often than not, some broken, which entails manually fixing the server and to me that’s too much hard work because I’m lazy. When I spin up something that should do a bunch of stuff automatically I expect it to work so I can be doing other stuff.
Anyway, I digress.
I started digging into the EC2 documentation for Windows Servers and, more specifically, how to properly image a machine. Turns out there’s a whole process and we should have been SysPrepping our machines before imaging. Now this in its self is not the cause of our servers randomly restarting, oh no. It turns out that by default the option in the EC2 Config Service (found in “All Programs”) to name a machine is set to auto name the machine after initial start up. This in turn causes the machine to restart, as happens when you rename a machine in Windows.
So what is the solution? Disable that option and set a nice pretty machine name in the Windows System settings. Now I’ve tested this yet. That will be my project at work tomorrow…