aws-cdk-lib.aws_autoscaling.TerminationPolicy

enum TerminationPolicy

LanguageType name
.NETAmazon.CDK.AWS.AutoScaling.TerminationPolicy
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsautoscaling#TerminationPolicy
Javasoftware.amazon.awscdk.services.autoscaling.TerminationPolicy
Pythonaws_cdk.aws_autoscaling.TerminationPolicy
TypeScript (source)aws-cdk-lib » aws_autoscaling » TerminationPolicy

Specifies the termination criteria to apply before Amazon EC2 Auto Scaling chooses an instance for termination.

Example

declare const vpc: ec2.Vpc;
declare const instanceType: ec2.InstanceType;
declare const machineImage: ec2.IMachineImage;

new autoscaling.AutoScalingGroup(this, 'ASG', {
  vpc,
  instanceType,
  machineImage,

  // ...

  terminationPolicies: [
    autoscaling.TerminationPolicy.OLDEST_INSTANCE,
    autoscaling.TerminationPolicy.DEFAULT,
  ],
});

Members

NameDescription
ALLOCATION_STRATEGYTerminate instances in the Auto Scaling group to align the remaining instances to the allocation strategy for the type of instance that is terminating (either a Spot Instance or an On-Demand Instance).
CLOSEST_TO_NEXT_INSTANCE_HOURTerminate instances that are closest to the next billing hour.
DEFAULTTerminate instances according to the default termination policy.
NEWEST_INSTANCETerminate the newest instance in the group.
OLDEST_INSTANCETerminate the oldest instance in the group.
OLDEST_LAUNCH_CONFIGURATIONTerminate instances that have the oldest launch configuration.
OLDEST_LAUNCH_TEMPLATETerminate instances that have the oldest launch template.

ALLOCATION_STRATEGY

Terminate instances in the Auto Scaling group to align the remaining instances to the allocation strategy for the type of instance that is terminating (either a Spot Instance or an On-Demand Instance).


CLOSEST_TO_NEXT_INSTANCE_HOUR

Terminate instances that are closest to the next billing hour.


DEFAULT

Terminate instances according to the default termination policy.


NEWEST_INSTANCE

Terminate the newest instance in the group.


OLDEST_INSTANCE

Terminate the oldest instance in the group.


OLDEST_LAUNCH_CONFIGURATION

Terminate instances that have the oldest launch configuration.


OLDEST_LAUNCH_TEMPLATE

Terminate instances that have the oldest launch template.