Class TerminationPolicy
Specifies the termination criteria to apply before Amazon EC2 Auto Scaling chooses an instance for termination.
Inheritance
Namespace: Amazon.CDK.AWS.AutoScaling
Assembly: Amazon.CDK.AWS.AutoScaling.dll
Syntax (csharp)
public sealed class TerminationPolicy : Enum
Syntax (vb)
Public NotInheritable Class TerminationPolicy
Inherits
Enum
Remarks
ExampleMetadata: infused
Examples
Vpc vpc;
InstanceType instanceType;
IMachineImage machineImage;
new AutoScalingGroup(this, "ASG", new AutoScalingGroupProps {
Vpc = vpc,
InstanceType = instanceType,
MachineImage = machineImage,
// ...
TerminationPolicies = new [] { TerminationPolicy.OLDEST_INSTANCE, TerminationPolicy.DEFAULT }
});
Synopsis
Fields
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. |
value__ |
Fields
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).
public const TerminationPolicy ALLOCATION_STRATEGY
Field Value
Type | Description |
---|---|
TerminationPolicy |
CLOSEST_TO_NEXT_INSTANCE_HOUR
Terminate instances that are closest to the next billing hour.
public const TerminationPolicy CLOSEST_TO_NEXT_INSTANCE_HOUR
Field Value
Type | Description |
---|---|
TerminationPolicy |
DEFAULT
Terminate instances according to the default termination policy.
public const TerminationPolicy DEFAULT
Field Value
Type | Description |
---|---|
TerminationPolicy |
NEWEST_INSTANCE
Terminate the newest instance in the group.
public const TerminationPolicy NEWEST_INSTANCE
Field Value
Type | Description |
---|---|
TerminationPolicy |
OLDEST_INSTANCE
Terminate the oldest instance in the group.
public const TerminationPolicy OLDEST_INSTANCE
Field Value
Type | Description |
---|---|
TerminationPolicy |
OLDEST_LAUNCH_CONFIGURATION
Terminate instances that have the oldest launch configuration.
public const TerminationPolicy OLDEST_LAUNCH_CONFIGURATION
Field Value
Type | Description |
---|---|
TerminationPolicy |
OLDEST_LAUNCH_TEMPLATE
Terminate instances that have the oldest launch template.
public const TerminationPolicy OLDEST_LAUNCH_TEMPLATE
Field Value
Type | Description |
---|---|
TerminationPolicy |
value__
public int value__
Field Value
Type | Description |
---|---|
System.Int32 |