Skip to content

feat(autoscaling): add instanceLifecyclePolicy support to AutoScalingGroup Property#36434

Merged
mergify[bot] merged 11 commits intoaws:mainfrom
matoom-nomu:add-instanceLifecyclePolicy
Mar 24, 2026
Merged

feat(autoscaling): add instanceLifecyclePolicy support to AutoScalingGroup Property#36434
mergify[bot] merged 11 commits intoaws:mainfrom
matoom-nomu:add-instanceLifecyclePolicy

Conversation

@matoom-nomu
Copy link
Copy Markdown
Contributor

@matoom-nomu matoom-nomu commented Dec 18, 2025

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

@aws-cdk-automation aws-cdk-automation requested a review from a team December 18, 2025 06:49
@github-actions github-actions bot added p2 valued-contributor [Pilot] contributed between 6-12 PRs to the CDK labels Dec 18, 2025
Copy link
Copy Markdown
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

(This review is outdated)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 18, 2025

⚠️ Experimental Feature: This security report is currently in experimental phase. Results may include false positives and the rules are being actively refined.
This security report is NOT a review blocker. Please try merge from main to avoid findings unrelated to the PR.


TestsPassed ✅SkippedFailed
Security Guardian Results48 ran48 passed
TestResult
No test annotations available

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 18, 2025

⚠️ Experimental Feature: This security report is currently in experimental phase. Results may include false positives and the rules are being actively refined.
This security report is NOT a review blocker. Please try merge from main to avoid findings unrelated to the PR.


TestsPassed ✅SkippedFailed
Security Guardian Results with resolved templates48 ran48 passed
TestResult
No test annotations available

@aws-cdk-automation aws-cdk-automation dismissed their stale review December 19, 2025 13:48

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Dec 19, 2025
@gudipati gudipati self-assigned this Feb 11, 2026
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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the review.
I added sentence you mentioned to README.

@matoom-nomu matoom-nomu requested a review from gudipati February 16, 2026 05:12
},
},
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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),
});

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added LifecycleHook for each and rerun integ-test,
Thanks for review.

gudipati
gudipati previously approved these changes Mar 18, 2026
Copy link
Copy Markdown
Contributor

@gudipati gudipati left a comment

Choose a reason for hiding this comment

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

Looks good to me - approving. Could you update your branch with the latest changes from main ?

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 18, 2026

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).

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 18, 2026

Merge Queue Status

  • Entered queue2026-03-18 16:36 UTC · Rule: default-squash
  • 🚫 Left the queue2026-03-18 17:20 UTC · at 52b94dfe80185abda1d96bf27864a56beb930f86

This pull request spent 43 minutes 45 seconds in the queue, with no time running CI.

Reason

The pull request can't be updated

For security reasons, Mergify can't update this pull request. Try updating locally.
GitHub response: refusing to allow a GitHub App to create or update workflow .github/workflows/analytics-metadata-updater.yml without workflows permission

Hint

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Mar 18, 2026
Copy link
Copy Markdown
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

(This review is outdated)

@aws-cdk-automation aws-cdk-automation dismissed their stale review March 24, 2026 08:58

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@matoom-nomu matoom-nomu force-pushed the add-instanceLifecyclePolicy branch from b2857ad to 52b94df Compare March 24, 2026 09:13
@matoom-nomu matoom-nomu force-pushed the add-instanceLifecyclePolicy branch from b6dd439 to 52b94df Compare March 24, 2026 09:21
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Mar 24, 2026
gudipati
gudipati previously approved these changes Mar 24, 2026
@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Mar 24, 2026
@mergify mergify bot dismissed gudipati’s stale review March 24, 2026 10:07

Pull request has been modified.

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 24, 2026

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).

@mergify mergify bot merged commit b72ffcc into aws:main Mar 24, 2026
27 of 28 checks passed
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 24, 2026

Merge Queue Status

  • Entered queue2026-03-24 10:38 UTC · Rule: default-squash
  • Checks skipped · PR is already up-to-date
  • Merged2026-03-24 10:38 UTC · at d1b14d5816bcfc81405056192ce73af9412bcfc4

This pull request spent 7 seconds in the queue, with no time running CI.

Required conditions to merge

@github-actions
Copy link
Copy Markdown
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

p2 valued-contributor [Pilot] contributed between 6-12 PRs to the CDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants