feat(autoscaling): add instanceLifecyclePolicy support to AutoScalingGroup Property#36434
Conversation
|
|
||||||||||||||
|
|
||||||||||||||
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
| You can configure an instance lifecycle policy to control how instances are handled during lifecycle events, particularly when lifecycle hooks are abandoned or fail. This allows fine-grained control over when to preserve instances for manual intervention. | ||
|
|
||
| The instance lifecycle policy defines retention triggers that specify when instances should be moved to a Retained state rather than terminated. Retained instances don't count toward desired capacity and remain until you manually terminate them. | ||
|
|
There was a problem hiding this comment.
You can also mention this in the README from docs -
To use instance lifecycle policies in your Auto Scaling group, you must also configure a termination lifecycle hook. If you configure an instance lifecycle policy but don't have any termination lifecycle hooks, the policy has no effect. Instance lifecycle policies will only apply when termination lifecycle actions are abandoned, not when they complete successfully with the CONTINUE result.
There was a problem hiding this comment.
Thank you for the review.
I added sentence you mentioned to README.
…d-instanceLifecyclePolicy
| }, | ||
| }, | ||
| }); | ||
|
|
There was a problem hiding this comment.
Can we add the termination lifecycle hook in the test as well because it's required ?
// Add termination lifecycle hook - required for instance lifecycle policy to take effect
asg.addLifecycleHook('TerminationHook', {
lifecycleTransition: autoscaling.LifecycleTransition.INSTANCE_TERMINATING,
defaultResult: autoscaling.DefaultResult.ABANDON,
heartbeatTimeout: cdk.Duration.seconds(300),
});
There was a problem hiding this comment.
I added LifecycleHook for each and rerun integ-test,
Thanks for review.
gudipati
left a comment
There was a problem hiding this comment.
Looks good to me - approving. Could you update your branch with the latest changes from main ?
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Merge Queue Status
This pull request spent 43 minutes 45 seconds in the queue, with no time running CI. ReasonThe pull request can't be updated
HintYou should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. |
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
b2857ad to
52b94df
Compare
b6dd439 to
52b94df
Compare
…d-instanceLifecyclePolicy
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Merge Queue Status
This pull request spent 7 seconds in the queue, with no time running CI. Required conditions to merge
|
|
Comments on closed issues and PRs are hard for our team to see. |
Issue # (if applicable)
None
Reason for this change
AWS Auto Scaling groups now support Instance Lifecycle Policy to control instance behavior during lifecycle events.
Description of changes
Add InstanceLifecyclePolicy interface with RetentionTriggers configuration
Describe any new or updated permissions being added
None
Description of how you validated changes
Added unit tests and integ tests
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license