Cloudformation definition for "Cloudwatch Alarm" based on "Metrics Insights query"

0

I want to define "Cloudwatch Alarm" based on "Metrics Insights query" use Cloudformation but i can't find any information how to do that. With "Cloudwatch Alarm" in Cloudformation documentation all I found is that i can create alarm use specified metric or metric math expression but not for "Metrics Insights query", for "Metrics Insights query" I can create it and then create "Cloudwatch Alarm" in Management Console not Cloudformation. Is there no Cloudformation definition for "Metrics Insights query" and create create "Cloudwatch Alarm" based on it? Thanks

heno7
질문됨 6달 전740회 조회
1개 답변
0

Hi, sorry to hear that the documentation is not clear enough. You found documentation that explains how to create an alarm on a metric math expression: creating an alarm on a metrics insights query works exactly the same way, simply write the SQL metrics insights query as your metric math expression.

Here is an example in yaml:

Type: AWS::CloudWatch::Alarm
Properties:
    AlarmName: MI_Alarm_sample
    ActionsEnabled: true
    OKActions: []
    AlarmActions: []
    InsufficientDataActions: []
    Dimensions: []
    EvaluationPeriods: 1
    DatapointsToAlarm: 1
    Threshold: 0
    ComparisonOperator: LessThanOrEqualToThreshold
    TreatMissingData: missing
    Metrics:
        - Id: q1
          ReturnData: true
          Expression: SELECT AVG(visits) FROM SCHEMA("SITES/TRAFFIC", site)
          Period: 300

profile pictureAWS
Jsc
답변함 6달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인