2

I have a scenario like this:

I have a dead-letter-queue and when a message lands into it, a CloudWatch Alarm should trigger.

I have tried to set up an alarm directly using the metrics provided for SQS and the closest that came was the NumberOfMessagesSent metric. But that doesn't get my job done.

The next approach that I thought of is to fire an CloudWatch Event that fires when I send the message the DLQ and have the alarm to trigger when that event is fired. I didn't find any documentation that said that such a thing was possible.

Is there a way to fire off a CloudWatch alarm when a new message is added to an SQS queue?

Shankha057
  • 1,296
  • 1
  • 20
  • 38
  • "But that doesn't get my job done." - why? What's wrong with this approach? This should be the way to do it. – Marcin May 04 '21 at 23:31
  • @Marcin The reason is that I want to have the alarm trigger only once when a new message lands into the queue. I had the message threshold count to 1 and the statistic to sum. Didn't work. The alarm kept firing as long as the message count didn't go below 1 – Shankha057 May 04 '21 at 23:40
  • @Marcin but isn't `set_alarm_state` only for debugging? – Shankha057 May 04 '21 at 23:47
  • Yes, that's why I deleted the comment, forgot its temprorary only. I think you could setup lambda function on DLQ. This way the lambda would pick up the msg quickly, send out alarms, and maybe store the msg somewhere else for future debugging. – Marcin May 04 '21 at 23:48
  • @Marcin to create and maintain an entire lambda just to fire one single alarm? Wouldn't be an overkill? No simpler way? Maybe I'm missing something or maybe I don't know about something here? – Shankha057 May 04 '21 at 23:52
  • At the moment I can't think of anything simpler. Can wait a bit, and maybe someone will be able to provide more compering solution. – Marcin May 04 '21 at 23:56

0 Answers0