I've got a fairly simple Windows service running on testbed EC2 nodes right now that basically:
- Calls a Web Service on a machine in our local data center when the service starts (the service is set to Automatic startup, so it runs when the instance comes online).
- Calls another Web Service once a minute as a monitoring heartbeat.
- Calls a third Web Service when the service stops.
We're using this in our Linux EC2 instances perfectly fine, and the Windows service works fine on startup, heartbeat, and manual stoppage.
The problem is that when terminating the node via ElasticFox, Rightscale, etc. the service never seems to be stopped, or at least, it never makes the Web Service call. Any thoughts?
[Note that this is copied verbatim from my post on the AWS developer forums, but that is super-low traffic compared to SO. Apologies!]
Edit: Regarding the point about the network going down, I'm also not the most well-versed in Windows services, if I set Netman as a service dependency, would the order of service termination be guaranteed to respect that?
Regarding EBS, the model we've adopted for a similar system running on plain ol' Linux instances treats app servers as ephemeral, so EBS wouldn't benefit us that much. We use Rightscale on top of EC2, which makes hooking into Linux instances shutting down, so we just ship off the instance's logs elsewhere.
Edit #2: Well, I got a reply from the AWS staff much faster than I expected:
For windows, terminating through API (which means through elasticfox ,rightscale etc.) is a hard shutdown due to some technical limitations. It means it is like turning off your machine with power button instead of shutdown.
Interesting..