Skip to content

aws-cdk-lib.aws-autoscaling: Add support for configuring AutoScalingGroup's instance maintenance policy #28042

@kirksaunders

Description

@kirksaunders

Describe the feature

AWS EC2 AutoScaling just added a new way to manage the replacement of instances, called the Instance Maintenance Policy (launch announcement). The policy allows you to control the percentage of instances above and below your desired capacity to allow during replacements/updates. And in particular, this policy now allows a "Launch-Before-Terminate" strategy, to perform replacements without impacting ASG healthy capacity.

Use Case

My team wants to use the new "Launch-Before-Terminate" feature to more safely update our ASGs. In particular, we have a few fleets with very few instances. To safely update now, we must overscale our fleets to maintain enough capacity for serving requests. With this new feature, we can keep our fleets descaled, and use the "Launch-Before-Terminate" feature to safely update.

Proposed Solution

Add a new property to the AutoScaling construct that allows you to set the instance maintenance policy.

Other Information

References for the policy:
[1] https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-instancemaintenancepolicy.html
[2] https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscaling-autoscalinggroup.html
[3] https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-instance-maintenance-policy.html
[4] https://docs.aws.amazon.com/autoscaling/ec2/userguide/set-instance-maintenance-policy-on-group.html
[5] https://aws.amazon.com/blogs/compute/introducing-instance-maintenance-policy-for-amazon-ec2-auto-scaling/

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

v2.109.0

Environment details (OS name and version, etc.)

Amazon Linux 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    aws-cdk-libRelated to the aws-cdk-lib packageeffort/mediumMedium work item – several days of effortfeature-requestA feature should be added or improved.p2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions