Senior DevOps Engineer
Aamir has hands-on experience across AWS, Kubernetes, Terraform, Docker, and Python, with a strong foundation in cloud infrastructure, automation, and container orchestration.
When you run Kubernetes clusters on AWS, one of the biggest operational challenges is handling unexpected Amazon EC2 instance interruptions, whether caused by Spot instance interruptions, maintenance events, or Auto Scaling Group (ASG) scale-ins.
Without proper handling, workloads can be cut off mid-flight, leading to failed requests, degraded performance, or even downtime.
Enter the AWS Node Termination Handler (NTH), an open-source project by AWS that makes AWS EC2 interruptions graceful, predictable, and Kubernetes-native.
Before deploying AWS Node Termination Handler, check how your Amazon EKS worker nodes are managed.
If you use Amazon EKS managed node groups, you generally don't need NTH. EKS already manages the lifecycle of the underlying Amazon EC2 instances and automatically drains nodes during managed updates and terminations.
NTH is mainly relevant when you operate self-managed Amazon EC2 nodes or self-managed node groups, where you're responsible for responding to Spot interruptions, Auto Scaling events, scheduled maintenance, and other termination signals.
So, if your cluster uses EKS managed node groups, first confirm whether the built-in lifecycle handling already covers your requirements before adding another termination controller.
The AWS Node Termination Handler is a Kubernetes component that listens for AWS events like instance terminations or maintenance notices and ensures the node is cordoned and drained before shutdown.
That means:
Note: NTH is mainly needed for self-managed node groups (Amazon EC2-based). For Amazon EKS managed node groups, AWS automatically handles some termination behaviors, though NTH can still enhance observability and handling in edge cases.
NTH listens for AWS events such as:
NTH can run in two distinct modes, and you must choose only one at a time.
Both modes cordon and drain affected Kubernetes nodes, but they differ significantly in deployment complexity, AWS infrastructure requirements, and the interruption events they can handle.
| Factor | IMDS Processor Mode | Queue Processor Mode |
| Kubernetes deployment | DaemonSet running on each node | Centralized Deployment |
| Setup complexity | Lower | Higher |
| Additional AWS infrastructure | None required for basic operation | Requires Amazon SQS and Amazon EventBridge rules |
| IAM requirements | Minimal compared with Queue mode | Requires permissions for SQS and relevant AWS APIs |
| Spot interruption notices | Supported | Supported |
| Scheduled EC2 events | Supported through IMDS | Supported through event delivery to the queue |
| Instance Rebalance Recommendations | Supported | Supported |
| ASG target lifecycle state changes | Supported | Not used |
| ASG termination lifecycle hooks | Not supported | Supported |
| Availability Zone rebalance through lifecycle hooks | Not supported | Supported |
| EC2 instance state-change events | Not supported | Supported |
| Lifecycle heartbeats | Not supported | Supported |
| Best suited for | Simpler self-managed clusters primarily concerned with Spot interruptions, scheduled events, and rebalance recommendations | Production self-managed clusters that need broader event coverage, ASG lifecycle hooks, and more control over graceful termination |
Choose IMDS Processor mode when you want a lightweight setup and your termination handling primarily revolves around signals available through EC2 instance metadata.
Choose Queue Processor mode when your cluster needs to react to a wider range of infrastructure events, particularly ASG lifecycle hooks, scale-ins, Availability Zone rebalancing, and EC2 state changes. It also supports lifecycle heartbeats, which can extend the time available for workloads to drain before an Auto Scaling lifecycle action completes.
1. IMDS Processor Mode (DaemonSet)
This mode runs as a DaemonSet, with one pod on every node. It polls the Instance Metadata Service (IMDS) for signals like:

This mode runs as a centralized Deployment that consumes events from Amazon EventBridge → Amazon SQS.
It listens for all the events IMDS mode handles, plus a few more:

Best practice: If enableSqsTerminationDraining=true, do not enable IMDS draining in the same release. Choose one mode only.
When ASG scale-in starts, the instance moves into the Terminating:Wait state.
Normally, you get a few minutes (default 300s) before it’s forcibly terminated.
In Queue mode, NTH can send lifecycle heartbeats (RecordLifecycleActionHeartbeat) that keep the instance in WAIT state, up to 48 hours total, letting long-running Pods finish cleanly.
Use cases:


NTH emits metrics you can scrape using Prometheus Operator:
Depending on your deployment:
Also, NTH can emit Kubernetes Events (PreDrain, NodeDraining, PostDrain) for audit visibility.
Let’s validate your setup:
You should see:
a) Node cordoned
b) Pods draining gracefully
c) Termination completed cleanly

Running Kubernetes on AWS means dealing with ephemeral infrastructure.
By default, Amazon EC2 interruptions are abrupt — but with AWS Node Termination Handler, you can make them graceful and predictable.
If you’re running Amazon EC2 Spot Instances, using AWS Auto Scaling Groups, or operating in environments where graceful shutdown matters, NTH should be a must-have component in your cluster.