Search code examples
amazon-web-servicesamazon-dynamodbamazon-cloudwatch

Creating a CloudWatch alarm based on a search expression


I'm attempting to the do the following:

I have a DynamoDB global table which publishes the ReplicationLatency metric. I want to create an alarm on the aggregate of the ReplicationLatency metric published for each region.

The DDB table replicas exist in us-east-1, us-west-2 and us-west-1. In defining the CW alarm for each receiving region, I was under the assumption that I could a search expression. For example, here's the expression I see in the CloudWatch console.

SEARCH('{AWS/DynamoDB,ReceivingRegion,TableName} MetricName="ReplicationLatency"', 'Average', 300)

I'd like to create a metric math alarm which is the avg of the metrics of the above search result. I was attempting to create a metric math expression of the format:

AVG(METRICS())

I then get the following error - The expression for an alarm must include at least one metric. Has anybody attempted to create an alarm from a search expression before? If yes, could you shed some light on how it can be done?

The only other way I can think of solving this problem is to enumerate/add the ReplicationLatency metric for each receiving region and then create a metric math expression out of that. That's seems to completely defeat the purpose of having a search expression and creating an alarm from all those metrics.


Solution

  • You cannot do alarms on search expressions at the moment.

    You will have to add manually all the metrics you want to alarm on and then use the math function you specified above.

    edit: official documentation link