Guides
Advanced
Container Insights

Enabling Container Insights for ECS

Amazon provides advanced monitoring capabilities for ECS tasks through Container Insights (opens in a new tab).

These metrics are available in the AWS CloudWatch Console, and you can also use them for alarms.

Understanding AWS Costs for Container Insights

Each container you enable insights on adds additional costs for CloudWatch Metrics and Logs (from Amazon). For this reason, we suggest only using insights on the containers you need to monitor. Flightcontrol does not enable container insights by default.

For more on the AWS costs, see Amazon's CloudWatch Pricing documentation (opens in a new tab).

Setting up Container Insights with Flightcontrol

You will need to use the flightcontrol.json configuration file - this support is not yet available in the dashboard.

For each service that uses container insights , add the containerInsights flag with a value of true. The default is false.

For example:

"services": [
    {
        "id": "my-webapp",
        "name": "My Webapp",
        "type": "web",
        "target": {
          "type": "fargate"
        },
        "buildType": "nixpacks",
        "ci": {
          "type": "ec2"
        },
        "cpu": 0.5,
        "memory": 1,
        "containerInsights": true
    }
]

Verifying that Container Insights is Enabled

Once you have deployed your configuration, you can verify that container insights is enabled by checking the ECS Service Definition in the AWS Console.

Verify that Container Insights is enabled in the AWS Console

Above is an example, showing that container insights is enabled for this service. Container Insights will appear in green, with a checkmark, underneath the CloudWatch monitoring header.

Collected Metrics from ECS Container Insights

The complete documentation for which metrics are collected is available in the Amazon ECS Container Insights documentation (opens in a new tab).

Generally speaking, the most useful metrics are related to CPU and memory utilization. There are also metrics for network traffic, storage read and write operations, and more.

Viewing Container Insights in the AWS Console

Once you have enabled container insights, you can view the metrics in the AWS CloudWatch console.

You can find the View Container Insights button on the ECS Service page, under the Metrics tab.

Location of the Container Insights Button in the AWS Console

Clicking that View Container Insights button takes you to a dashboard to view the insights.

Container Insights Performance Monitoring Dashboard in the AWS Console

This dashboard shows the performance of the service over time. You can configure a new dashboard that uses some of these metrics, or create alarms based on the metrics.