Suppose I have under resource :
queueSizeAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmDescription: 'sending queue large'
Namespace: AWS/SQS
MetricName: ApproximateAgeOfOldestMessage
Statistic: Average
Threshold: 8000
ComparisonOperator: GreaterThanThreshold
EvaluationPeriods: 1
Period: 600
Dimensions:
- Name: QueueName
Value: live-send.fifo
AlarmActions:
- Ref: TopicCloudwatchAlarm
SendQueue:
Type: AWS::SQS::Queue
Properties:
QueueName: ${self:provider.stage}-send.fifo
FifoQueue: true
ContentBasedDeduplication: true
MessageRetentionPeriod: ${self:custom.sqs.retention.long.${self:provider.stage}}
KmsMasterKeyId : 'alias/aws/sqs' # default
So that if the queue stalls, I get an alert.
This deploys into both dev and live stacks when I do sls deploy --stage dev
or ... --stage live
so the alert is duplicated.
How can I make this alarm run only in the live stack ?
Or, more broadly I suppose, how can I deploy a resource only to certain stages ?