How to skip dimensions settings in serverless.yaml


#1

Hi,

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 :
alerts:
dashboards: true
topics:
alarm:
topic:
notifications:
- protocol: email
endpoint:
definitions: # these defaults are merged with your definitions
CustomLimit:
description: ‘SNS Monthly Spend alarm’
name: ‘SNSMonthlySpend’
namespace: ‘AWS/SNS’
metric: SMSMonthToDateSpentUSD
threshold: 0.20 # Threshold
statistic: p50
period: 86400
evaluationPeriods: 1 # Can’t be more than 1 day
comparisonOperator: GreaterThanOrEqualToThreshold
alarms:
- CustomLimit

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)