Interface CfnAutoScalingGroup.InstanceRequirementsProperty

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
CfnAutoScalingGroup.InstanceRequirementsProperty.Jsii$Proxy
Enclosing class:
CfnAutoScalingGroup

@Stability(Stable) public static interface CfnAutoScalingGroup.InstanceRequirementsProperty extends software.amazon.jsii.JsiiSerializable
The attributes for the instance types for a mixed instances policy.

Amazon EC2 Auto Scaling uses your specified requirements to identify instance types. Then, it uses your On-Demand and Spot allocation strategies to launch instances from these instance types.

When you specify multiple attributes, you get instance types that satisfy all of the specified attributes. If you specify multiple values for an attribute, you get instance types that satisfy any of the specified values.

To limit the list of instance types from which Amazon EC2 Auto Scaling can identify matching instance types, you can use one of the following parameters, but not both in the same request:

  • AllowedInstanceTypes - The instance types to include in the list. All other instance types are ignored, even if they match your specified attributes.
  • ExcludedInstanceTypes - The instance types to exclude from the list, even if they match your specified attributes.

You must specify VCpuCount and MemoryMiB . All other attributes are optional. Any unspecified optional attribute is set to its default.

For an example template, see Configure Amazon EC2 Auto Scaling resources .

For more information, see Creating an Auto Scaling group using attribute-based instance type selection in the Amazon EC2 Auto Scaling User Guide . For help determining which instance types match your attributes before you apply them to your Auto Scaling group, see Preview instance types with specified attributes in the Amazon EC2 User Guide for Linux Instances .

InstanceRequirements is a property of the LaunchTemplateOverrides property of the AWS::AutoScaling::AutoScalingGroup LaunchTemplate property type.

Example:

 Vpc vpc;
 LaunchTemplate launchTemplate1;
 AutoScalingGroup.Builder.create(this, "ASG")
         .vpc(vpc)
         .mixedInstancesPolicy(MixedInstancesPolicy.builder()
                 .launchTemplate(launchTemplate1)
                 .launchTemplateOverrides(List.of(LaunchTemplateOverrides.builder()
                         .instanceRequirements(InstanceRequirementsProperty.builder()
                                 .vCpuCount(VCpuCountRequestProperty.builder().min(4).max(8).build())
                                 .memoryMiB(MemoryMiBRequestProperty.builder().min(16384).build())
                                 .cpuManufacturers(List.of("intel"))
                                 .build())
                         .build()))
                 .build())
         .build();
 

See Also: