(autoscaling): Enhance Lambda permissions for EC2 Autoscaling Lifecycle Hooks
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 74
Description
I'm defining EC2 lifecycle hook with Lambda target using asg.addLifecycleHook() function.
```
asg.addLifecycleHook("terminateHook",{
lifecycleTransition: LifecycleTransition.INSTANCE_TERMINATING,
notificationTarget: new hooktargets.FunctionHook(scaledownlifecycleHookFn),
defaultResult: autoscaling.DefaultResult.CONTINUE,
heartbeatTimeout: cdk.Duration.seconds(120)
})
```
When the Lambda executes it gets error: "not authorized to perform: autoscaling:CompleteLifecycleAction" when sends lifecycle completion message to autoscaling.
### Proposed Solution
Automatically grant *autoscaling:CompleteLifecycleAction* permission to Lambda function set as a lifecycle hook target.
Contributor guide
Research direction
Start at asg.addLifecycleHook() and trace the EC2 autoscaling Lambda hook target integration, including how its permissions are configured. Done means a Lambda used as the lifecycle hook target can call autoscaling:CompleteLifecycleAction without requiring manual authorization.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100