How to Launch Spot Instances - Overview of Amazon EC2 Spot Instances

How to Launch Spot Instances

The most recommended service for launching Spot Instances is Amazon EC2 Auto Scaling because it enables you to launch and maintain a desired capacity, and to automatically request resources to replace any that are disrupted or manually terminated. When you configure an Auto Scaling group, you only need to specify the instance types and desired capacity based on your application needs. For more information, see Auto Scaling groups in the Amazon EC2 Auto Scaling User Guide.

If you require more flexibility, have built your own instance launch workflows, or want to control individual aspects of the instance launches or the scaling mechanisms, we recommend that you evaluate the use of EC2 Fleet in Instant mode as an alternative to EC2 Auto Scaling. This synchronous API allows you to specify a list of instance types and launch requirements, and provides more flexible capability than the EC2 RunInstances API call for launching Spot Instances or On-Demand Instances.

When you use AWS services for running your cloud workloads, you can also use them for launching Spot Instances. Examples include Amazon EMR, Amazon EKS, Amazon ECS, AWS Batch, and AWS Elastic Beanstalk. You can also launch Spot Instances by using third-party tools that integrate with the AWS cloud.

You can automate Spot Instance launches by using infrastructure as code tools (AWS CloudFormation, AWS CDK), or the AWS API, CLI, or SDKs. Spot Blueprints provides a guided wizard that enables you to generate infrastructure as code templates for AWS Cloudformation and Hashicorp terraform that adhere to Spot best practices.