AWS::AutoScaling::AutoScalingGroup MixedInstancesPolicy
Use this structure to launch multiple instance types and On-Demand Instances and Spot Instances within a single Auto Scaling group.
A mixed instances policy contains information that Amazon EC2 Auto Scaling can use to launch instances and help optimize your costs. For more information, see Auto Scaling groups with multiple instance types and purchase options in the Amazon EC2 Auto Scaling User Guide.
You can create a mixed instances policy for new and existing Auto Scaling groups. You must use a launch template to configure the policy. You cannot use a launch configuration.
There are key differences between Spot Instances and On-Demand Instances:
-
The price for Spot Instances varies based on demand
-
Amazon EC2 can terminate an individual Spot Instance as the availability of, or price for, Spot Instances changes
When a Spot Instance is terminated, Amazon EC2 Auto Scaling group attempts to launch a replacement instance to maintain the desired capacity for the group.
MixedInstancesPolicy
is a property of the AWS::AutoScaling::AutoScalingGroup resource.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "InstancesDistribution" :
InstancesDistribution
, "LaunchTemplate" :LaunchTemplate
}
Properties
InstancesDistribution
-
The instances distribution.
Required: No
Type: InstancesDistribution
Update requires: Some interruptions
LaunchTemplate
-
One or more launch templates and the instance types (overrides) that are used to launch EC2 instances to fulfill On-Demand and Spot capacities.
Required: Yes
Type: LaunchTemplate
Update requires: Some interruptions