Add Alarm to Synthetic Canary via CloudFormation?

1

I'm trying to add a CloudWatch alarm to my Synthetic Canary using AWS CloudFormation template.

The problem is that there is no property to set a CloudWatch alarm on a canary:
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html

I know that in the console one can set alarms in a canary. Can this be achieved via Cloud Formation with somehow linking the alarm and canary?

rchan
gefragt vor 4 Jahren1234 Aufrufe
2 Antworten
1
Akzeptierte Antwort

I was able to link an alarm to a canary with the "Dimensions CanaryName" property within the alarm (example below). Although in the UI console it does not show linkage in configuration section, the canary does detect if the alarm is triggered and displays the specific alarm in the Alarms column.

Note: The CanaryName value must match the value of the Name property from the Canary

TestAlarm:  
    Type: AWS::CloudWatch::Alarm  
    Properties:  
      AlarmDescription: "Synthetics alarm metric: Failed  GreaterThanOrEqualToThreshold 1"  
      MetricName: Failed  
      Namespace: CloudWatchSynthetics  
      Dimensions:  
        - Name: CanaryName  
          Value: mycanary  
      Period: 900  
      EvaluationPeriods: 1  
      Statistic: Average  
      ComparisonOperator: GreaterThanOrEqualToThreshold  
      Threshold: 1.0  
      TreatMissingData: notBreaching  
      ActionsEnabled: true
rchan
beantwortet vor 4 Jahren
profile picture
EXPERTE
überprüft vor 4 Tagen
0

Synthetics canaries don't have alarms, but the console allows you to automatically create CloudWatch alarms which monitor them. You can add CloudWatch alarms to your CloudFormation stack which monitor the success metrics emitted by your canary.

beantwortet vor 4 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen