Amazon Elastic Compute Cloud
User Guide (API Version 2013-02-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Using CloudFormation Templates to Launch Spot Instances

You can use AWS CloudFormation templates to launch Spot Instances and the AWS resources you need for an application. Templates are text files describing a collection, called stack, of AWS resources that you want to deploy as a group. For more information about AWS CloudFormation templates, see Learn Template Basics. For more information about using AWS CloudFormation, see the AWS CloudFormation User Guide.

You can write your own template from scratch, or you can use one of the example templates from the AWS CloudFormation Sample Template Library. The following templates in AWS CloudFormation utilize Spot Instances:

  • Asynchronous Queue-Based Processing

    This template creates an auto-scaled worker that monitors work (messages) in a queue. The application is auto-scaled based on the amount of work in the queue. When there is work, Auto Scaling scales up; when there is no work, Auto Scaling scales down. Each message contains a command/script to run, an input file location, and an output location for the results.

    To download this template, go to Asynchronous Queue-Based Processing.

  • Bees with Machine Guns

    This template creates a load balancer, a controller, and the instances behind the load balancer; fires up and riggers an attack; and stores logs on Amazon Simple Storage Service (Amazon S3) and then shuts down (if enabled). For this template, instances use the Amazon Linux AMI, and the setup requires that you already have an AWS Identity and Access Management (IAM) SSL certification. You can modify this template to remove the SSL dependencies.

    Note

    To launch this template, you need a new SSH private key that you create specifically for this task. You'll have to log in to the instance created by the template and provide this private key information.

    To download this template, go to Bees with Machine Guns.

  • Grid Computing for Spot Instances

    This template uses Star Cluster to launch and bootstrap a cluster of Amazon EC2 instances for high performance computational tasks using Spot pricing. You only need to provide the number of instances, instance size, and Spot price that you want to use.

    To download this template, go to Grid Computing for Spot Instances.

You can create stacks from these templates by using the AWS Management Console, the AWS CloudFormation command line tools, or the AWS CloudFormation API.

Before you use these templates, you must:

  1. Have an AWS account and sign up for AWS CloudFormation.

  2. Decide on the template to use.

  3. Enter the parameters required for the stack.

  4. Create the stack.

To get started with AWS CloudFormation, Getting Started with AWS CloudFormation.

For more information about using AWS CloudFormation, see the AWS CloudFormation User Guide.