InstanceRefreshOptions

class aws_cdk.aws_autoscaling.InstanceRefreshOptions(*, strategy, alarms=None, bake_time=None, checkpoint_delay=None, checkpoint_percentages=None, instance_warmup=None, max_healthy_percentage=None, min_healthy_percentage=None, scale_in_protected_instances=None, skip_matching=None, standby_instances=None)

Bases: object

Options for customizing the instance refresh update policy.

Parameters:
  • strategy (InstanceRefreshStrategy) – The strategy to use for the instance refresh.

  • alarms (Optional[Sequence[IAlarmRef]]) – The CloudWatch alarms to monitor during the instance refresh. If any of the alarms goes into ALARM state, the instance refresh fails. You can specify up to 10 alarms. Default: - no alarms

  • bake_time (Optional[Duration]) – The amount of time after an instance refresh completes successfully before CloudFormation considers the update successful. Default: Duration.seconds(0)

  • checkpoint_delay (Optional[Duration]) – The amount of time to wait after a checkpoint is reached before continuing. Default: - 3600 seconds (1 hour), applied only when checkpointPercentages is set

  • checkpoint_percentages (Optional[Sequence[Union[int, float]]]) – Threshold values for each checkpoint in ascending order. Each number must be unique. To replace all instances in the group, the last number in the array must be 100. Default: - no checkpoints

  • instance_warmup (Optional[Duration]) – The amount of time to wait after a new instance enters the InService state before moving on to refresh the next instance. Default: - the group’s DefaultInstanceWarmup if defined; otherwise the group’s HealthCheckGracePeriod

  • max_healthy_percentage (Union[int, float, None]) – The maximum percentage of the group that can be in service and healthy, or pending, to support your workload during the instance refresh. The difference between maxHealthyPercentage and minHealthyPercentage cannot be greater than 100. A larger range increases the number of instances that can be replaced at the same time. Default: - the value set in the Auto Scaling group’s instance maintenance policy, if defined; otherwise 110 when the strategy is Rolling, or 100 when the strategy is ReplaceRootVolume

  • min_healthy_percentage (Union[int, float, None]) – The minimum percentage of the group to keep in service, healthy, and ready to use to support your workload during the instance refresh, expressed as a percentage of the group’s desired capacity. Default: - the value set in the Auto Scaling group’s instance maintenance policy, if defined; otherwise 100 when the strategy is Rolling, or 90 when the strategy is ReplaceRootVolume

  • scale_in_protected_instances (Optional[ScaleInProtectedInstances]) – Specifies the behavior of instances that are protected from scale in during an instance refresh. Default: ScaleInProtectedInstances.WAIT

  • skip_matching (Optional[bool]) – Indicates whether skip matching is enabled. Default: true

  • standby_instances (Optional[StandbyInstances]) – Specifies the behavior of instances in standby during an instance refresh. Default: StandbyInstances.WAIT

ExampleMetadata:

infused

Example:

# vpc: ec2.Vpc
# instance_type: ec2.InstanceType
# machine_image: ec2.IMachineImage
# alarm: cloudwatch.Alarm


autoscaling.AutoScalingGroup(self, "ASG",
    vpc=vpc,
    instance_type=instance_type,
    machine_image=machine_image,

    update_policy=autoscaling.UpdatePolicy.instance_refresh(
        strategy=autoscaling.InstanceRefreshStrategy.ROLLING,
        min_healthy_percentage=90,
        max_healthy_percentage=100,
        instance_warmup=Duration.seconds(300),
        checkpoint_percentages=[50, 100],
        checkpoint_delay=Duration.minutes(10),
        alarms=[alarm]
    )
)

Attributes

alarms

The CloudWatch alarms to monitor during the instance refresh.

If any of the alarms goes into ALARM state, the instance refresh fails. You can specify up to 10 alarms.

Default:
  • no alarms

bake_time

The amount of time after an instance refresh completes successfully before CloudFormation considers the update successful.

Default:

Duration.seconds(0)

checkpoint_delay

The amount of time to wait after a checkpoint is reached before continuing.

Default:
  • 3600 seconds (1 hour), applied only when checkpointPercentages is set

checkpoint_percentages

Threshold values for each checkpoint in ascending order.

Each number must be unique. To replace all instances in the group, the last number in the array must be 100.

Default:
  • no checkpoints

instance_warmup

The amount of time to wait after a new instance enters the InService state before moving on to refresh the next instance.

Default:
  • the group’s DefaultInstanceWarmup if defined; otherwise the group’s HealthCheckGracePeriod

max_healthy_percentage

The maximum percentage of the group that can be in service and healthy, or pending, to support your workload during the instance refresh.

The difference between maxHealthyPercentage and minHealthyPercentage cannot be greater than 100. A larger range increases the number of instances that can be replaced at the same time.

Default:
  • the value set in the Auto Scaling group’s instance maintenance policy, if defined; otherwise 110 when the strategy is Rolling, or 100 when the strategy is ReplaceRootVolume

min_healthy_percentage

The minimum percentage of the group to keep in service, healthy, and ready to use to support your workload during the instance refresh, expressed as a percentage of the group’s desired capacity.

Default:
  • the value set in the Auto Scaling group’s instance maintenance policy, if defined; otherwise 100 when the strategy is Rolling, or 90 when the strategy is ReplaceRootVolume

scale_in_protected_instances

Specifies the behavior of instances that are protected from scale in during an instance refresh.

Default:

ScaleInProtectedInstances.WAIT

skip_matching

Indicates whether skip matching is enabled.

Default:

true

standby_instances

Specifies the behavior of instances in standby during an instance refresh.

Default:

StandbyInstances.WAIT

strategy

The strategy to use for the instance refresh.