Skip to content

feat(autoscaling): add support for AutoScalingInstanceRefresh UpdatePolicy#38277

Open
ethanshen18 wants to merge 5 commits into
aws:mainfrom
ethanshen18:feat/autoscaling-instance-refresh-update-policy
Open

feat(autoscaling): add support for AutoScalingInstanceRefresh UpdatePolicy#38277
ethanshen18 wants to merge 5 commits into
aws:mainfrom
ethanshen18:feat/autoscaling-instance-refresh-update-policy

Conversation

@ethanshen18

@ethanshen18 ethanshen18 commented Jul 9, 2026

Copy link
Copy Markdown

Issue # (if applicable)

Closes #38276

Reason for this change

Support the newly released AutoScalingInstanceRefresh update policy. This new update policy was released on 2026-07-09: https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-attribute-updatepolicy.html#cfn-attributes-updatepolicy-instancerefresh

Description of changes

  • L2 API: Added UpdatePolicy.instanceRefresh(options?) to aws-autoscaling, mirroring the existing rollingUpdate() / replacingUpdate() static factories. The new InstanceRefreshOptions interface covers strategy, minHealthyPercentage, maxHealthyPercentage, instanceWarmup, skipMatching, checkpointPercentages, checkpointDelay, bakeTime, alarmNames, scaleInProtectedInstances, and standbyInstances.
  • Enums: Fixed value sets are modeled as enums rather than raw strings — InstanceRefreshStrategy, ScaleInProtectedInstances, and StandbyInstances — per the design guidelines.
  • L1 + cfn-include: Added the CfnUpdatePolicy.autoScalingInstanceRefresh field and the matching cfn-parse logic so existing templates containing this policy round-trip through cloudformation-include.

Describe any new or updated permissions being added

None. This change only configures an existing CloudFormation update policy on the AWS::AutoScaling::AutoScalingGroup resource; it does not add or modify any IAM permissions.

Description of how you validated changes

  • Unit tests: instanceRefresh() synthesis with defaults, with all options, and with strategy only; plus a cfn-include parse round-trip test for the new policy.
  • Integration test: integ.asg-instance-refresh-update-policy deployed successfully against a real AWS account; snapshot committed.
  • Manual end-to-end test: Deployed an ASG configured with UpdatePolicy.instanceRefresh(), changed the AMI to trigger the policy, and confirmed via describe-instance-refreshes that the instance refresh ran to Successful and honored the configured preferences (e.g. MinHealthyPercentage, InstanceWarmup), replacing all instances.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

…olicy

Add UpdatePolicy.instanceRefresh() so CDK users can configure the
AutoScalingInstanceRefresh update policy on an Auto Scaling group.
Previously CDK had no support for this policy.

Includes the L1 CfnUpdatePolicy field plus cfn-include parsing, the L2
UpdatePolicy.instanceRefresh() factory with strongly-typed enums and
options, README documentation, unit tests, and an integration test.
@ethanshen18
ethanshen18 requested a review from a team as a code owner July 9, 2026 17:51
@github-actions github-actions Bot added feature-request A feature should be added or improved. p2 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels Jul 9, 2026
@aws-cdk-automation
aws-cdk-automation requested a review from a team July 9, 2026 17:52
Comment thread packages/aws-cdk-lib/aws-autoscaling/lib/auto-scaling-group.ts Outdated

@mrmikeface mrmikeface left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good Ethan! Where do the docs get created? I think we should consider how to make those approachable

Comment thread packages/aws-cdk-lib/aws-autoscaling/README.md Outdated
Comment thread packages/aws-cdk-lib/aws-autoscaling/lib/auto-scaling-group.ts
Co-authored-by: caojason-stripe <caojason@stripe.com>
Address review feedback: rewrite the UpdatePolicy.instanceRefresh bullet
to match the style of the sibling rollingUpdate/replacingUpdate bullets,
and remove the now-unused instance-refresh link reference.
…pdate policy

Instance refresh does not support the cfn-signal helper script, so
`signals` configured on the AutoScalingGroup only gate the initial
creation and are not honored during an instance refresh. Emit a
synth-time warning when both are configured, and document the caveat on
`UpdatePolicy.instanceRefresh()`.

@mrmikeface mrmikeface left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks for the linter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK feature-request A feature should be added or improved. p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

autoscaling: support AutoScalingInstanceRefresh update policy

3 participants