Thursday, December 6, 2007

EC2 and Rebooting

I've heard that you can reboot EC2 hosts and you don't loose your data. I have an EC2 I'm about to shut down, so I figured I'd play around with it.

Test I - Simple Reboot


On the command line, I issued reboot. That's it.

After a minute, I was able to log back in. Data in /mnt is still intact. Files that were modified in / from the base image are also intact. Servers that were supposed to start up did. Excellent!

Test II - ec2-reboot-instances


Using my laptop's copy of the ec2 utilities, I ran ec2-reboot-instances .

Same deal -- when I got back into the instance, everything was where it should be.

Test III - init 1 and ec2-reboot-instances


I ran init 1 to go to single user mode. I should have been hooped, right? About three seconds after init 1, I could no longer contact the box.

I issued ec2-reboot-instances again, and it came back to life.

I don't have a way off hand of simulating a hard crash, so I'm going to assume that I would be able to rescue a kernel panic with ec2-reboot-instances. If someone knows of a way to crash a CentOS 5 image, I'll gladly give it a try.

Test IV - shutdown -h now


I figured this would terminate the instance.

After running shutdown -h now, it became unreachable right away. I was watching ec2din, and it hung around for a bit. I was hopeful I'd be able to bring it back.

But, alas, after a minute or so, it showed up as terminated.

I suppose the lesson here is that you can indeed reboot instances and probably recover from crashes, but don't run shutdown -h now without meaning it.

No comments: