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_autoscaling: L2 construct for enabling capacity rebalance of autoscaling group #22625

Closed
2 tasks
IllarionovDimitri opened this issue Oct 24, 2022 · 4 comments · Fixed by #24025
Closed
2 tasks
Labels
@aws-cdk/aws-autoscaling Related to Amazon EC2 Auto Scaling effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. good first issue Related to contributions. See CONTRIBUTING.md p2

Comments

@IllarionovDimitri
Copy link

Describe the feature

L2 construct for enabling capacity rebalance of the autoscaling group by utilizing fleet with on-demand and spot instances.
In the recent aws-cdk-lib (2.47.0) it is not possible to activate capacity rebalance in the cdk stack. The operation must be performed manually after stack deployment.

Use Case

The goal of Capacity Rebalancing is to keep processing of workload without interruption. When Spot Instances are at an elevated risk of interruption, the Amazon EC2 Spot service notifies Amazon EC2 Auto Scaling with an EC2 instance rebalance recommendation.
By enabled Capacity Rebalancing for the Auto Scaling group, EC2 Auto Scaling attempts to proactively replace the Spot Instances in the group that have received a rebalance recommendation. This provides an opportunity to rebalance the workload to new Spot Instances that aren't at an elevated risk of interruption. The workload can continue to process the work while Amazon EC2 Auto Scaling launches new Spot Instances before your existing instances are interrupted.

Proposed Solution

L2 construct for enabling capacity rebalance could be implemented as a boolean value e.g. in aws_autoscaling.AutoScalingGroup() or in aws_autoscaling.MixedInstancesPolicy()

Other Information

No response

Acknowledgements

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

CDK version used

2.47.0

Environment details (OS name and version, etc.)

Ubuntu Linux 20.04 LTS

@IllarionovDimitri IllarionovDimitri added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Oct 24, 2022
@github-actions github-actions bot added the @aws-cdk/aws-autoscaling Related to Amazon EC2 Auto Scaling label Oct 24, 2022
@peterwoodworth
Copy link
Contributor

Thanks for the feature request, you're right we don't support this yet.

We won't need to create a brand new L2 construct for this, instead we could just add support for the CloudFormation property which can set capacity rebalancing on your asg. I think we could add this prop here if anyone wants to try contributing

const asgProps: CfnAutoScalingGroupProps = {

Since we don't yet offer what CloudFormation does, you can use escape hatches to make necessary adjustments.

In this case, we can manually set this property through the L2 AutoScalingGroup construct:

const asg = new AutoScalingGroup(this, 'ASG', {...});
(asg.node.defaultChild as CfnAutoScalingGroup).addPropertyOverride('CapacityRebalance', true);

I am marking this issue as p2, which means that we are unable to work on this immediately.

We use +1s to help prioritize our work, and are happy to revaluate this issue based on community feedback. You can reach out to the cdk.dev community on Slack to solicit support for reprioritization.

Check out our contributing guide if you're interested in contributing yourself - there's a low chance the team will be able to address this soon but we'd be happy to review a PR 🙂

@peterwoodworth peterwoodworth added good first issue Related to contributions. See CONTRIBUTING.md p2 effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels Nov 3, 2022
@IllarionovDimitri
Copy link
Author

Hello @peterwoodworth

thanks for feedback! I have tried today to implement this feature. It worked 👍🏻

Here is my code snippet in Python for all who missed this feature as well:

asg.node.default_child.add_property_override(
                    "CapacityRebalance", "true"
                )

@comcalvi comcalvi removed their assignment Nov 14, 2022
@MrSyn88
Copy link
Contributor

MrSyn88 commented Dec 8, 2022

@peterwoodworth looks like this might have been solved. Should this be closed?

@mergify mergify bot closed this as completed in #24025 Feb 10, 2023
mergify bot pushed a commit that referenced this issue Feb 10, 2023
…toscaling (#24025)

Add L2 construct for enabling capacity rebalance of autoscaling

Closes #22625.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-autoscaling Related to Amazon EC2 Auto Scaling effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. good first issue Related to contributions. See CONTRIBUTING.md p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants