My Spot Instance was terminated. Can I recover it?
Last updated: 2022-08-12
I had an Amazon Elastic Compute Cloud (Amazon EC2) Spot Instance running, but the instance was terminated, and I'm concerned I might have lost data. Are there ways to recover my instance or the data stored on that instance?
With Amazon EC2 Spot Instance, you can request unused Amazon EC2 instances to reduce your compute costs.
The Spot Instance can be terminated if:
- The Spot price increases above the maximum price that you're willing to pay per hour per instance
- Capacity is no longer available
- The Spot request has constraints that can't be met
For details about the reasons a Spot Instance can be interrupted, see How Spot Instances work. Data that isn't backed up can be lost when instances are terminated, so it's important to be sure that for this use case. See Product details for a list of best-suited use cases and workload types.
If you have a Spot Instance that was recently terminated or interrupted, and you're concerned that data might have been lost, here are some places to check for your data:
- Did you configure your Spot Instances to leave Amazon EBS volumes behind if the instance is terminated? By configuring the Spot Instance to leave Amazon EBS volumes behind if the instance is terminated, you can attach the volume to another instance and attempt to recover data stored on the volume. When creating a Spot Instance request, clear the Delete check box for Amazon EBS volumes that you want to be kept if the instance is terminated. If you attached a volume to your Spot Instance before it was terminated or interrupted, then the data you're looking for might be stored on the volume. Open the Amazon EC2 Console, and then select Volumes. Look for any unattached volumes that have a State of available. These volumes can be attached to another instance. For instructions on attaching a volume to a new instance, see Attach an Amazon EBS volume to an instance.
- Did you take regular snapshots of any volumes attached to your Spot Instance? Snapshots that are normally used as backups for Amazon EBS volumes might contain the data you're looking for. Open the Amazon EC2 Console, and then select Snapshots. Look for any snapshots of volumes that were attached to your Spot Instance. For more information, see Replace an Amazon EBS volume.
- Was the data added or backed up to another source? Common output sources for workflows that run through Spot Instances include Amazon Simple Storage Service (Amazon S3), Amazon DynamoDB, and Amazon Relational Database Service (Amazon RDS). If you set your Spot Instance to send output to one of these services, check those services for the data you're looking for.
For future planning, it's a best practice to prepare for a Spot Instance's termination ahead of time. For example, you can specify Amazon EC2 to stop or hibernate your Spot Instances rather than terminate them when they are interrupted. For more information about how to effectively prepare for a Spot Instance's eventual termination, see Spot Instance interruptions.