soapergem
soapergem

Reputation: 9989

How can I set up a Cloudwatch alarm for HTTP 4XX/5XX on an ECS service/task?

I'm trying to set up Cloudwatch alarms to monitor my application running in Amazon ECS. This web application runs in Docker containers, configured as an ECS service behind an application load balancer and inside an autoscaling group that can step up/down the number of running tasks.

I've been looking through the different namespaces and metrics that are available in Cloudwatch but am not seeing quite what I'm looking for. If my application receives starts throwing off a high number of HTTP 5XX errors, I want to know about it. Likewise, if my application were to throw off a high number of HTTP 4XX errors, I want to know about that as well.

I see that there are metrics such as HTTPCode_ELB_4XX_Count and HTTPCode_ELB_5XX_Count on the load balancer, but this is not the same as application monitoring. The documentation for those specific metrics even states "This count does not include any response codes generated by the targets."

Which (if any) metrics will monitor the HTTP codes generated by the targets, in the context of an ECS service or task?

Upvotes: 2

Views: 4878

Answers (1)

Ashok Reddy
Ashok Reddy

Reputation: 1085

If you'r using application load balancer for your application, it's very simple...

  1. Go to ec2-dashboard
  2. targetgroup (which attached to docker containers)
  3. select monitoring tab
  4. there create alarm
  5. and select 4XX or 5XX count

Upvotes: 1

Related Questions