Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks
kirksaunders opened this issue Nov 17, 2023 · 5 comments · Fixed by #28092
Labels
aws-cdk-lib Related to the aws-cdk-lib package effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@kirksaunders
Copy link

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

@kirksaunders kirksaunders added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Nov 17, 2023
@github-actions github-actions bot added the aws-cdk-lib Related to the aws-cdk-lib package label Nov 17, 2023
@pahud
Copy link
Contributor

pahud commented Nov 17, 2023

Yes we welcome pull requests from the community for this feature. Before that, as CFN has supported it, we can use escape hatches to add property overrides as a workaround.

@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Nov 17, 2023
@go-to-k
Copy link
Contributor

go-to-k commented Nov 21, 2023

I will take this.

Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@abhishek-parative
Copy link

@go-to-k @pahud Is there a way to set the "Launch Before Terminate" setting via CDK? I looked through the attached PR and it only modifies the Min and Max health percentage.

@go-to-k
Copy link
Contributor

go-to-k commented Jul 26, 2024

@abhishek-parative

Yes, the "Launch Before Terminate" policy is equal to a setting with the Min = 100% (and the Max > 100%). So this setting allows the policy to be used in the CDK.

maintenance_policy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws-cdk-lib Related to the aws-cdk-lib package effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants