Reputation: 113
I'm completely new with boto. I created a Cloudwatch alarm for a certain Kinesis metrics. Now I want to write a Lambda function which can read the alarm status and the corresponding metrics value in every 5 minutes.
Does anyone have experiences with this task and can help me?
following is what I'm currently having in my code:
import json
import boto3
def lambda_handler(event, context):
cloudwatch = boto3.resource('cloudwatch')
alarm = cloudwatch.Alarm('Test')
response = alarm.describe_alarms()
return{reponse}
Thanks a lot
Upvotes: 0
Views: 1359
Reputation: 238199
There are several ways of doing this. One would be:
Add/modify execution role of your function with permissions to read CloudWatch metrics.
Use boto3's cloudwatch to read the metrics you require. You already started doing this.
Setup a CloudWatch Event scheduled rule to trigger your lambda function every 5 minutes.
Upvotes: 1