I am trying to add a CloudWatch alarm over multiple instances in my AWS account based on the instance tags.
For example, I have 4 instances running with tags Name=DEV, APP=WebServer.
I am new to AWS CloudFormation templates, so I am not sure how to add the tags in the CloudWatch alarm's dimensions property. Can I attach a single alarm to multiple instances by referring to them by tags when I create the instances?
Here's a snippet from my template.
CPUAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmDescription: CPUtilization
AlarmActions: "SNS TOPIC ARN"
MetricName: CPUUtilization
Namespace: AWS/EC2
Statistic: Average
Period: '60'
EvaluationPeriods: '2'
Threshold: '80'
ComparisonOperator: GreaterThanThreshold
Dimensions: