For example, in a scenario where you have an auto-scaling group of size 1 that launches a spot instance which continually uses the same root EBS volume.
2 Answers
Not natively as far as I am aware, and not the root volume. You can however create a launch script to mount the volume as a secondary drive when the instance is spun up

- 201
- 1
- 1
-
Can you use pivot_root to remap the secondary volume as the root fs in the launch script? – Alex R Jul 23 '15 at 03:24
I don't think this can be done with autoscaling instances (the "cattle" service model).
But if you use a "pet" service model, you can now (since 2017) create a spot request and enable "Maintain target capacity" with "Interruption behavior: Stop" and a single availability zone. This way the root volume of the spot instance will be preserved even if it is temporarily interrupted.
I think (I did not check that) you can now convert a normal (pet-type) EC2 instance to a spot like this:
- create spot instance with some public AMI,
- stop the spot instance (possible since January 2020),
- detach root volume from spot instance,
- delete detached root volume,
- stop the normal instance,
- create snapshot of normal instance root volume, just in case,
- detach root volume from normal instance,
- attach root volume to spot instance,
- terminate normal instance,
- start spot instance.
There's also a script, ec2-spot-converter, that does something similar by creating a temporary AMI image:

- 2,679
- 4
- 26
- 32