ASG and lifecycle hooks

ASG and lifecycle hooks

A513bc1fa519d2fcf5e4e0d9b5500101?s=128

Sibi

May 15, 2019
Tweet

Transcript

  1. ASG and lifecycle hooks ASG and lifecycle hooks Sibi Prabakaran

    May 15, 2019
  2. Objective Objective Run scripts before terminating EC2 instances of an

    ASG group Like de registering the instances from ALB. Inform Kubernetes/Nomad that this instance is in-eligible for new tasks
  3. Terminology Terminology ASG: Collection of EC2 instances with policies on

    scaling. Lifecycle hooks: Like callbacks which can be added to ASG.
  4. ASG Events ASG Events Scale Out: Instructs ASG to launch

    new instances. Scale In: Instructs ASG to detach EC2 instances. Fired on Manually increasing the size of the group Based on Policy (like demand) Based on Schedule
  5. ASG Events (2) ASG Events (2) On receiving the events,

    the ASG will put the instance into Pending or Terminating state. If you have defined any lifecycle hooks - that will happen in this state. Timeouts
  6. lifecycled lifecycled Daemon built by buildkite for gracefully handling EC2

    scaling events. When a termination notice is received, lifecycled runs a user provided script before proceeding to shutdown the instance. Repo: https://github.com/buildkite/lifecycled
  7. Demo Demo PR: https://github.com/fpco/terraform-aws-foundation/pull/189 Testing instance: http://18.222.32.132:3000 Based on vpc

    scenario 1 (VPC with single public subnet). ASG with two EC2 instances, also registered with ELB. Instances has lifecycled installed on it.
  8. Questions Questions