I've recently been moving our instances to EBS instances (CentOS) and still have a bit of confusion on what's happening when I "stop" and instance. I have some of my services with runlevels 345 on but when I start a stopped instance the services don't start. What's actually happening when I issue a stop command to the instance, and how do I get my services to start automatically when I start the instance up again?
Stopping an EBS-backed AMI is the same as shutting it down, and is not some kind of frozen hibernation state.
uptime
command. You'll see the server has only been up a short time.shutdown
command.Also:
After startup, check all the system logs in
/var/log
to look for any errors from attempts to start services, and execute thedmesg
command to see what happened on boot.Do you mean that you're putting the system files for your EC2 instances on persistent EBS volumes, rather than using the instance file system which goes away when you stop or restart the instance ?
If so, when you shut down an instance, the files on your EBS volume will be preserved but the files on the other file systems provided by the instance (these used to be / and /mnt, but I'm not sure what happens with an EBS instance) will disappear.
I'm guessing that your services don't start at boot time because they are dependent on files that aren't stored on the EBS volume. The service logs ought to help you debug the problem.
When you start an EBS-backed instance all of the installed services should start. I start/stop several instances (LAMP servers) every day and apache, mysql, and everything comes right up.
On a few occasions I did have to reboot the instance for a few services to come up. I attribute this to lag connecting to the EBS and therefore not able to reach the appropriate files in time.