Table of Contents

Class CfnAutoScalingGroup.MixedInstancesPolicyProperty

Namespace
Amazon.CDK.AWS.AutoScaling
Assembly
Amazon.CDK.AWS.AutoScaling.dll

Use this structure to launch multiple instance types and On-Demand Instances and Spot Instances within a single Auto Scaling group.

public class CfnAutoScalingGroup.MixedInstancesPolicyProperty : CfnAutoScalingGroup.IMixedInstancesPolicyProperty
Inheritance
CfnAutoScalingGroup.MixedInstancesPolicyProperty
Implements
Inherited Members

Examples

// The code below shows an example of how to instantiate this type.
             // The values are placeholders you should change.
             using Amazon.CDK.AWS.AutoScaling;

             var mixedInstancesPolicyProperty = new MixedInstancesPolicyProperty {
                 LaunchTemplate = new LaunchTemplateProperty {
                     LaunchTemplateSpecification = new LaunchTemplateSpecificationProperty {
                         Version = "version",

                         // the properties below are optional
                         LaunchTemplateId = "launchTemplateId",
                         LaunchTemplateName = "launchTemplateName"
                     },

                     // the properties below are optional
                     Overrides = new [] { new LaunchTemplateOverridesProperty {
                         InstanceRequirements = new InstanceRequirementsProperty {
                             AcceleratorCount = new AcceleratorCountRequestProperty {
                                 Max = 123,
                                 Min = 123
                             },
                             AcceleratorManufacturers = new [] { "acceleratorManufacturers" },
                             AcceleratorNames = new [] { "acceleratorNames" },
                             AcceleratorTotalMemoryMiB = new AcceleratorTotalMemoryMiBRequestProperty {
                                 Max = 123,
                                 Min = 123
                             },
                             AcceleratorTypes = new [] { "acceleratorTypes" },
                             AllowedInstanceTypes = new [] { "allowedInstanceTypes" },
                             BareMetal = "bareMetal",
                             BaselineEbsBandwidthMbps = new BaselineEbsBandwidthMbpsRequestProperty {
                                 Max = 123,
                                 Min = 123
                             },
                             BurstablePerformance = "burstablePerformance",
                             CpuManufacturers = new [] { "cpuManufacturers" },
                             ExcludedInstanceTypes = new [] { "excludedInstanceTypes" },
                             InstanceGenerations = new [] { "instanceGenerations" },
                             LocalStorage = "localStorage",
                             LocalStorageTypes = new [] { "localStorageTypes" },
                             MemoryGiBPerVCpu = new MemoryGiBPerVCpuRequestProperty {
                                 Max = 123,
                                 Min = 123
                             },
                             MemoryMiB = new MemoryMiBRequestProperty {
                                 Max = 123,
                                 Min = 123
                             },
                             NetworkBandwidthGbps = new NetworkBandwidthGbpsRequestProperty {
                                 Max = 123,
                                 Min = 123
                             },
                             NetworkInterfaceCount = new NetworkInterfaceCountRequestProperty {
                                 Max = 123,
                                 Min = 123
                             },
                             OnDemandMaxPricePercentageOverLowestPrice = 123,
                             RequireHibernateSupport = false,
                             SpotMaxPricePercentageOverLowestPrice = 123,
                             TotalLocalStorageGb = new TotalLocalStorageGBRequestProperty {
                                 Max = 123,
                                 Min = 123
                             },
                             VCpuCount = new VCpuCountRequestProperty {
                                 Max = 123,
                                 Min = 123
                             }
                         },
                         InstanceType = "instanceType",
                         LaunchTemplateSpecification = new LaunchTemplateSpecificationProperty {
                             Version = "version",

                             // the properties below are optional
                             LaunchTemplateId = "launchTemplateId",
                             LaunchTemplateName = "launchTemplateName"
                         },
                         WeightedCapacity = "weightedCapacity"
                     } }
                 },

                 // the properties below are optional
                 InstancesDistribution = new InstancesDistributionProperty {
                     OnDemandAllocationStrategy = "onDemandAllocationStrategy",
                     OnDemandBaseCapacity = 123,
                     OnDemandPercentageAboveBaseCapacity = 123,
                     SpotAllocationStrategy = "spotAllocationStrategy",
                     SpotInstancePools = 123,
                     SpotMaxPrice = "spotMaxPrice"
                 }
             };

Remarks

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:

    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.

    Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-as-group-mixedinstancespolicy.html

    ExampleMetadata: fixture=_generated

    Constructors

    MixedInstancesPolicyProperty()

    public MixedInstancesPolicyProperty()

    Properties

    InstancesDistribution

    The instances distribution.

    public object? InstancesDistribution { get; set; }

    Property Value

    object

    Remarks

    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.

    public object LaunchTemplate { get; set; }

    Property Value

    object

    Remarks