Interface IMixedInstancesPolicy
- Namespace
- Amazon.CDK.AWS.AutoScaling
- Assembly
- Amazon.CDK.AWS.AutoScaling.dll
MixedInstancesPolicy allows you to configure a group that diversifies across On-Demand Instances and Spot Instances of multiple instance types.
public interface IMixedInstancesPolicy
Examples
Vpc vpc;
LaunchTemplate launchTemplate1;
LaunchTemplate launchTemplate2;
new AutoScalingGroup(this, "ASG", new AutoScalingGroupProps {
Vpc = vpc,
MixedInstancesPolicy = new MixedInstancesPolicy {
InstancesDistribution = new InstancesDistribution {
OnDemandPercentageAboveBaseCapacity = 50
},
LaunchTemplate = launchTemplate1,
LaunchTemplateOverrides = new [] { new LaunchTemplateOverrides { InstanceType = new InstanceType("t3.micro") }, new LaunchTemplateOverrides { InstanceType = new InstanceType("t3a.micro") }, new LaunchTemplateOverrides { InstanceType = new InstanceType("t4g.micro"), LaunchTemplate = launchTemplate2 } }
}
});
Remarks
For more information, see Auto Scaling groups with multiple instance types and purchase options in the Amazon EC2 Auto Scaling User Guide:
https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-purchase-options.html
ExampleMetadata: infused
Properties
InstancesDistribution
InstancesDistribution to use.
IInstancesDistribution? InstancesDistribution { get; }
Property Value
Remarks
Default: - The value for each property in it uses a default value.
LaunchTemplate
Launch template to use.
ILaunchTemplate LaunchTemplate { get; }
Property Value
- ILaunchTemplate
LaunchTemplateOverrides
Launch template overrides.
ILaunchTemplateOverrides[]? LaunchTemplateOverrides { get; }
Property Value
Remarks
The maximum number of instance types that can be associated with an Auto Scaling group is 40.
The maximum number of distinct launch templates you can define for an Auto Scaling group is 20.
Default: - Do not provide any overrides