Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create cloudwatch alarm before there is data for metric?

I would like to create a cloudwatch alarm for the sns metric NumberOfMessagesPublished on a new sns topic. If I attempt to do this before I trigger the topic (and there is no data for it) then the option to create an alarm does not exist in the web console.

How can I do this with the web console? Is using a cli tool the only option?

like image 515
Alex Cohen Avatar asked Jan 29 '23 20:01

Alex Cohen


1 Answers

I noticed that too -- you cannot select a metric until the data has been sent to CloudWatch.

I suspect that CloudWatch actually doesn't have any visibility into metrics until they are sent from the originating service into CloudWatch. Thus, it can't populate the console because it doesn't know what data will be sent. That would be a nice, loosely-coupled design.

My experiments show that it is possible create an alarm via the AWS Command-Line Interface (CLI) on metrics that do not exist -- even within the EC2 namespace. That's the way to go!

like image 102
John Rotenstein Avatar answered Feb 03 '23 21:02

John Rotenstein