class UpdatePolicy
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.AutoScaling.UpdatePolicy |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsautoscaling#UpdatePolicy |
Java | software.amazon.awscdk.services.autoscaling.UpdatePolicy |
Python | aws_cdk.aws_autoscaling.UpdatePolicy |
TypeScript (source) | aws-cdk-lib » aws_autoscaling » UpdatePolicy |
How existing instances should be updated.
Example
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
new UpdatePolicy()
Methods
| Name | Description |
|---|---|
| static instance | Use instance refresh to update the instances in the AutoScalingGroup. |
| static replacing | Create a new AutoScalingGroup and switch over to it. |
| static rolling | Replace the instances in the AutoScalingGroup one by one, or in batches. |
static instanceRefresh(options)
public static instanceRefresh(options: InstanceRefreshOptions): UpdatePolicy
Parameters
- options
InstanceRefresh Options
Returns
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.
static replacingUpdate()
public static replacingUpdate(): UpdatePolicy
Returns
Create a new AutoScalingGroup and switch over to it.
static rollingUpdate(options?)
public static rollingUpdate(options?: RollingUpdateOptions): UpdatePolicy
Parameters
- options
RollingUpdate Options
Returns
Replace the instances in the AutoScalingGroup one by one, or in batches.

.NET
Go
Java
Python
TypeScript (