Interface CfnAutoScalingGroupPropsMixin.MixedInstancesPolicyProperty
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
CfnAutoScalingGroupPropsMixin.MixedInstancesPolicyProperty.Jsii$Proxy
- Enclosing class:
CfnAutoScalingGroupPropsMixin
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.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.cfnpropertymixins.services.autoscaling.*;
MixedInstancesPolicyProperty mixedInstancesPolicyProperty = MixedInstancesPolicyProperty.builder()
.instancesDistribution(InstancesDistributionProperty.builder()
.onDemandAllocationStrategy("onDemandAllocationStrategy")
.onDemandBaseCapacity(123)
.onDemandPercentageAboveBaseCapacity(123)
.spotAllocationStrategy("spotAllocationStrategy")
.spotInstancePools(123)
.spotMaxPrice("spotMaxPrice")
.build())
.launchTemplate(LaunchTemplateProperty.builder()
.launchTemplateSpecification(LaunchTemplateSpecificationProperty.builder()
.launchTemplateId("launchTemplateId")
.launchTemplateName("launchTemplateName")
.version("version")
.build())
.overrides(List.of(LaunchTemplateOverridesProperty.builder()
.imageId("imageId")
.instanceRequirements(InstanceRequirementsProperty.builder()
.acceleratorCount(AcceleratorCountRequestProperty.builder()
.max(123)
.min(123)
.build())
.acceleratorManufacturers(List.of("acceleratorManufacturers"))
.acceleratorNames(List.of("acceleratorNames"))
.acceleratorTotalMemoryMiB(AcceleratorTotalMemoryMiBRequestProperty.builder()
.max(123)
.min(123)
.build())
.acceleratorTypes(List.of("acceleratorTypes"))
.allowedInstanceTypes(List.of("allowedInstanceTypes"))
.bareMetal("bareMetal")
.baselineEbsBandwidthMbps(BaselineEbsBandwidthMbpsRequestProperty.builder()
.max(123)
.min(123)
.build())
.baselinePerformanceFactors(BaselinePerformanceFactorsRequestProperty.builder()
.cpu(CpuPerformanceFactorRequestProperty.builder()
.references(List.of(PerformanceFactorReferenceRequestProperty.builder()
.instanceFamily("instanceFamily")
.build()))
.build())
.build())
.burstablePerformance("burstablePerformance")
.cpuManufacturers(List.of("cpuManufacturers"))
.excludedInstanceTypes(List.of("excludedInstanceTypes"))
.instanceGenerations(List.of("instanceGenerations"))
.localStorage("localStorage")
.localStorageTypes(List.of("localStorageTypes"))
.maxSpotPriceAsPercentageOfOptimalOnDemandPrice(123)
.memoryGiBPerVCpu(MemoryGiBPerVCpuRequestProperty.builder()
.max(123)
.min(123)
.build())
.memoryMiB(MemoryMiBRequestProperty.builder()
.max(123)
.min(123)
.build())
.networkBandwidthGbps(NetworkBandwidthGbpsRequestProperty.builder()
.max(123)
.min(123)
.build())
.networkInterfaceCount(NetworkInterfaceCountRequestProperty.builder()
.max(123)
.min(123)
.build())
.onDemandMaxPricePercentageOverLowestPrice(123)
.requireHibernateSupport(false)
.spotMaxPricePercentageOverLowestPrice(123)
.totalLocalStorageGb(TotalLocalStorageGBRequestProperty.builder()
.max(123)
.min(123)
.build())
.vCpuCount(VCpuCountRequestProperty.builder()
.max(123)
.min(123)
.build())
.build())
.instanceType("instanceType")
.launchTemplateSpecification(LaunchTemplateSpecificationProperty.builder()
.launchTemplateId("launchTemplateId")
.launchTemplateName("launchTemplateName")
.version("version")
.build())
.weightedCapacity("weightedCapacity")
.build()))
.build())
.build();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classstatic final classAn implementation forCfnAutoScalingGroupPropsMixin.MixedInstancesPolicyProperty -
Method Summary
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getInstancesDistribution
The instances distribution.Returns union: either
IResolvableorCfnAutoScalingGroupPropsMixin.InstancesDistributionProperty- See Also:
-
getLaunchTemplate
One or more launch templates and the instance types (overrides) that are used to launch EC2 instances to fulfill On-Demand and Spot capacities.Returns union: either
IResolvableorCfnAutoScalingGroupPropsMixin.LaunchTemplateProperty- See Also:
-
builder
@Stability(Stable) static CfnAutoScalingGroupPropsMixin.MixedInstancesPolicyProperty.Builder builder()
-