DEV Community

Cover image for Day 12: Monitoring and Logging with CloudWatch and ECS Insights
Pragnesh Patel
Pragnesh Patel

Posted on

Day 12: Monitoring and Logging with CloudWatch and ECS Insights

Continuing Day 11, monitor health.

Enable CloudWatch Logs

In task def, add:

"logConfiguration": {
  "logDriver": "awslogs",
  "options": {
    "awslogs-group": "/ecs/my-task",
    "awslogs-region": "us-west-2",
    "awslogs-stream-prefix": "ecs"
  }
}
Enter fullscreen mode Exit fullscreen mode

Create log group first.

Cloudwatch

Metrics and Dashboards

Console: CloudWatch > Metrics > ECS.

Create dashboard for CPU/Memory.

ECS Container Insights

Enable in ECS console for advanced metrics.

Alerts: CloudWatch > Alarms > Create (e.g., CPU > 80%).

Query logs: fields @timestamp, @message | filter @message like /error/

Today’s Takeaway

Monitored and logged!

What’s Next?
In Day 13, we’ll set up CI/CD.

Top comments (0)