My Spot Instance was terminated. Can I recover it?

3 minute read
0

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.

Short description

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 aware of that for this use case. See Product features for a list of best-suited use cases and workload types.

Resolution

If you have a Spot Instance that was recently terminated or interrupted, you might have a concern that your data has 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? You can configure the Spot Instance to leave Amazon EBS volumes behind if the instance is terminated. Then, you can attach the volume to another instance and attempt to recover data stored on the volume. When creating Spot Instance requests, 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, 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 a volume using a previous snapshot.
  • 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.


Related information

Amazon EC2 Spot Instances

Amazon EC2 FAQ

AWS OFFICIAL
AWS OFFICIALUpdated a year ago