Skip to content
v2.273.0

UpdatePolicy Class ​

How existing instances should be updated.

Example ​

ts
declare const vpc: ec2.Vpc;
declare const instanceType: ec2.InstanceType;
declare const machineImage: ec2.IMachineImage;
declare const alarm: cloudwatch.Alarm;

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

  updatePolicy: autoscaling.UpdatePolicy.instanceRefresh({
    strategy: autoscaling.InstanceRefreshStrategy.ROLLING,
    minHealthyPercentage: 90,
    maxHealthyPercentage: 100,
    instanceWarmup: Duration.seconds(300),
    checkpointPercentages: [50, 100],
    checkpointDelay: Duration.minutes(10),
    alarms: [alarm],
  }),
});

Initializer ​

ts
new UpdatePolicy()
python
UpdatePolicy()
java
new UpdatePolicy()
csharp
new UpdatePolicy()
go
NewUpdatePolicy()

Methods ​

instanceRefresh(options: InstanceRefreshOptions): UpdatePolicy // chainable@staticmethod def instance_refresh(options: InstanceRefreshOptions) -> UpdatePolicypublic static UpdatePolicy instanceRefresh(InstanceRefreshOptions options)public static UpdatePolicy InstanceRefresh(InstanceRefreshOptions options)func InstanceRefresh(Options InstanceRefreshOptions) UpdatePolicystatic#
Use instance refresh to update the instances in the AutoScalingGroup.

When properties that trigger an instance refresh change (such as LaunchTemplate or MixedInstancesPolicy), CloudFormation starts an instance refresh to replace instances gradually while maintaining availability.

replacingUpdate(): UpdatePolicy // chainable@staticmethod def replacing_update() -> UpdatePolicypublic static UpdatePolicy replacingUpdate()public static UpdatePolicy ReplacingUpdate()func ReplacingUpdate() UpdatePolicystatic#
Create a new AutoScalingGroup and switch over to it.
rollingUpdate(options?: RollingUpdateOptions): UpdatePolicy // chainable@staticmethod def rolling_update(options: typing.Optional[RollingUpdateOptions] = None) -> UpdatePolicypublic static UpdatePolicy rollingUpdate(RollingUpdateOptions options)public static UpdatePolicy RollingUpdate(RollingUpdateOptions? options = null)func RollingUpdate(Options RollingUpdateOptions) UpdatePolicystatic#
Replace the instances in the AutoScalingGroup one by one, or in batches.