# CfnAutoScalingInstanceRefresh

To specify how AWS CloudFormation handles instance refresh for an Auto Scaling group, use the AutoScalingInstanceRefresh update policy.

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

This policy is mutually exclusive with AutoScalingRollingUpdate.

- Source: [`core/lib/cfn-resource-policy.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/core/lib/cfn-resource-policy.ts#L314)
- Type last changed: v2.263.0 · 31 Jul 2026

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
const cfnAutoScalingInstanceRefresh: cdk.CfnAutoScalingInstanceRefresh = {
  strategy: 'strategy',

  // the properties below are optional
  preferences: {
    alarmSpecification: {
      alarms: ['alarms'],
    },
    bakeTime: 123,
    checkpointDelay: 123,
    checkpointPercentages: [123],
    instanceWarmup: 123,
    maxHealthyPercentage: 123,
    minHealthyPercentage: 123,
    scaleInProtectedInstances: 'scaleInProtectedInstances',
    skipMatching: false,
    standbyInstances: 'standbyInstances',
  },
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk

cfn_auto_scaling_instance_refresh = cdk.CfnAutoScalingInstanceRefresh(
    strategy="strategy",

    # the properties below are optional
    preferences=cdk.CfnAutoScalingInstanceRefreshPreferences(
        alarm_specification=cdk.CfnAutoScalingInstanceRefreshAlarmSpecification(
            alarms=["alarms"]
        ),
        bake_time=123,
        checkpoint_delay=123,
        checkpoint_percentages=[123],
        instance_warmup=123,
        max_healthy_percentage=123,
        min_healthy_percentage=123,
        scale_in_protected_instances="scaleInProtectedInstances",
        skip_matching=False,
        standby_instances="standbyInstances"
    )
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;

CfnAutoScalingInstanceRefresh cfnAutoScalingInstanceRefresh = CfnAutoScalingInstanceRefresh.builder()
        .strategy("strategy")

        // the properties below are optional
        .preferences(CfnAutoScalingInstanceRefreshPreferences.builder()
                .alarmSpecification(CfnAutoScalingInstanceRefreshAlarmSpecification.builder()
                        .alarms(List.of("alarms"))
                        .build())
                .bakeTime(123)
                .checkpointDelay(123)
                .checkpointPercentages(List.of(123))
                .instanceWarmup(123)
                .maxHealthyPercentage(123)
                .minHealthyPercentage(123)
                .scaleInProtectedInstances("scaleInProtectedInstances")
                .skipMatching(false)
                .standbyInstances("standbyInstances")
                .build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;

var cfnAutoScalingInstanceRefresh = new CfnAutoScalingInstanceRefresh {
    Strategy = "strategy",

    // the properties below are optional
    Preferences = new CfnAutoScalingInstanceRefreshPreferences {
        AlarmSpecification = new CfnAutoScalingInstanceRefreshAlarmSpecification {
            Alarms = new [] { "alarms" }
        },
        BakeTime = 123,
        CheckpointDelay = 123,
        CheckpointPercentages = new [] { 123 },
        InstanceWarmup = 123,
        MaxHealthyPercentage = 123,
        MinHealthyPercentage = 123,
        ScaleInProtectedInstances = "scaleInProtectedInstances",
        SkipMatching = false,
        StandbyInstances = "standbyInstances"
    }
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"

cfnAutoScalingInstanceRefresh := &CfnAutoScalingInstanceRefresh{
	Strategy: jsii.String("strategy"),

	// the properties below are optional
	Preferences: &CfnAutoScalingInstanceRefreshPreferences{
		AlarmSpecification: &CfnAutoScalingInstanceRefreshAlarmSpecification{
			Alarms: []*string{
				jsii.String("alarms"),
			},
		},
		BakeTime: jsii.Number(123),
		CheckpointDelay: jsii.Number(123),
		CheckpointPercentages: []*f64{
			jsii.Number(123),
		},
		InstanceWarmup: jsii.Number(123),
		MaxHealthyPercentage: jsii.Number(123),
		MinHealthyPercentage: jsii.Number(123),
		ScaleInProtectedInstances: jsii.String("scaleInProtectedInstances"),
		SkipMatching: jsii.Boolean(false),
		StandbyInstances: jsii.String("standbyInstances"),
	},
}
```

## Properties

- `preferences`: [CfnAutoScalingInstanceRefreshPreferences](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnAutoScalingInstanceRefreshPreferences.html) — The preferences for the instance refresh.

- `strategy`: string (required) — The strategy to use for the instance refresh.
