akria18 / awesome-aws-lifecycle-hooks

Awesome aws autoscaling lifecycle hooks for ECS, EKS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

awesome-aws-lifecycle-hooks

I was learning about lifecycle hooks recently. Before I added my own, I thought I'd do some research in the lifecycle hooks available. I was hoping to find a simple terraform module lambda for ECS. After some searching, I curated this list and thought "Why not another awesome list?" And the list was born.

Feel free to contribute.

Hooks

ECS

EKS

Backup

Testing

# set variables
INSTANCE_ID=i-aaaabbbbcccc
ASG_NAME=asg-xyz
LIFECYCLE_HOOK_NAME=lifecycle-xyz

# terminate a specific instance id
aws autoscaling \
  terminate-instance-in-auto-scaling-group \
  --should-decrement-desired-capacity \
  --instance-id $INSTANCE_ID

# once the instance is in a Terminating:Wait stage, continue the lifecycle
aws autoscaling \
  complete-lifecycle-action \
  --lifecycle-action-result CONTINUE \
  --lifecycle-hook-name $LIFECYCLE_HOOK_NAME \
  --auto-scaling-group-name $ASG_NAME \
  --instance-id $INSTANCE_ID

References

Blogs

Misc

About

Awesome aws autoscaling lifecycle hooks for ECS, EKS