aws / aws/aws-cdk

Support LifecycleHookSpecificationList for the L2 AutoScalingGroup construct

Open
#7,712 5 comments 12 reactions 0 assignees View on GitHub
@aws-cdk/aws-autoscaling effort/large feature-request mixins p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

`AutoScalingGroup#addLifecycleHook` inserts a LifeCycleHook-resrouce in the CFN-template that depends on the referenced ASG. This will result in the hook being created _after_ the initial ASG (and its instances) have been created. Therefore, the hooks are not triggered for these initial instances.

CFN allows the use of _LifecycleHookSpecificationList_ in the ASG specification. These hooks will also fire for the instances in the initial group.

### Use Case

I would like my hooks to be triggered for all instances in my ASG, not only after a scaling event.

### Proposed Solution

Extend interface `AutoScalingGroupProps` with property `lifecycleHookSpecificationList` and render according specifications.

There are two "reasonable" workarounds:
1. Use the Cfn-classes
2. Deploy first with `desiredCapacity = 0`, and then again with the desired `desiredCapacity`.

* [x] :wave: I may be able to implement this feature request
* [ ] :warning: This feature might incur a breaking change

---

This is a :rocket: Feature Request

Contributor guide

Open the contributing guide

Research direction

Locate the L2 AutoScalingGroup construct, its AutoScalingGroupProps interface, and the addLifecycleHook implementation. Compare how lifecycle hooks are rendered into the CloudFormation template, then inspect existing construct tests for the expected template assertions. Done means lifecycleHookSpecificationList is accepted and rendered so hooks apply to the initial instances.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.