> ## Documentation Index
> Fetch the complete documentation index at: https://help.nops.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete Unused ECS Service

> Delete Amazon ECS services that AWS reports as unused.

An ECS service keeps its tasks running, and billed, even when nothing sends them work. AWS Compute Optimizer flags ECS services on Fargate that have shown almost no CPU use over its lookback period as idle. nOps shows these with AWS's estimated monthly saving, which is the cost of the service's tasks.

| | |
| - | - |
| **Cloud** | AWS |
| **Category** | Compute |
| **Service** | Amazon ECS |
| **Action** | Delete |
| **Effort** | Low |
| **Restart needed** | No |
| **Can be rolled back** | No |
| **Analysis window** | Last 14 days |
| **Source** | AWS Compute Optimizer |

## Why it matters

Test services, old versions and abandoned experiments are easy to forget in a busy cluster, and each keeps paying for its tasks around the clock.

## How nOps finds it

This recommendation comes from AWS Compute Optimizer, not from nOps. Compute Optimizer marks a service as idle from its CloudWatch utilization over the lookback period. nOps imports the recommendation daily from AWS Cost Optimization Hub, which returns one recommendation per resource (the one with the highest saving), and shows AWS's estimated monthly saving, which already takes your discounts into account.

## Before you start

AWS Compute Optimizer and AWS Cost Optimization Hub enabled for the account (or the whole organization). Permission to update and delete ECS services (`ecs:UpdateService`, `ecs:DeleteService`).

## How to implement

1. Check the service's owner, recent deployments and any load balancer target groups or service discovery entries that point at it.
2. Scale it to zero first and wait a few days: `aws ecs update-service --cluster CLUSTER --service SERVICE --desired-count 0`.
3. If nothing breaks, delete it (ECS console: **Clusters → Services → Delete service**, or `aws ecs delete-service`).
4. Remove it from Terraform, CloudFormation or your deployment pipeline so it is not recreated.

## Risks and considerations

* A service that is idle most of the time may still be needed for occasional jobs or failover.
* Deleting the service does not delete its task definition, so you can recreate it later.
* Scaling to zero first is an easy way to test, and scaling back up restores it.

## Related

* [Rightsize ECS Service](https://help.nops.io/inform/supported-recommendations/rightsize-ecs-service)
* [Run Non-Production ECS Tasks on Fargate Spot](https://help.nops.io/inform/supported-recommendations/run-non-production-ecs-tasks-on-fargate-spot)
* [Supported recommendations](https://help.nops.io/inform/supported-recommendations.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.