Package software.amazon.awscdk.services.autoscaling
Amazon EC2 Auto Scaling Construct Library
This module is part of the AWS Cloud Development Kit project.
Auto Scaling Group
An AutoScalingGroup represents a number of instances on which you run your code. You
pick the size of the fleet, the instance type and the OS image:
Vpc vpc;
AutoScalingGroup.Builder.create(this, "ASG")
.vpc(vpc)
.instanceType(InstanceType.of(InstanceClass.BURSTABLE2, InstanceSize.MICRO))
// The latest Amazon Linux 2 image
.machineImage(MachineImage.latestAmazonLinux2())
.build();
Creating an AutoScalingGroup from a Launch Configuration has been deprecated. All new accounts created after December 31, 2023 will no longer be able to create Launch Configurations. With the @aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig feature flag set to true, AutoScalingGroup properties used to create a Launch Configuration will now be used to create a LaunchTemplate using a Launch Configuration to LaunchTemplate mapping. Specifically, the following AutoScalingGroup properties will be used to generate a LaunchTemplate:
- machineImage
- keyName (deprecated, prefer keyPair)
- keyPair
- instanceType
- instanceMonitoring
- securityGroup
- role
- userData
- associatePublicIpAddress
- spotPrice
- blockDevices
After the Launch Configuration is replaced with a LaunchTemplate, any new instances launched by the AutoScalingGroup will use the new LaunchTemplate. Existing instances are not affected. To update an existing instance, you can allow the AutoScalingGroup to gradually replace existing instances with new instances based on the terminationPolicies for the AutoScalingGroup. Alternatively, you can terminate them yourself and force the AutoScalingGroup to launch new instances to maintain the desiredCapacity.
Support for creating an AutoScalingGroup from a LaunchTemplate was added in CDK version 2.21.0. Users on a CDK version earlier than version 2.21.0 that need to create an AutoScalingGroup with an account created after December 31, 2023 must update their CDK version to 2.21.0 or later. Users on CDK versions 2.21.0 up to, but not including 2.86.0, must use a manually created LaunchTemplate to create an AutoScalingGroup for accounts created after December 31, 2023. CDK version 2.86.0 or later will automatically generate a LaunchTemplate using the AutoScalingGroup properties mentioned above.
For additional migration information, please see: Migrating to a LaunchTemplate from a Launch Configuration
NOTE: AutoScalingGroup has a property called allowAllOutbound (allowing the instances to contact the
internet) which is set to true by default. Be sure to set this to false if you don't want
your instances to be able to start arbitrary connections. Alternatively, you can specify an existing security
group to attach to the instances that are launched, rather than have the group create a new one.
Vpc vpc;
SecurityGroup mySecurityGroup = SecurityGroup.Builder.create(this, "SecurityGroup").vpc(vpc).build();
AutoScalingGroup.Builder.create(this, "ASG")
.vpc(vpc)
.instanceType(InstanceType.of(InstanceClass.BURSTABLE2, InstanceSize.MICRO))
.machineImage(MachineImage.latestAmazonLinux2())
.securityGroup(mySecurityGroup)
.build();
Alternatively, to enable more advanced features, you can create an AutoScalingGroup from a supplied LaunchTemplate:
Vpc vpc;
LaunchTemplate launchTemplate;
AutoScalingGroup.Builder.create(this, "ASG")
.vpc(vpc)
.launchTemplate(launchTemplate)
.build();
To launch a mixture of Spot and on-demand instances, and/or with multiple instance types, you can create an AutoScalingGroup from a MixedInstancesPolicy:
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();
You can specify instances requirements with the instanceRequirements property:
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();
Machine Images (AMIs)
AMIs control the OS that gets launched when you start your EC2 instance. The EC2 library contains constructs to select the AMI you want to use.
Depending on the type of AMI, you select it a different way.
The latest version of Amazon Linux and Microsoft Windows images are selectable by instantiating one of these classes:
// Pick a Windows edition to use
WindowsImage windows = new WindowsImage(WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_BASE);
// Pick the right Amazon Linux edition. All arguments shown are optional
// and will default to these values when omitted.
AmazonLinuxImage amznLinux = AmazonLinuxImage.Builder.create()
.generation(AmazonLinuxGeneration.AMAZON_LINUX)
.edition(AmazonLinuxEdition.STANDARD)
.virtualization(AmazonLinuxVirt.HVM)
.storage(AmazonLinuxStorage.GENERAL_PURPOSE)
.build();
// For other custom (Linux) images, instantiate a `GenericLinuxImage` with
// a map giving the AMI to in for each region:
GenericLinuxImage linux = new GenericLinuxImage(Map.of(
"us-east-1", "ami-97785bed",
"eu-west-1", "ami-12345678"));
NOTE: The Amazon Linux images selected will be cached in your
cdk.json, so that your AutoScalingGroups don't automatically change out from under you when you're making unrelated changes. To update to the latest version of Amazon Linux, remove the cache entry from thecontextsection of yourcdk.json.We will add command-line options to make this step easier in the future.
AutoScaling Instance Counts
AutoScalingGroups make it possible to raise and lower the number of instances in the group, in response to (or in advance of) changes in workload.
When you create your AutoScalingGroup, you specify a minCapacity and a
maxCapacity. AutoScaling policies that respond to metrics will never go higher
or lower than the indicated capacity (but scheduled scaling actions might, see
below).
There are three ways to scale your capacity:
- In response to a metric (also known as step scaling); for example, you might want to scale out if the CPU usage across your cluster starts to rise, and scale in when it drops again.
- By trying to keep a certain metric around a given value (also known as target tracking scaling); you might want to automatically scale out and in to keep your CPU usage around 50%.
- On a schedule; you might want to organize your scaling around traffic flows you expect, by scaling out in the morning and scaling in in the evening.
The general pattern of autoscaling will look like this:
Vpc vpc;
InstanceType instanceType;
IMachineImage machineImage;
AutoScalingGroup autoScalingGroup = AutoScalingGroup.Builder.create(this, "ASG")
.vpc(vpc)
.instanceType(instanceType)
.machineImage(machineImage)
.minCapacity(5)
.maxCapacity(100)
.build();
Step Scaling
This type of scaling scales in and out in deterministics steps that you configure, in response to metric values. For example, your scaling strategy to scale in response to a metric that represents your average worker pool usage might look like this:
Scaling -1 (no change) +1 +3
│ │ │ │ │
├────────┼───────────────────────┼────────┼────────┤
│ │ │ │ │
Worker use 0% 10% 50% 70% 100%
(Note that this is not necessarily a recommended scaling strategy, but it's a possible one. You will have to determine what thresholds are right for you).
Note that in order to set up this scaling strategy, you will have to emit a metric representing your worker utilization from your instances. After that, you would configure the scaling something like this:
AutoScalingGroup autoScalingGroup;
Metric workerUtilizationMetric = Metric.Builder.create()
.namespace("MyService")
.metricName("WorkerUtilization")
.build();
autoScalingGroup.scaleOnMetric("ScaleToCPU", BasicStepScalingPolicyProps.builder()
.metric(workerUtilizationMetric)
.scalingSteps(List.of(ScalingInterval.builder().upper(10).change(-1).build(), ScalingInterval.builder().lower(50).change(+1).build(), ScalingInterval.builder().lower(70).change(+3).build()))
.evaluationPeriods(10)
.datapointsToAlarm(5)
// Change this to AdjustmentType.PERCENT_CHANGE_IN_CAPACITY to interpret the
// 'change' numbers before as percentages instead of capacity counts.
.adjustmentType(AdjustmentType.CHANGE_IN_CAPACITY)
.build());
The AutoScaling construct library will create the required CloudWatch alarms and AutoScaling policies for you.
Target Tracking Scaling
This type of scaling scales in and out in order to keep a metric around a value you prefer. There are four types of predefined metrics you can track, or you can choose to track a custom metric. If you do choose to track a custom metric, be aware that the metric has to represent instance utilization in some way (AutoScaling will scale out if the metric is higher than the target, and scale in if the metric is lower than the target).
If you configure multiple target tracking policies, AutoScaling will use the one that yields the highest capacity.
The following example scales to keep the CPU usage of your instances around 50% utilization:
AutoScalingGroup autoScalingGroup;
autoScalingGroup.scaleOnCpuUtilization("KeepSpareCPU", CpuUtilizationScalingProps.builder()
.targetUtilizationPercent(50)
.build());
To scale on average network traffic in and out of your instances:
AutoScalingGroup autoScalingGroup;
autoScalingGroup.scaleOnIncomingBytes("LimitIngressPerInstance", NetworkUtilizationScalingProps.builder()
.targetBytesPerSecond(10 * 1024 * 1024)
.build());
autoScalingGroup.scaleOnOutgoingBytes("LimitEgressPerInstance", NetworkUtilizationScalingProps.builder()
.targetBytesPerSecond(10 * 1024 * 1024)
.build());
To scale on the average request count per instance (only works for AutoScalingGroups that have been attached to Application Load Balancers):
AutoScalingGroup autoScalingGroup;
autoScalingGroup.scaleOnRequestCount("LimitRPS", RequestCountScalingProps.builder()
.targetRequestsPerSecond(1000)
.build());
Scheduled Scaling
This type of scaling is used to change capacities based on time. It works by
changing minCapacity, maxCapacity and desiredCapacity of the
AutoScalingGroup, and so can be used for two purposes:
- Scale in and out on a schedule by setting the
minCapacityhigh or themaxCapacitylow. - Still allow the regular scaling actions to do their job, but restrict
the range they can scale over (by setting both
minCapacityandmaxCapacitybut changing their range over time).
A schedule is expressed as a cron expression. The Schedule class has a cron method to help build cron expressions.
The following example scales the fleet out in the morning, going back to natural scaling (all the way down to 1 instance if necessary) at night:
AutoScalingGroup autoScalingGroup;
autoScalingGroup.scaleOnSchedule("PrescaleInTheMorning", BasicScheduledActionProps.builder()
.schedule(Schedule.cron(CronOptions.builder().hour("8").minute("0").build()))
.minCapacity(20)
.build());
autoScalingGroup.scaleOnSchedule("AllowDownscalingAtNight", BasicScheduledActionProps.builder()
.schedule(Schedule.cron(CronOptions.builder().hour("20").minute("0").build()))
.minCapacity(1)
.build());
Health checks for instances
You can configure the health checks for the instances in the Auto Scaling group.
Possible health check types are EC2, EBS, ELB, and VPC_LATTICE. EC2 is the default health check and cannot be disabled.
If you want to configure the EC2 health check, use the HealthChecks.ec2 method:
Vpc vpc;
AutoScalingGroup.Builder.create(this, "ASG")
.vpc(vpc)
.instanceType(InstanceType.of(InstanceClass.BURSTABLE2, InstanceSize.MICRO))
.machineImage(MachineImage.latestAmazonLinux2())
.healthChecks(HealthChecks.ec2(Ec2HealthChecksOptions.builder()
.gracePeriod(Duration.seconds(100))
.build()))
.build();
If you also want to configure the additional health checks other than EC2, use the HealthChecks.withAdditionalChecks method.
EC2 is implicitly included, so you can specify types other than EC2.
Vpc vpc;
AutoScalingGroup.Builder.create(this, "ASG")
.vpc(vpc)
.instanceType(InstanceType.of(InstanceClass.BURSTABLE2, InstanceSize.MICRO))
.machineImage(MachineImage.latestAmazonLinux2())
.healthChecks(HealthChecks.withAdditionalChecks(AdditionalHealthChecksOptions.builder()
.gracePeriod(Duration.seconds(100))
.additionalTypes(List.of(AdditionalHealthCheckType.EBS, AdditionalHealthCheckType.ELB, AdditionalHealthCheckType.VPC_LATTICE))
.build()))
.build();
Visit Health checks for instances in an Auto Scaling group for more details.
Instance Maintenance Policy
You can configure an instance maintenance policy for your Auto Scaling group to meet specific capacity requirements during events that cause instances to be replaced, such as an instance refresh or the health check process.
For example, suppose you have an Auto Scaling group that has a small number of instances. You want to avoid the potential disruptions from terminating and then replacing an instance when health checks indicate an impaired instance. With an instance maintenance policy, you can make sure that Amazon EC2 Auto Scaling first launches a new instance and then waits for it to be fully ready before terminating the unhealthy instance.
An instance maintenance policy also helps you minimize any potential disruptions in cases where
multiple instances are replaced at the same time. You set the minHealthyPercentage
and the maxHealthyPercentage for the policy, and your Auto Scaling group can only
increase and decrease capacity within that minimum-maximum range when replacing instances.
A larger range increases the number of instances that can be replaced at the same time.
Vpc vpc;
AutoScalingGroup.Builder.create(this, "ASG")
.vpc(vpc)
.instanceType(InstanceType.of(InstanceClass.BURSTABLE2, InstanceSize.MICRO))
.machineImage(MachineImage.latestAmazonLinux2())
.maxHealthyPercentage(200)
.minHealthyPercentage(100)
.build();
Visit Instance maintenance policies for more details.
Block Devices
This type specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes.
GP3 Volumes
You can only specify the throughput on GP3 volumes.
Vpc vpc;
InstanceType instanceType;
IMachineImage machineImage;
AutoScalingGroup autoScalingGroup = AutoScalingGroup.Builder.create(this, "ASG")
.vpc(vpc)
.instanceType(instanceType)
.machineImage(machineImage)
.blockDevices(List.of(BlockDevice.builder()
.deviceName("gp3-volume")
.volume(BlockDeviceVolume.ebs(15, EbsDeviceOptions.builder()
.volumeType(EbsDeviceVolumeType.GP3)
.throughput(125)
.build()))
.build()))
.build();
Configuring Instances using CloudFormation Init
It is possible to use the CloudFormation Init mechanism to configure the
instances in the AutoScalingGroup. You can write files to it, run commands,
start services, etc. See the documentation of
AWS::CloudFormation::Init
and the documentation of CDK's aws-ec2 library for more information.
When you specify a CloudFormation Init configuration for an AutoScalingGroup:
- you must also specify
signalsto configure how long CloudFormation should wait for the instances to successfully configure themselves. - you should also specify an
updatePolicyto configure how instances should be updated when the AutoScalingGroup is updated (for example, when the AMI is updated). If you don't specify an update policy, a rolling update is chosen by default.
Here's an example of using CloudFormation Init to write a file to the instance hosts on startup:
Vpc vpc;
InstanceType instanceType;
IMachineImage machineImage;
AutoScalingGroup.Builder.create(this, "ASG")
.vpc(vpc)
.instanceType(instanceType)
.machineImage(machineImage)
// ...
.init(CloudFormationInit.fromElements(InitFile.fromString("/etc/my_instance", "This got written during instance startup")))
.signals(Signals.waitForAll(SignalsOptions.builder()
.timeout(Duration.minutes(10))
.build()))
.build();
Signals
In normal operation, CloudFormation will send a Create or Update command to an AutoScalingGroup and proceed with the rest of the deployment without waiting for the instances in the AutoScalingGroup.
Configure signals to tell CloudFormation to wait for a specific number of
instances in the AutoScalingGroup to have been started (or failed to start)
before moving on. An instance is supposed to execute the
cfn-signal
program as part of its startup to indicate whether it was started
successfully or not.
If you use CloudFormation Init support (described in the previous section),
the appropriate call to cfn-signal is automatically added to the
AutoScalingGroup's UserData. If you don't use the signals directly, you are
responsible for adding such a call yourself.
The following type of Signals are available:
Signals.waitForAll([options]): wait for all ofdesiredCapacityamount of instances to have started (recommended).Signals.waitForMinCapacity([options]): wait for aminCapacityamount of instances to have started (use this if waiting for all instances takes too long and you are happy with a minimum count of healthy hosts).Signals.waitForCount(count, [options]): wait for a specific amount of instances to have started.
There are two options you can configure:
timeout: maximum time a host startup is allowed to take. If a host does not report success within this time, it is considered a failure. Default is 5 minutes.minSuccessPercentage: percentage of hosts that needs to be healthy in order for the update to succeed. If you set this value lower than 100, some percentage of hosts may report failure, while still considering the deployment a success. Default is 100%.
Update Policy
The update policy describes what should happen to running instances when the definition of the AutoScalingGroup is changed. For example, if you add a command to the UserData of an AutoScalingGroup, do the existing instances get replaced with new instances that have executed the new UserData? Or do the "old" instances just keep on running?
It is recommended to always use an update policy, otherwise the current state of your instances also depends the previous state of your instances, rather than just on your source code. This degrades the reproducibility of your deployments.
The following update policies are available:
UpdatePolicy.none(): leave existing instances alone (not recommended).UpdatePolicy.rollingUpdate([options]): progressively replace the existing instances with new instances, in small batches. At any point in time, roughly the same amount of total instances will be running. If the deployment needs to be rolled back, the fresh instances will be replaced with the "old" configuration again.UpdatePolicy.replacingUpdate([options]): build a completely fresh copy of the new AutoScalingGroup next to the old one. Once the AutoScalingGroup has been successfully created (and the instances started, ifsignalsis configured on the AutoScalingGroup), the old AutoScalingGroup is deleted. If the deployment needs to be rolled back, the new AutoScalingGroup is deleted and the old one is left unchanged.
Allowing Connections
See the documentation of the aws-cdk-lib/aws-ec2 package for more information
about allowing connections between resources backed by instances.
Max Instance Lifetime
To enable the max instance lifetime support, specify maxInstanceLifetime property
for the AutoscalingGroup resource. The value must be between 1 and 365 days(inclusive).
To clear a previously set value, leave this property undefined.
Instance Monitoring
To disable detailed instance monitoring, specify instanceMonitoring property
for the AutoscalingGroup resource as Monitoring.BASIC. Otherwise detailed monitoring
will be enabled.
Monitoring Group Metrics
Group metrics are used to monitor group level properties; they describe the group rather than any of its instances (e.g GroupMaxSize, the group maximum size). To enable group metrics monitoring, use the groupMetrics property.
All group metrics are reported in a granularity of 1 minute at no additional charge.
See EC2 docs for a list of all available group metrics.
To enable group metrics monitoring using the groupMetrics property:
Vpc vpc;
InstanceType instanceType;
IMachineImage machineImage;
// Enable monitoring of all group metrics
// Enable monitoring of all group metrics
AutoScalingGroup.Builder.create(this, "ASG")
.vpc(vpc)
.instanceType(instanceType)
.machineImage(machineImage)
// ...
.groupMetrics(List.of(GroupMetrics.all()))
.build();
// Enable monitoring for a subset of group metrics
// Enable monitoring for a subset of group metrics
AutoScalingGroup.Builder.create(this, "ASG")
.vpc(vpc)
.instanceType(instanceType)
.machineImage(machineImage)
// ...
.groupMetrics(List.of(new GroupMetrics(GroupMetric.MIN_SIZE, GroupMetric.MAX_SIZE)))
.build();
Termination policies
Auto Scaling uses termination policies
to determine which instances it terminates first during scale-in events. You
can specify one or more termination policies with the terminationPolicies
property:
Custom termination policy with lambda
can be used to determine which instances to terminate based on custom logic.
The custom termination policy can be specified using TerminationPolicy.CUSTOM_LAMBDA_FUNCTION. If this is
specified, you must also supply a value of lambda arn in the terminationPolicyCustomLambdaFunctionArn property and
attach necessary permission
to invoke the lambda function.
If there are multiple termination policies specified,
custom termination policy with lambda TerminationPolicy.CUSTOM_LAMBDA_FUNCTION
must be specified first.
Vpc vpc;
InstanceType instanceType;
IMachineImage machineImage;
String arn;
AutoScalingGroup.Builder.create(this, "ASG")
.vpc(vpc)
.instanceType(instanceType)
.machineImage(machineImage)
// ...
.terminationPolicies(List.of(TerminationPolicy.CUSTOM_LAMBDA_FUNCTION, TerminationPolicy.OLDEST_INSTANCE, TerminationPolicy.DEFAULT))
//terminationPolicyCustomLambdaFunctionArn property must be specified if the TerminationPolicy.CUSTOM_LAMBDA_FUNCTION is used
.terminationPolicyCustomLambdaFunctionArn(arn)
.build();
Protecting new instances from being terminated on scale-in
By default, Auto Scaling can terminate an instance at any time after launch when scaling in an Auto Scaling Group, subject to the group's termination policy.
However, you may wish to protect newly-launched instances from being scaled in
if they are going to run critical applications that should not be prematurely
terminated. EC2 Capacity Providers for Amazon ECS requires this attribute be
set to true.
Vpc vpc;
InstanceType instanceType;
IMachineImage machineImage;
AutoScalingGroup.Builder.create(this, "ASG")
.vpc(vpc)
.instanceType(instanceType)
.machineImage(machineImage)
// ...
.newInstancesProtectedFromScaleIn(true)
.build();
Configuring Capacity Rebalancing
Indicates whether Capacity Rebalancing is enabled. Otherwise, Capacity Rebalancing is disabled. When you turn on Capacity Rebalancing, Amazon EC2 Auto Scaling attempts to launch a Spot Instance whenever Amazon EC2 notifies that a Spot Instance is at an elevated risk of interruption. After launching a new instance, it then terminates an old instance. For more information, see Use Capacity Rebalancing to handle Amazon EC2 Spot Interruptions in the in the Amazon EC2 Auto Scaling User Guide.
Vpc vpc;
InstanceType instanceType;
IMachineImage machineImage;
AutoScalingGroup.Builder.create(this, "ASG")
.vpc(vpc)
.instanceType(instanceType)
.machineImage(machineImage)
// ...
.capacityRebalance(true)
.build();
Connecting to your instances using SSM Session Manager
SSM Session Manager makes it possible to connect to your instances from the AWS Console, without preparing SSH keys.
To do so, you need to:
- Use an image with SSM agent installed and configured. Many images come with SSM Agent preinstalled, otherwise you may need to manually put instructions to install SSM Agent into your instance's UserData or use EC2 Init).
- Create the AutoScalingGroup with
ssmSessionPermissions: true.
If these conditions are met, you can connect to the instance from the EC2 Console. Example:
Vpc vpc;
AutoScalingGroup.Builder.create(this, "ASG")
.vpc(vpc)
.instanceType(InstanceType.of(InstanceClass.T3, InstanceSize.MICRO))
// Amazon Linux 2 comes with SSM Agent by default
.machineImage(MachineImage.latestAmazonLinux2())
// Turn on SSM
.ssmSessionPermissions(true)
.build();
Configuring Instance Metadata Service (IMDS)
Toggling IMDSv1
You can configure EC2 Instance Metadata Service options to either allow both IMDSv1 and IMDSv2 or enforce IMDSv2 when interacting with the IMDS.
To do this for a single AutoScalingGroup, you can use set the requireImdsv2 property.
The example below demonstrates IMDSv2 being required on a single AutoScalingGroup:
Vpc vpc;
InstanceType instanceType;
IMachineImage machineImage;
AutoScalingGroup.Builder.create(this, "ASG")
.vpc(vpc)
.instanceType(instanceType)
.machineImage(machineImage)
// ...
.requireImdsv2(true)
.build();
You can also use AutoScalingGroupRequireImdsv2Aspect to apply the operation to multiple AutoScalingGroups.
The example below demonstrates the AutoScalingGroupRequireImdsv2Aspect being used to require IMDSv2 for all AutoScalingGroups in a stack:
AutoScalingGroupRequireImdsv2Aspect aspect = new AutoScalingGroupRequireImdsv2Aspect(); Aspects.of(this).add(aspect);
Warm Pool
Auto Scaling offers a warm pool which gives an ability to decrease latency for applications that have exceptionally long boot times. You can create a warm pool with default parameters as below:
AutoScalingGroup autoScalingGroup; autoScalingGroup.addWarmPool();
You can also customize a warm pool by configuring parameters:
AutoScalingGroup autoScalingGroup;
autoScalingGroup.addWarmPool(WarmPoolOptions.builder()
.minSize(1)
.reuseOnScaleIn(true)
.build());
Default Instance Warming
You can use the default instance warmup feature to improve the Amazon CloudWatch metrics used for dynamic scaling. When default instance warmup is not enabled, each instance starts contributing usage data to the aggregated metrics as soon as the instance reaches the InService state. However, if you enable default instance warmup, this lets your instances finish warming up before they contribute the usage data.
To optimize the performance of scaling policies that scale continuously, such as target tracking and step scaling policies, we strongly recommend that you enable the default instance warmup, even if its value is set to 0 seconds.
To set up Default Instance Warming for an autoscaling group, simply pass it in as a prop
Vpc vpc;
InstanceType instanceType;
IMachineImage machineImage;
AutoScalingGroup.Builder.create(this, "ASG")
.vpc(vpc)
.instanceType(instanceType)
.machineImage(machineImage)
// ...
.defaultInstanceWarmup(Duration.seconds(5))
.build();
Configuring KeyPair for instances
You can use a keyPair to build your asg when you decide not to use a ready-made LanchTemplate.
To configure KeyPair for an autoscaling group, pass the keyPair as a prop:
Vpc vpc;
InstanceType instanceType;
IMachineImage machineImage;
KeyPair myKeyPair = new KeyPair(this, "MyKeyPair");
AutoScalingGroup.Builder.create(this, "ASG")
.vpc(vpc)
.instanceType(instanceType)
.machineImage(machineImage)
// ...
.keyPair(myKeyPair)
.build();
Capacity Distribution Strategy
If launches fail in an Availability Zone, the following strategies are available.
BALANCED_BEST_EFFORT(default) - If launches fail in an Availability Zone, Auto Scaling will attempt to launch in another healthy Availability Zone instead.BALANCED_ONLY- If launches fail in an Availability Zone, Auto Scaling will continue to attempt to launch in the unhealthy zone to preserve a balanced distribution.
Vpc vpc;
InstanceType instanceType;
IMachineImage machineImage;
AutoScalingGroup.Builder.create(this, "ASG")
.vpc(vpc)
.instanceType(instanceType)
.machineImage(machineImage)
// ...
.azCapacityDistributionStrategy(CapacityDistributionStrategy.BALANCED_ONLY)
.build();
Future work
- [ ] CloudWatch Events (impossible to add currently as the AutoScalingGroup ARN is necessary to make this rule and this cannot be accessed from CloudFormation).
-
ClassDescriptionAdditional Heath checks options.A builder for
AdditionalHealthChecksOptionsAn implementation forAdditionalHealthChecksOptionsAdditional Health Check Type.An adjustment.A builder forAdjustmentTierAn implementation forAdjustmentTierHow adjustment numbers are interpreted.Options for applying CloudFormation init to an instance or instance group.A builder forApplyCloudFormationInitOptionsAn implementation forApplyCloudFormationInitOptionsA Fleet represents a managed set of EC2 instances.A fluent builder forAutoScalingGroup.Properties of a Fleet.A builder forAutoScalingGroupPropsAn implementation forAutoScalingGroupPropsAspect that makes IMDSv2 required on instances deployed by AutoScalingGroups.Base interface for target tracking props.A builder forBaseTargetTrackingPropsAn implementation forBaseTargetTrackingPropsBasic properties for a lifecycle hook.A builder forBasicLifecycleHookPropsAn implementation forBasicLifecycleHookPropsProperties for a scheduled scaling action.A builder forBasicScheduledActionPropsAn implementation forBasicScheduledActionPropsExample:A builder forBasicStepScalingPolicyPropsAn implementation forBasicStepScalingPolicyPropsProperties for a Target Tracking policy that include the metric but exclude the target.A builder forBasicTargetTrackingScalingPolicyPropsAn implementation forBasicTargetTrackingScalingPolicyPropsOptions needed to bind a target to a lifecycle hook.A builder forBindHookTargetOptionsAn implementation forBindHookTargetOptionsBlock device.A builder forBlockDeviceAn implementation forBlockDeviceDescribes a block device mapping for an EC2 instance or Auto Scaling group.The strategies for when launches fail in an Availability Zone.TheAWS::AutoScaling::AutoScalingGroupresource defines an Amazon EC2 Auto Scaling group, which is a collection of Amazon EC2 instances that are treated as a logical grouping for the purposes of automatic scaling and management.AcceleratorCountRequestis a property of theInstanceRequirementsproperty of the AWS::AutoScaling::AutoScalingGroup LaunchTemplateOverrides property type that describes the minimum and maximum number of accelerators for an instance type.A builder forCfnAutoScalingGroup.AcceleratorCountRequestPropertyAn implementation forCfnAutoScalingGroup.AcceleratorCountRequestPropertyAcceleratorTotalMemoryMiBRequestis a property of theInstanceRequirementsproperty of the AWS::AutoScaling::AutoScalingGroup LaunchTemplateOverrides property type that describes the minimum and maximum total memory size for the accelerators for an instance type, in MiB.An implementation forCfnAutoScalingGroup.AcceleratorTotalMemoryMiBRequestPropertyAvailabilityZoneDistributionis a property of the AWS::AutoScaling::AutoScalingGroup resource.A builder forCfnAutoScalingGroup.AvailabilityZoneDistributionPropertyAn implementation forCfnAutoScalingGroup.AvailabilityZoneDistributionPropertyDescribes an Availability Zone impairment policy.An implementation forCfnAutoScalingGroup.AvailabilityZoneImpairmentPolicyPropertyBaselineEbsBandwidthMbpsRequestis a property of theInstanceRequirementsproperty of the AWS::AutoScaling::AutoScalingGroup LaunchTemplateOverrides property type that describes the minimum and maximum baseline bandwidth performance for an instance type, in Mbps.An implementation forCfnAutoScalingGroup.BaselineEbsBandwidthMbpsRequestPropertyThe baseline performance to consider, using an instance family as a baseline reference.An implementation forCfnAutoScalingGroup.BaselinePerformanceFactorsRequestPropertyA fluent builder forCfnAutoScalingGroup.Describes the Capacity Reservation preference and targeting options.An implementation forCfnAutoScalingGroup.CapacityReservationSpecificationPropertyThe target for the Capacity Reservation.A builder forCfnAutoScalingGroup.CapacityReservationTargetPropertyAn implementation forCfnAutoScalingGroup.CapacityReservationTargetPropertyThe CPU performance to consider, using an instance family as the baseline reference.A builder forCfnAutoScalingGroup.CpuPerformanceFactorRequestPropertyAn implementation forCfnAutoScalingGroup.CpuPerformanceFactorRequestPropertyInstanceMaintenancePolicyis a property of the AWS::AutoScaling::AutoScalingGroup resource.A builder forCfnAutoScalingGroup.InstanceMaintenancePolicyPropertyAn implementation forCfnAutoScalingGroup.InstanceMaintenancePolicyPropertyThe attributes for the instance types for a mixed instances policy.A builder forCfnAutoScalingGroup.InstanceRequirementsPropertyAn implementation forCfnAutoScalingGroup.InstanceRequirementsPropertyUse this structure to specify the distribution of On-Demand Instances and Spot Instances and the allocation strategies used to fulfill On-Demand and Spot capacities for a mixed instances policy.A builder forCfnAutoScalingGroup.InstancesDistributionPropertyAn implementation forCfnAutoScalingGroup.InstancesDistributionPropertyUse this structure to let Amazon EC2 Auto Scaling do the following when the Auto Scaling group has a mixed instances policy: - Override the instance type that is specified in the launch template.A builder forCfnAutoScalingGroup.LaunchTemplateOverridesPropertyAn implementation forCfnAutoScalingGroup.LaunchTemplateOverridesPropertyUse this structure to specify the launch templates and instance types (overrides) for a mixed instances policy.A builder forCfnAutoScalingGroup.LaunchTemplatePropertyAn implementation forCfnAutoScalingGroup.LaunchTemplatePropertySpecifies a launch template to use when provisioning EC2 instances for an Auto Scaling group.A builder forCfnAutoScalingGroup.LaunchTemplateSpecificationPropertyAn implementation forCfnAutoScalingGroup.LaunchTemplateSpecificationPropertyLifecycleHookSpecificationspecifies a lifecycle hook for theLifecycleHookSpecificationListproperty of the AWS::AutoScaling::AutoScalingGroup resource.A builder forCfnAutoScalingGroup.LifecycleHookSpecificationPropertyAn implementation forCfnAutoScalingGroup.LifecycleHookSpecificationPropertyMemoryGiBPerVCpuRequestis a property of theInstanceRequirementsproperty of the AWS::AutoScaling::AutoScalingGroup LaunchTemplateOverrides property type that describes the minimum and maximum amount of memory per vCPU for an instance type, in GiB.A builder forCfnAutoScalingGroup.MemoryGiBPerVCpuRequestPropertyAn implementation forCfnAutoScalingGroup.MemoryGiBPerVCpuRequestPropertyMemoryMiBRequestis a property of theInstanceRequirementsproperty of the AWS::AutoScaling::AutoScalingGroup LaunchTemplateOverrides property type that describes the minimum and maximum instance memory size for an instance type, in MiB.A builder forCfnAutoScalingGroup.MemoryMiBRequestPropertyAn implementation forCfnAutoScalingGroup.MemoryMiBRequestPropertyMetricsCollectionis a property of the AWS::AutoScaling::AutoScalingGroup resource that describes the group metrics that an Amazon EC2 Auto Scaling group sends to Amazon CloudWatch.A builder forCfnAutoScalingGroup.MetricsCollectionPropertyAn implementation forCfnAutoScalingGroup.MetricsCollectionPropertyUse this structure to launch multiple instance types and On-Demand Instances and Spot Instances within a single Auto Scaling group.A builder forCfnAutoScalingGroup.MixedInstancesPolicyPropertyAn implementation forCfnAutoScalingGroup.MixedInstancesPolicyPropertyNetworkBandwidthGbpsRequestis a property of theInstanceRequirementsproperty of the AWS::AutoScaling::AutoScalingGroup LaunchTemplateOverrides property type that describes the minimum and maximum network bandwidth for an instance type, in Gbps.A builder forCfnAutoScalingGroup.NetworkBandwidthGbpsRequestPropertyAn implementation forCfnAutoScalingGroup.NetworkBandwidthGbpsRequestPropertyNetworkInterfaceCountRequestis a property of theInstanceRequirementsproperty of the AWS::AutoScaling::AutoScalingGroup LaunchTemplateOverrides property type that describes the minimum and maximum number of network interfaces for an instance type.A builder forCfnAutoScalingGroup.NetworkInterfaceCountRequestPropertyAn implementation forCfnAutoScalingGroup.NetworkInterfaceCountRequestPropertyA structure that specifies an Amazon SNS notification configuration for theNotificationConfigurationsproperty of the AWS::AutoScaling::AutoScalingGroup resource.A builder forCfnAutoScalingGroup.NotificationConfigurationPropertyAn implementation forCfnAutoScalingGroup.NotificationConfigurationPropertySpecify an instance family to use as the baseline reference for CPU performance.An implementation forCfnAutoScalingGroup.PerformanceFactorReferenceRequestPropertyA structure that specifies a tag for theTagsproperty of AWS::AutoScaling::AutoScalingGroup resource.A builder forCfnAutoScalingGroup.TagPropertyPropertyAn implementation forCfnAutoScalingGroup.TagPropertyPropertyTotalLocalStorageGBRequestis a property of theInstanceRequirementsproperty of the AWS::AutoScaling::AutoScalingGroup LaunchTemplateOverrides property type that describes the minimum and maximum total local storage size for an instance type, in GB.A builder forCfnAutoScalingGroup.TotalLocalStorageGBRequestPropertyAn implementation forCfnAutoScalingGroup.TotalLocalStorageGBRequestPropertyIdentifying information for a traffic source.A builder forCfnAutoScalingGroup.TrafficSourceIdentifierPropertyAn implementation forCfnAutoScalingGroup.TrafficSourceIdentifierPropertyVCpuCountRequestis a property of theInstanceRequirementsproperty of the AWS::AutoScaling::AutoScalingGroup LaunchTemplateOverrides property type that describes the minimum and maximum number of vCPUs for an instance type.A builder forCfnAutoScalingGroup.VCpuCountRequestPropertyAn implementation forCfnAutoScalingGroup.VCpuCountRequestPropertyProperties for defining aCfnAutoScalingGroup.A builder forCfnAutoScalingGroupPropsAn implementation forCfnAutoScalingGroupPropsTheAWS::AutoScaling::LaunchConfigurationresource specifies the launch configuration that can be used by an Auto Scaling group to configure Amazon EC2 instances.BlockDeviceMappingspecifies a block device mapping for theBlockDeviceMappingsproperty of the AWS::AutoScaling::LaunchConfiguration resource.A builder forCfnLaunchConfiguration.BlockDeviceMappingPropertyAn implementation forCfnLaunchConfiguration.BlockDeviceMappingPropertyBlockDeviceis a property of theEBSproperty of the AWS::AutoScaling::LaunchConfiguration BlockDeviceMapping property type that describes an Amazon EBS volume.A builder forCfnLaunchConfiguration.BlockDevicePropertyAn implementation forCfnLaunchConfiguration.BlockDevicePropertyA fluent builder forCfnLaunchConfiguration.MetadataOptionsis a property of AWS::AutoScaling::LaunchConfiguration that describes metadata options for the instances.A builder forCfnLaunchConfiguration.MetadataOptionsPropertyAn implementation forCfnLaunchConfiguration.MetadataOptionsPropertyProperties for defining aCfnLaunchConfiguration.A builder forCfnLaunchConfigurationPropsAn implementation forCfnLaunchConfigurationPropsTheAWS::AutoScaling::LifecycleHookresource specifies lifecycle hooks for an Auto Scaling group.A fluent builder forCfnLifecycleHook.Properties for defining aCfnLifecycleHook.A builder forCfnLifecycleHookPropsAn implementation forCfnLifecycleHookPropsTheAWS::AutoScaling::ScalingPolicyresource specifies an Amazon EC2 Auto Scaling scaling policy so that the Auto Scaling group can scale the number of instances available for your application.A fluent builder forCfnScalingPolicy.Contains customized metric specification information for a target tracking scaling policy for Amazon EC2 Auto Scaling.A builder forCfnScalingPolicy.CustomizedMetricSpecificationPropertyAn implementation forCfnScalingPolicy.CustomizedMetricSpecificationPropertyThe metric data to return.A builder forCfnScalingPolicy.MetricDataQueryPropertyAn implementation forCfnScalingPolicy.MetricDataQueryPropertyMetricDimensionspecifies a name/value pair that is part of the identity of a CloudWatch metric for theDimensionsproperty of the AWS::AutoScaling::ScalingPolicy CustomizedMetricSpecification property type.A builder forCfnScalingPolicy.MetricDimensionPropertyAn implementation forCfnScalingPolicy.MetricDimensionPropertyRepresents a specific metric.A builder forCfnScalingPolicy.MetricPropertyAn implementation forCfnScalingPolicy.MetricPropertyMetricStatis a property of the AWS::AutoScaling::ScalingPolicy MetricDataQuery property type.A builder forCfnScalingPolicy.MetricStatPropertyAn implementation forCfnScalingPolicy.MetricStatPropertyContains predefined metric specification information for a target tracking scaling policy for Amazon EC2 Auto Scaling.A builder forCfnScalingPolicy.PredefinedMetricSpecificationPropertyAn implementation forCfnScalingPolicy.PredefinedMetricSpecificationPropertyPredictiveScalingConfigurationis a property of the AWS::AutoScaling::ScalingPolicy resource that specifies a predictive scaling policy for Amazon EC2 Auto Scaling.A builder forCfnScalingPolicy.PredictiveScalingConfigurationPropertyAn implementation forCfnScalingPolicy.PredictiveScalingConfigurationPropertyContains capacity metric information for theCustomizedCapacityMetricSpecificationproperty of the AWS::AutoScaling::ScalingPolicy PredictiveScalingMetricSpecification property type.An implementation forCfnScalingPolicy.PredictiveScalingCustomizedCapacityMetricPropertyContains load metric information for theCustomizedLoadMetricSpecificationproperty of the AWS::AutoScaling::ScalingPolicy PredictiveScalingMetricSpecification property type.An implementation forCfnScalingPolicy.PredictiveScalingCustomizedLoadMetricPropertyContains scaling metric information for theCustomizedScalingMetricSpecificationproperty of the AWS::AutoScaling::ScalingPolicy PredictiveScalingMetricSpecification property type.An implementation forCfnScalingPolicy.PredictiveScalingCustomizedScalingMetricPropertyA structure that specifies a metric specification for theMetricSpecificationsproperty of the AWS::AutoScaling::ScalingPolicy PredictiveScalingConfiguration property type.An implementation forCfnScalingPolicy.PredictiveScalingMetricSpecificationPropertyContains load metric information for thePredefinedLoadMetricSpecificationproperty of the AWS::AutoScaling::ScalingPolicy PredictiveScalingMetricSpecification property type.An implementation forCfnScalingPolicy.PredictiveScalingPredefinedLoadMetricPropertyContains metric pair information for thePredefinedMetricPairSpecificationproperty of the AWS::AutoScaling::ScalingPolicy PredictiveScalingMetricSpecification property type.An implementation forCfnScalingPolicy.PredictiveScalingPredefinedMetricPairPropertyContains scaling metric information for thePredefinedScalingMetricSpecificationproperty of the AWS::AutoScaling::ScalingPolicy PredictiveScalingMetricSpecification property type.An implementation forCfnScalingPolicy.PredictiveScalingPredefinedScalingMetricPropertyStepAdjustmentspecifies a step adjustment for theStepAdjustmentsproperty of the AWS::AutoScaling::ScalingPolicy resource.A builder forCfnScalingPolicy.StepAdjustmentPropertyAn implementation forCfnScalingPolicy.StepAdjustmentPropertyTargetTrackingConfigurationis a property of the AWS::AutoScaling::ScalingPolicy resource that specifies a target tracking scaling policy configuration for Amazon EC2 Auto Scaling.A builder forCfnScalingPolicy.TargetTrackingConfigurationPropertyAn implementation forCfnScalingPolicy.TargetTrackingConfigurationPropertyThe metric data to return.A builder forCfnScalingPolicy.TargetTrackingMetricDataQueryPropertyAn implementation forCfnScalingPolicy.TargetTrackingMetricDataQueryPropertyThis structure defines the CloudWatch metric to return, along with the statistic and unit.A builder forCfnScalingPolicy.TargetTrackingMetricStatPropertyAn implementation forCfnScalingPolicy.TargetTrackingMetricStatPropertyProperties for defining aCfnScalingPolicy.A builder forCfnScalingPolicyPropsAn implementation forCfnScalingPolicyPropsTheAWS::AutoScaling::ScheduledActionresource specifies an Amazon EC2 Auto Scaling scheduled action so that the Auto Scaling group can change the number of instances available for your application in response to predictable load changes.A fluent builder forCfnScheduledAction.Properties for defining aCfnScheduledAction.A builder forCfnScheduledActionPropsAn implementation forCfnScheduledActionPropsTheAWS::AutoScaling::WarmPoolresource creates a pool of pre-initialized EC2 instances that sits alongside the Auto Scaling group.A fluent builder forCfnWarmPool.A structure that specifies an instance reuse policy for theInstanceReusePolicyproperty of the AWS::AutoScaling::WarmPool resource.A builder forCfnWarmPool.InstanceReusePolicyPropertyAn implementation forCfnWarmPool.InstanceReusePolicyPropertyProperties for defining aCfnWarmPool.A builder forCfnWarmPoolPropsAn implementation forCfnWarmPoolPropsBasic properties of an AutoScalingGroup, except the exact machines to run and where they should run.A builder forCommonAutoScalingGroupPropsAn implementation forCommonAutoScalingGroupPropsProperties for enabling scaling based on CPU utilization.A builder forCpuUtilizationScalingPropsAn implementation forCpuUtilizationScalingPropsOptions to configure a cron expression.A builder forCronOptionsAn implementation forCronOptionsBlock device options for an EBS volume.A builder forEbsDeviceOptionsAn implementation forEbsDeviceOptionsBase block device options for an EBS volume.A builder forEbsDeviceOptionsBaseAn implementation forEbsDeviceOptionsBaseProperties of an EBS block device.A builder forEbsDevicePropsAn implementation forEbsDevicePropsBlock device options for an EBS volume created from a snapshot.A builder forEbsDeviceSnapshotOptionsAn implementation forEbsDeviceSnapshotOptionsSupported EBS volume types for blockDevices.Deprecated.Use Ec2HealthChecksOptions insteadDeprecated.Deprecated.EC2 Heath checks options.A builder forEc2HealthChecksOptionsAn implementation forEc2HealthChecksOptionsDeprecated.Use AdditionalHealthChecksOptions insteadDeprecated.Deprecated.Group metrics that an Auto Scaling group sends to Amazon CloudWatch.A set of group metrics.Deprecated.Use HealthChecks insteadHealth check settings for multiple types.An AutoScalingGroup.Internal default implementation forIAutoScalingGroup.A proxy class which represents a concrete javascript instance of this type.A basic lifecycle hook object.Internal default implementation forILifecycleHook.A proxy class which represents a concrete javascript instance of this type.Interface for autoscaling lifecycle hook targets.Internal default implementation forILifecycleHookTarget.A proxy class which represents a concrete javascript instance of this type.InstancesDistribution is a subproperty of MixedInstancesPolicy that describes an instances distribution for an Auto Scaling group.A builder forInstancesDistributionAn implementation forInstancesDistributionLaunchTemplateOverrides is a subproperty of LaunchTemplate that describes an override for a launch template.A builder forLaunchTemplateOverridesAn implementation forLaunchTemplateOverridesDefine a life cycle hook.A fluent builder forLifecycleHook.Properties for a Lifecycle hook.A builder forLifecycleHookPropsAn implementation forLifecycleHookPropsResult of binding a lifecycle hook to a target.A builder forLifecycleHookTargetConfigAn implementation forLifecycleHookTargetConfigWhat instance transition to attach the hook to.How the scaling metric is going to be aggregated.Properties for enabling tracking of an arbitrary metric.A builder forMetricTargetTrackingPropsAn implementation forMetricTargetTrackingPropsMixedInstancesPolicy allows you to configure a group that diversifies across On-Demand Instances and Spot Instances of multiple instance types.A builder forMixedInstancesPolicyAn implementation forMixedInstancesPolicyThe monitoring mode for instances launched in an autoscaling group.Properties for enabling scaling based on network utilization.A builder forNetworkUtilizationScalingPropsAn implementation forNetworkUtilizationScalingPropsAutoScalingGroup fleet change notifications configurations.A builder forNotificationConfigurationAn implementation forNotificationConfigurationIndicates how to allocate instance types to fulfill On-Demand capacity.The instance state in the warm pool.One of the predefined autoscaling metrics.Input for Signals.renderCreationPolicy.A builder forRenderSignalsOptionsAn implementation forRenderSignalsOptionsProperties for enabling scaling based on request/second.A builder forRequestCountScalingPropsAn implementation forRequestCountScalingPropsOptions for customizing the rolling update.A builder forRollingUpdateOptionsAn implementation forRollingUpdateOptionsFleet scaling events.A list of ScalingEvents, you can use one of the predefined lists, such as ScalingEvents.ERRORS or create a custom group by instantiating aNotificationTypesobject, e.g:new NotificationTypes(NotificationType.INSTANCE_LAUNCH).A range of metric values in which to apply a certain scaling operation.A builder forScalingIntervalAn implementation forScalingIntervalSchedule for scheduled scaling actions.Define a scheduled scaling action.A fluent builder forScheduledAction.Properties for a scheduled action on an AutoScalingGroup.A builder forScheduledActionPropsAn implementation forScheduledActionPropsConfigure whether the AutoScalingGroup waits for signals.Customization options for Signal handling.A builder forSignalsOptionsAn implementation forSignalsOptionsIndicates how to allocate instance types to fulfill Spot capacity.Define a step scaling action.A fluent builder forStepScalingAction.Properties for a scaling policy.A builder forStepScalingActionPropsAn implementation forStepScalingActionPropsDefine a acaling strategy which scales depending on absolute values of some metric.A fluent builder forStepScalingPolicy.Example:A builder forStepScalingPolicyPropsAn implementation forStepScalingPolicyPropsExample:A fluent builder forTargetTrackingScalingPolicy.Properties for a concrete TargetTrackingPolicy.A builder forTargetTrackingScalingPolicyPropsAn implementation forTargetTrackingScalingPolicyPropsSpecifies the termination criteria to apply before Amazon EC2 Auto Scaling chooses an instance for termination.How existing instances should be updated.Define a warm pool.A fluent builder forWarmPool.Options for a warm pool.A builder forWarmPoolOptionsAn implementation forWarmPoolOptionsProperties for a warm pool.A builder forWarmPoolPropsAn implementation forWarmPoolProps