Interface MixedInstancesPolicy

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
MixedInstancesPolicy.Jsii$Proxy

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:45.397Z") @Stability(Stable) public interface MixedInstancesPolicy extends software.amazon.jsii.JsiiSerializable
MixedInstancesPolicy allows you to configure a group that diversifies across On-Demand Instances and Spot Instances of multiple instance types.

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

Example:

 Vpc vpc;
 LaunchTemplate launchTemplate1;
 LaunchTemplate launchTemplate2;
 AutoScalingGroup.Builder.create(this, "ASG")
         .vpc(vpc)
         .mixedInstancesPolicy(MixedInstancesPolicy.builder()
                 .instancesDistribution(InstancesDistribution.builder()
                         .onDemandPercentageAboveBaseCapacity(50)
                         .build())
                 .launchTemplate(launchTemplate1)
                 .launchTemplateOverrides(List.of(LaunchTemplateOverrides.builder().instanceType(new InstanceType("t3.micro")).build(), LaunchTemplateOverrides.builder().instanceType(new InstanceType("t3a.micro")).build(), LaunchTemplateOverrides.builder().instanceType(new InstanceType("t4g.micro")).launchTemplate(launchTemplate2).build()))
                 .build())
         .build();
 
  • Method Details

    • getLaunchTemplate

      @Stability(Stable) @NotNull ILaunchTemplate getLaunchTemplate()
      Launch template to use.
    • getInstancesDistribution

      @Stability(Stable) @Nullable default InstancesDistribution getInstancesDistribution()
      InstancesDistribution to use.

      Default: - The value for each property in it uses a default value.

    • getLaunchTemplateOverrides

      @Stability(Stable) @Nullable default List<LaunchTemplateOverrides> getLaunchTemplateOverrides()
      Launch template overrides.

      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

    • builder

      @Stability(Stable) static MixedInstancesPolicy.Builder builder()
      Returns:
      a MixedInstancesPolicy.Builder of MixedInstancesPolicy