Profile Applicability:
- Level 2
Description:
Enable AWS CloudWatch Container Insights for Amazon ECS clusters to monitor resource usage, performance, and application health through metrics and logs.
Rationale:
Monitoring ECS clusters with Container Insights improves visibility into the health and performance of ECS applications, supports faster issue detection, and enhances security by identifying anomalies, errors, and resource bottlenecks.
Impact:
Enabling AWS CloudWatch Container Insights for ECS clusters incurs costs for metrics, log ingestion, storage, and alarms. However, the benefits of proactive monitoring and faster issue resolution justify the costs.
Default Value:
Monitoring is disabled by default for Amazon ECS clusters.
Pre-requisites:
AWS IAM permissions to modify ECS cluster settings: ecs:UpdateClusterSettings, ecs:DescribeClusters
CloudWatch permissions to view and update CloudWatch Container Insights settings: cloudwatch:PutMetricData, cloudwatch:DescribeAlarms
Remediation:
Test Plan:
Using AWS Console:
Log in to the ECS Console at AWS ECS Console.
In the left panel, click Clusters.
For each cluster listed, check the CloudWatch monitoring column and ensure that Container Insights is displayed.
Using AWS CLI:
Run the following command to list clusters:
aws ecs list-clusters
Run the following command to view the settings for a cluster:
aws ecs describe-clusters --clusters <cluster-arn> --include SETTINGS --query 'clusters[*].settings'
Ensure that containerInsights is set to enabled or enhanced.
Implementation Plan:
Using AWS Console:
Log in to the ECS Console at AWS ECS Console.
In the left panel, click Clusters.
Click the name of a cluster.
Click Update cluster.
Under Monitoring, select the radio button next to Container Insights or Container Insights with enhanced observability.
Click Update.
Repeat steps 1-6 for each ECS cluster requiring remediation.
Using AWS CLI:
For each cluster requiring remediation, run the following command to enable containerInsights
aws ecs update-cluster-settings --cluster <cluster-arn> --settings name=containerInsights,value=enabled
Backout Plan:
Using AWS Console:
If issues arise after enabling monitoring, revert the settings by following the same steps and deselecting Container Insights.
Using AWS CLI:
If issues arise, disable containerInsights by running the following command:
aws ecs update-cluster-settings --cluster <cluster-arn> --settings name=containerInsights,value=disabled
References:
AWS CLI: Update Cluster Settings
AWS CLI: Describe Clusters