Amazon ECS: New LiveTaskCount Metric and Free RunningTaskCount
Amazon ECS has added the LiveTaskCount metric, and RunningTaskCount in Container Insights no longer incurs a charge. This article explains how the two metrics differ through the task lifecycle, and covers how to check them with the AWS CLI, CloudWatch alarm examples, and when to use each.
Introduction
On October 13, 2026, AWS announced an update for Amazon ECS.
LiveTaskCount has been added as a new ECS service metric, and RunningTaskCount , an existing Amazon CloudWatch Container Insights metric, is now available at no additional charge.Have you ever scaled in an ECS service and found that the task count metric looked lower than reality, even though tasks were still handling requests while draining connections behind the load balancer? This update is about how task counts are reported.
This article first summarizes what changed, then explains the task lifecycle and the difference between the two metrics. After that, it walks through how to check the metrics with the AWS CLI and shows CloudWatch alarm examples, and closes with use cases and points to keep in mind when adopting them.
It is written for engineers who operate ECS, and for managers who want to review their monitoring costs.
What Changed
The announcement consists of two parts: a new metric, and a pricing change for an existing metric. Here is a Before / After comparison.
Overview of Changes
Item | RunningTaskCount | LiveTaskCount |
|---|---|---|
Positioning | Existing (Container Insights metric) | New (ECS service utilization metric) |
Tasks counted | Tasks whose current state and desired state are both RUNNING | Tasks in the ACTIVATING , RUNNING , and DEACTIVATING states |
Container Insights required | Yes | No |
Pricing (Before) | Charged | Not applicable |
Pricing (After) | No additional charge | No additional charge |
Main use | Checking service health and stability | Getting a complete view of active tasks and monitoring capacity |
The biggest difference is that
LiveTaskCount also counts tasks that are transitioning to a stopped state. The two metrics do not replace each other; they coexist with different roles.Points to Note
Only
RunningTaskCount is now free of charge. The other metrics collected by Container Insights (such as CPU, memory, disk, and network) are still charged as custom metrics. You also still need to enable Container Insights to use RunningTaskCount . There are three ways to enable it: opting in to the containerInsights account setting, turning on the cluster setting when you create a cluster, or calling the UpdateClusterSettings API on an existing cluster. Container Insights as a whole has not become free.The pricing change took effect on October 1, 2026, not on the announcement date of October 13, and has already been applied. It is applied automatically, so no configuration change is required.
The two metrics use different namespaces.
LiveTaskCount appears in the AWS/ECS namespace as an ECS metric, and RunningTaskCount appears in the ECS/ContainerInsights namespace as a Container Insights metric. Both use the ClusterName and ServiceName dimensions. Be careful not to confuse the namespaces when you look for the metrics.Both metrics are available in all AWS Regions where Amazon ECS is available. Note that ECS metrics are collected for resources that have tasks in the
RUNNING state, so no metrics are reported for a service that has no running tasks.
How It Works
The difference between
LiveTaskCount and RunningTaskCount is easier to understand once you know the ECS task lifecycle. This chapter covers the states a task goes through and the range each metric counts, and then looks at how the metric values behave during a scale-in.Task Lifecycle and Measurement Scope
An ECS task goes through several states from start to stop. The official documentation describes them in this order:
PROVISIONING , PENDING , ACTIVATING , RUNNING , DEACTIVATING , STOPPING , DEPROVISIONING , and STOPPED . The range counted by LiveTaskCount is shown in the following diagram.
The three states in the measurement scope have the following meanings. A task in the
ACTIVATING state is preparing to serve traffic, for example by registering with load balancer target groups and service discovery, before it becomes RUNNING . A task in the RUNNING state is running and available to receive traffic and handle requests. A task in the DEACTIVATING state is performing the processing needed before it is stopped; for services that use target groups, deregistration and connection draining happen here. As a result, the task is on its way to stopping but still handles its existing connections.The following table shows whether each metric counts a task in each state.
Task state | RunningTaskCount | LiveTaskCount |
|---|---|---|
PROVISIONING , PENDING | Not counted | Not counted |
ACTIVATING | Not counted | Counted |
RUNNING (desired state is also RUNNING ) | Counted | Counted |
RUNNING (transition to a stopped state has begun) | Not counted | Counted |
DEACTIVATING | Not counted | Counted |
STOPPING and later | Not counted | Not counted |
Metric Behavior During Scale-In
The difference is most visible during a scale-in. Consider an ECS service behind a load balancer whose task count is reduced from two to one.
The task selected for removal is deregistered from the target group and enters the
DEACTIVATING state. The load balancer's deregistration delay then applies, and the task keeps processing its existing connections for the configured period. For Application Load Balancer (ALB) target groups, the deregistration delay can be set from 0 to 3,600 seconds, and the default is 300 seconds.Based on the definitions, the metric values change as follows during this period.
Phase | Task status | RunningTaskCount | LiveTaskCount |
|---|---|---|---|
Before scale-in | Both tasks running normally | 2 | 2 |
During draining | One task running, one in DEACTIVATING and processing connections | 1 | 2 |
After draining | One task running, the other in STOPPING or later | 1 | 1 |
The difference of one during draining is the task that is still processing traffic. Once draining finishes and the task leaves
DEACTIVATING , the two metrics converge to the same value.The official documentation states that
RunningTaskCount does not count tasks that are transitioning to a stopped state. On the other hand, the values in the table above were not measured on a real environment; they are derived from the definitions. The actual timing of the changes is affected by the draining settings and the one-minute metric interval, so you can verify it in your own environment by following the steps in the next chapter.This behavior also affects how you design alarms on
LiveTaskCount . During a rolling deployment, new tasks that are starting ( ACTIVATING ) and old tasks that are draining ( DEACTIVATING ) overlap, so the metric can temporarily exceed the desired task count. During a scale-in, it also stays higher than the desired task count for as long as the deregistration delay lasts (300 seconds by default). These are inferences drawn from the definitions, but it is safer to allow for them when you choose thresholds and evaluation periods.
Hands-On
This chapter shows how to confirm the draining difference described in the previous chapter with the AWS CLI, and gives CloudWatch alarm examples.
Prerequisites
The steps use an ECS service attached to an Application Load Balancer (ALB) target group. In the commands below, values that differ for each reader are shown as placeholders.
# Replace the parts enclosed in <> with values from your own environmentCLUSTER=<cluster-name>SERVICE=<service-name>TG_ARN=arn:aws:elasticloadbalancing:<region>:<account-id>:targetgroup/<target-group-name>/<target-group-id>
# Enable Container Insights on an existing cluster (required to check RunningTaskCount)aws ecs update-cluster-settings \ --cluster $CLUSTER \ --settings name=containerInsights,value=enabled
# Set the deregistration delay to 120 seconds (for testing; revert it afterward)aws elbv2 modify-target-group-attributes \ --target-group-arn $TG_ARN \ --attributes Key=deregistration_delay.timeout_seconds,Value=120Once Container Insights is enabled, metrics other than
RunningTaskCount are charged. Try this on a test cluster, and disable Container Insights again in the "Cleanup" section when you are done. ECS metrics are sent to CloudWatch at one-minute intervals, so if the deregistration delay is too short, you may not be able to observe the values changing during draining. If your goal is observation, setting it to more than one minute makes the change easier to see.Comparing Values During Scale-In
Let the service stabilize with two tasks, and then reduce the desired task count to one.
# Change the desired task count from 2 to 1 (scale-in)aws ecs update-service \ --cluster $CLUSTER \ --service $SERVICE \ --desired-count 1Next, retrieve the metric values. The following command is an example for
LiveTaskCount . To retrieve RunningTaskCount , replace --namespace with ECS/ContainerInsights and --metric-name with RunningTaskCount .# Retrieve LiveTaskCount at one-minute intervalsaws cloudwatch get-metric-statistics \ --namespace AWS/ECS \ --metric-name LiveTaskCount \ --dimensions Name=ClusterName,Value=$CLUSTER Name=ServiceName,Value=$SERVICE \ --start-time <start-time> \ --end-time <end-time> \ --period 60 \ --statistics MaximumSpecify the start and end times in UTC ISO 8601 format (for example,
2026-11-10T01:00:00Z ), matching the time window of your test.If you also want to check the task states, you can use the following commands. By default,
list-tasks returns only tasks whose desired status is RUNNING , so specify --desired-status STOPPED to see tasks that are on their way to stopping. Note that recently stopped tasks may also appear in the results.# Check the state of tasks that are transitioning to a stopped stateTASKS=$(aws ecs list-tasks \ --cluster $CLUSTER \ --service-name $SERVICE \ --desired-status STOPPED \ --query 'taskArns' --output text)
aws ecs describe-tasks \ --cluster $CLUSTER \ --tasks $TASKS \ --query 'tasks[].[taskArn,lastStatus,desiredStatus]' \ --output tableCloudWatch Alarm Examples
Here are two alarm examples. Both are design sketches, so adjust the thresholds and evaluation periods to the characteristics of your service. Note that CloudWatch alarms incur standard alarm charges separately from the metrics.
Example 1: Monitoring Capacity
The first example monitors capacity with
LiveTaskCount . It sends a notification when the number of tasks actually running, including tasks that are draining, exceeds a given value.# Notify when LiveTaskCount stays above 10 for 5 minutesaws cloudwatch put-metric-alarm \ --alarm-name ecs-live-task-count-high \ --namespace AWS/ECS \ --metric-name LiveTaskCount \ --dimensions Name=ClusterName,Value=$CLUSTER Name=ServiceName,Value=$SERVICE \ --statistic Maximum \ --period 60 \ --evaluation-periods 5 \ --threshold 10 \ --comparison-operator GreaterThanThreshold \ --alarm-actions arn:aws:sns:<region>:<account-id>:<topic-name>Example 2: Detecting Prolonged State Transitions
The second example uses metric math. The value of
LiveTaskCount minus RunningTaskCount is the total of tasks that are starting and tasks that are transitioning to a stopped state. The alarm sends a notification when this state lasts longer than expected. Because it uses RunningTaskCount , Container Insights must be enabled on the target cluster.# Metric math definition (save as metrics.json)[ { "Id": "diff", "Expression": "live - running", "Label": "Tasks starting or transitioning to stopped", "ReturnData": true }, { "Id": "live", "MetricStat": { "Metric": { "Namespace": "AWS/ECS", "MetricName": "LiveTaskCount", "Dimensions": [ {"Name": "ClusterName", "Value": "<cluster-name>"}, {"Name": "ServiceName", "Value": "<service-name>"} ] }, "Period": 60, "Stat": "Maximum" }, "ReturnData": false }, { "Id": "running", "MetricStat": { "Metric": { "Namespace": "ECS/ContainerInsights", "MetricName": "RunningTaskCount", "Dimensions": [ {"Name": "ClusterName", "Value": "<cluster-name>"}, {"Name": "ServiceName", "Value": "<service-name>"} ] }, "Period": 60, "Stat": "Maximum" }, "ReturnData": false }]# Notify when the difference stays above 0 for 15 minutesaws cloudwatch put-metric-alarm \ --alarm-name ecs-task-transition-long \ --metrics file://metrics.json \ --evaluation-periods 15 \ --threshold 0 \ --comparison-operator GreaterThanThreshold \ --alarm-actions arn:aws:sns:<region>:<account-id>:<topic-name>This difference also becomes larger while tasks are starting during a deployment or a scale-out. Unless the evaluation period is longer than the time a normal deployment or draining takes, you may get more false positives. This usage is also not officially recommended; it is an example derived from the definitions of the two metrics. If you adopt it, check how the values behave in a test environment first.
Cleanup
When you have finished testing, revert the settings you changed. Restore the deregistration delay to its original value, and change the service's task count back if necessary. If you enabled Container Insights for the test, disable it again. Delete any alarms you no longer need.
# Disable Container Insights again (if you enabled it for the test)aws ecs update-cluster-settings \ --cluster $CLUSTER \ --settings name=containerInsights,value=disabled
# Delete the alarmsaws cloudwatch delete-alarms \ --alarm-names ecs-live-task-count-high ecs-task-transition-long
Use Cases
So far, we have looked at the difference between the two metrics and how to check them. This chapter organizes which metric to use, and how, based on problems you may face in practice.
Monitoring Real Capacity During Scale-In
The first case is when you want to know how many tasks are actually running, even in the middle of a scale-in. A draining task no longer receives new requests, but it keeps processing its existing connections. If you look only at
RunningTaskCount , these tasks drop out of the count, and the service appears to have more headroom than it actually does.LiveTaskCount also counts tasks that are on their way to stopping. The official documentation likewise explains that, because a task that is still serving traffic while it drains is counted, the metric is well suited for auto scaling alarms and capacity monitoring. As in Example 1 of the "Hands-On" chapter, you can use it as the basis for an alarm that notifies you when you approach an upper limit. Choose the threshold and evaluation period with the peak during deployments and the deregistration delay in mind, as discussed in the "How It Works" chapter.Detecting Failed Deployments and Stopped Tasks
The second case is when you want to know whether the service is running with the expected number of tasks.
RunningTaskCount is still the metric to use here.RunningTaskCount counts only tasks that are running normally, so it serves as a signal of the health and stability of the service. The official documentation also gives an example of setting an alarm that fires when the number of running tasks falls below a specified value. When you want to detect that fewer tasks are running because tasks stopped or a deployment failed to start, use this metric as the basis.Reviewing Monitoring Costs
The third case is when you want to review your monitoring costs. Consider the following two situations separately.
If you have already enabled Container Insights, the additional charge for
RunningTaskCount has been removed since October 1, 2026. Check the relevant line items in your bill. You can roughly estimate the savings by multiplying the number of target clusters and services by the unit price of a custom metric (this is my own rough calculation, not an official formula). Check the unit price on the CloudWatch pricing page. However, the other metrics collected by Container Insights are still charged, so whether to review your use of Container Insights itself depends on how much you need those other metrics.If you have not enabled Container Insights,
LiveTaskCount is an option, because you can check task counts at no additional charge without enabling Container Insights. However, LiveTaskCount is not a replacement for RunningTaskCount . If your goal is to check health, choose a metric with the difference in what each one counts in mind.Quick Reference
Finally, here is a table of which metric to use for each problem.
Problem | Metric to use | Main reason |
|---|---|---|
I want to know the actual task count, including during scale-in | LiveTaskCount | It also counts draining tasks |
I want to detect failed deployments or stopped tasks | RunningTaskCount | It counts only tasks whose current and desired states are both RUNNING |
I want to check task counts without Container Insights | LiveTaskCount | It requires no opt-in and has no additional charge |
I want to review the monitoring cost of my existing RunningTaskCount | RunningTaskCount | The additional charge was removed on October 1, 2026 |
Summary
With this update, ECS gains
LiveTaskCount , a metric that counts the tasks actually running, including those that are transitioning to a stopped state. RunningTaskCount can continue to be used, at no additional charge, as the metric that counts tasks running healthily.As a first step, check
LiveTaskCount and review whether your existing alarms should be watching one metric or the other. Keep in mind that only RunningTaskCount is now free; the other Container Insights metrics are still charged.
References
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article