~~NOCACHE~~ ~~DISCUSSION~~ {{:Miscellaneous:pasted:20241018-115317.png}} {{:Miscellaneous:pasted:20241018-115413.png}} {{:Miscellaneous:pasted:20241018-115527.png}} {{:Miscellaneous:pasted:20241018-115624.png}} {{:Miscellaneous:pasted:20241018-123844.png}} ## 見出しレベル1 import boto3 import os client = boto3.client('sns') def lambda_handler(event, context): state = event['alarmData']['state']['value'] alarmName = event['alarmData']['alarmName'] REGION = "in Asia Pacific (Osaka)" Subject = state + ' ”' + alarmName + '” ' + REGION print(Subject) { "source": "aws.cloudwatch", "alarmArn": "arn:aws:cloudwatch:ap-northeast-1:125901058219:alarm:Shige001", "accountId": "125901058219", "time": "2024-03-25T08:17:49.222+0000", "region": "ap-northeast-1", "alarmData": { "alarmName": "Shige001", "state": { "value": "ALARM", "reason": "Threshold Crossed: 1 out of the last 1 datapoints [1.0 (25/03/24 08:12:00)] was greater than or equal to the threshold (0.0) (minimum 1 datapoint for OK -> ALARM transition).", "reasonData": "{\"version\":\"1.0\",\"queryDate\":\"2024-03-25T08:17:49.215+0000\",\"startDate\":\"2024-03-25T08:12:00.000+0000\",\"statistic\":\"Maximum\",\"period\":300,\"recentDatapoints\":[1.0],\"threshold\":0.0,\"evaluatedDatapoints\":[{\"timestamp\":\"2024-03-25T08:12:00.000+0000\",\"sampleCount\":1.0,\"value\":1.0}]}", "timestamp": "2024-03-25T08:17:49.222+0000" }, "previousState": { "value": "INSUFFICIENT_DATA", "reason": "Unchecked: Initial alarm creation", "timestamp": "2024-03-25T08:17:24.779+0000" }, "configuration": { "metrics": [ { "id": "a6c73a57-c495-95c1-1ab6-8b2e418dd40c", "metricStat": { "metric": { "namespace": "Namespace1", "name": "MetricName1", "dimensions": {} }, "period": 300, "stat": "Maximum" }, "returnData": true } ] } } } {{tag>AWS CloudFront SSL証明書 実践的}}