I'm running different versions of an economic model (in C++) on Amazon's EC2* that take between 30 mins. and three weeks to run. I want to switch to spot instances to save money. Is there a way to periodically save the system state to a file stored on my EBS volume and restore from that file after restarting a terminated spot instance? If there is a C++ solution, that would be best. I know that people normally get "persistent" spot instances by periodically saving their program's output and structuring the program so that it can pick up where it left off, but is the "system state" approach possible? I'm much more of an economist than a programmer and an Ubuntu novice.
Notes: *I am using the starCluster Ubuntu AMIs (ami-3393a45a ubuntu-13.04-x86_64 EBS backed currently) and the c3.Large instances in the us-east availability zones. The algorithm is much more CPU intensive than memory intensive. Each program uses and creates less than 16KB of data but uses around 100% of the CPU (from the top command). The algorithm involves solving an economic model repeatedly until the optional behaviour converges. I plan on using the same starCluster config for all versions of my program.