# ECS Cluster Missing Container Insights

> Flags production ECS clusters without Container Insights; dev and test clusters are skipped because the metrics cost money.

Source: https://zop.dev/integrations/aws/recommendations/ecs-cluster-missing-container-insights

---

## What Container Insights adds over default ECS metrics

Container Insights collects metrics down to individual tasks and containers and puts them on curated dashboards. The
[Container Insights guide](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cloudwatch-container-insights.html)
notes a newer mode, Container Insights with enhanced observability, released on December 2, 2024,
which AWS recommends over the original. Without either, finding the one task that is leaking memory
or restarting in a loop means digging through logs by hand.

## Reading the setting per cluster

The setting is only returned when you ask for cluster settings:

```bash
aws ecs describe-clusters \
  --clusters $(aws ecs list-clusters --query 'clusterArns[]' --output text) \
  --include SETTINGS \
  --query 'clusters[].[clusterName,settings[?name==`containerInsights`].value|[0]]' \
  --output table
```

Values are `enhanced`, `enabled` or `disabled`.

## The checks before a finding

ZopNight fires only when it read the cluster's settings and the Container Insights value was
explicitly off. If the settings were never requested for a cluster, the value is unknown, and unknown
is not treated as off. A customer tag named `container_insights` is ignored.

## Dev and test clusters are skipped on purpose

Because the fix costs money, clusters whose name or environment tag (`env`, `environment`,
`stage`, `tier`) marks them as dev or test are left out. An explicit production environment tag
overrides that, so a cluster called `test-harness` tagged `environment=prod` is still checked.

## Visibility has a price

The finding reports $0 and claims no saving. Turning it on raises spend: AWS states that metrics
collected by Container Insights are charged as custom metrics, so cost grows with the number of tasks
and containers. Start with production clusters where faster diagnosis pays for itself.

## Enabling Container Insights

1. Open the cluster in the ECS console and turn on Container Insights under Monitoring, or run
   `aws ecs update-cluster-settings --cluster CLUSTER --settings name=containerInsights,value=enhanced`
   (use `enabled` for the original version).
2. To default new clusters, set the `containerInsights` account setting.
3. Review the Container Insights dashboards for over-sized tasks or noisy neighbours.
