I am trying to create alert for “SMSMonthToDateSpentUSD” using serverless-plugin-aws-alerts plugin. alarm is getting created, but its not correct. Its not pulling the data. When i looked deeper i found that “SMSMonthToDateSpentUSD” metrics is without dimensions. But when alarm is created through serverless plugin, dimension value is gettting set to my function name.
I am not setting any dimensions in serverless.yaml…but its getting set underneath somewhere. How do i tell serverless not to set those dimensions ?
Below is the same code :
- protocol: email
definitions: # these defaults are merged with your definitions
description: ‘SNS Monthly Spend alarm’
threshold: 0.20 # Threshold
evaluationPeriods: 1 # Can’t be more than 1 day
I think because dimension is getting set, its not populated the data.
From aws cloudwatch CLI if i dont set the dimension, its not getting set.
aws cloudwatch put-metric-alarm --alarm-name test-dev-from-cli --alarm-description “SNS Monthly Spend alarm” --metric-name SMSMonthToDateSpentUSD --namespace AWS/SNS --period 86400 --threshold 0.19 --comparison-operator GreaterThanThreshold --evaluation-periods 1 --extended-statistic p50
(Disclaimer : above serverless.yaml and CLI are still in development and not completed)