You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support ASG-to-SQS Lifecycle Termination events (#568)
* Support ASG->SQS lifecycle termination events
* Update README with instructions for ASG->SQS direct lifecycle term events
* Improve readability and naming
* Rearrange QP setup instructions for clarity
* Update logging to clarify unsupported cases
Copy file name to clipboardExpand all lines: README.md
+54-36Lines changed: 54 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -194,45 +194,12 @@ For a full list of configuration options see our [Helm readme](https://github.co
194
194
195
195
The termination handler deployment requires some infrastructure to be setup before deploying the application. You'll need the following AWS infrastructure components:
196
196
197
-
1.AutoScaling Group Termination Lifecycle Hook
198
-
2.Amazon Simple Queue Service (SQS) Queue
197
+
1.Amazon Simple Queue Service (SQS) Queue
198
+
2.AutoScaling Group Termination Lifecycle Hook
199
199
3. Amazon EventBridge Rule
200
200
4. IAM Role for the aws-node-termination-handler Queue Processing Pods
201
201
202
-
#### 1. Setup a Termination Lifecycle Hook on an ASG:
203
-
204
-
Here is the AWS CLI command to create a termination lifecycle hook on an existing ASG, although this should really be configured via your favorite infrastructure-as-code tool like CloudFormation or Terraform:
This functionality is helpful in accounts where there are ASGs that do not run kubernetes nodes or you do not want aws-node-termination-handler to manage their termination lifecycle.
227
-
However, if your account is dedicated to ASGs for your kubernetes cluster, then you can turn off the ASG tag check by setting the flag `--check-asg-tag-before-draining=false` or environment variable `CHECK_ASG_TAG_BEFORE_DRAINING=false`.
228
-
229
-
You can also control what resources NTH manages by adding the resource ARNs to your Amazon EventBridge rules.
230
-
231
-
Take a look at the docs on how to create rules that only manage certain ASGs [here](https://docs.aws.amazon.com/autoscaling/ec2/userguide/cloud-watch-events.html).
232
-
233
-
See all the different events docs [here](https://docs.aws.amazon.com/eventbridge/latest/userguide/event-types.html#auto-scaling-event-types).
234
-
235
-
#### 3. Create an SQS Queue:
202
+
#### 1. Create an SQS Queue:
236
203
237
204
Here is the AWS CLI command to create an SQS queue to hold termination events from ASG and EC2, although this should really be configured via your favorite infrastructure-as-code tool like CloudFormation or Terraform:
If you are sending Lifecycle termination events from ASG directly to SQS, instead of through EventBridge, then you will also need to create an IAM service role to give Amazon EC2 Auto Scaling access to your SQS queue. Please follow [these linked instructions to create the IAM service role: link.](https://docs.aws.amazon.com/autoscaling/ec2/userguide/configuring-lifecycle-hook-notifications.html#sqs-notifications)
241
+
Note the ARNs for the SQS queue and the associated IAM role for Step 2.
242
+
243
+
#### 2. Setup a Termination Lifecycle Hook on an ASG:
244
+
245
+
Here is the AWS CLI command to create a termination lifecycle hook on an existing ASG when using EventBridge, although this should really be configured via your favorite infrastructure-as-code tool like CloudFormation or Terraform:
If you want to avoid using EventBridge and instead send ASG Lifecycle events directly to SQS, instead use the following command, using the ARNs from Step 1:
This functionality is helpful in accounts where there are ASGs that do not run kubernetes nodes or you do not want aws-node-termination-handler to manage their termination lifecycle.
281
+
However, if your account is dedicated to ASGs for your kubernetes cluster, then you can turn off the ASG tag check by setting the flag `--check-asg-tag-before-draining=false` or environment variable `CHECK_ASG_TAG_BEFORE_DRAINING=false`.
282
+
283
+
You can also control what resources NTH manages by adding the resource ARNs to your Amazon EventBridge rules.
284
+
285
+
Take a look at the docs on how to create rules that only manage certain ASGs [here](https://docs.aws.amazon.com/autoscaling/ec2/userguide/cloud-watch-events.html).
286
+
287
+
See all the different events docs [here](https://docs.aws.amazon.com/eventbridge/latest/userguide/event-types.html#auto-scaling-event-types).
288
+
273
289
#### 4. Create Amazon EventBridge Rules
274
290
291
+
You may skip this step if sending events from ASG to SQS directly.
292
+
275
293
Here are AWS CLI commands to create Amazon EventBridge rules so that ASG termination events, Spot Interruptions, Instance state changes, Rebalance Recommendations, and AWS Health Scheduled Changes are sent to the SQS queue created in the previous step. This should really be configured via your favorite infrastructure-as-code tool like CloudFormation or Terraform:
0 commit comments