I have created an alarm that looks for tunnels and sends SNS topic when tunnels are down. Is there a way to trigger lambda as well? I don't see any options for that. It looks like I can only create an event to trigger lambda.
Related
is there any elegant way to create a reacuuring alarms system to send sns notifications as long as the cloudwatch alarm is in ALARM status ?
i've searched the internet but most of the solutions are pretty complicated for a simple task
You could create a simple process like this:
Create AWS Cloudwatch scheduled events: https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/Create-CloudWatch-Events-Scheduled-Rule.html
These scheduled events should trigger a Lambda
The Lambda function should check the alarm status. if the status is ALARM, trigger SNS to send a notification
I have a scenario like this:
I have a dead-letter-queue and when a message lands into it, a CloudWatch Alarm should trigger.
I have tried to set up an alarm directly using the metrics provided for SQS and the closest that came was the NumberOfMessagesSent metric. But that doesn't get my job done.
The next approach that I thought of is to fire an CloudWatch Event that fires when I send the message the DLQ and have the alarm to trigger when that event is fired. I didn't find any documentation that said that such a thing was possible.
Is there a way to fire off a CloudWatch alarm when a new message is added to an SQS queue?
How to filter cloudwatch events based on the event id eg: DMS-EVENT-0078, DMS-EVENT-0082
we are looking at the cloudwatch event messages but not able to see the event-id
we are planning to use a lambda to filter only few event-id and create alarms accordingly
https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Events.html
Thank you
your Support is Much Appreciated
The AWS Database Migration Service notification events are separate from CloudWatch (CW) Events. You can't use them from CW Events rules.
CW Events support only AWS API Call via CloudTrail events for DMS.
Thus you can setup SNS for the DMS notifications, which in turn will invoke your lambda function. The lambda function can filter or process the events of interest to you.
How can i notify a result of lambda when status OK(normal) and NG both?
I set a alarm on cloudwatch when status NG. It was working.
But when i got OK(normal) status, i couldn't get notify email.
I set up custom metrics by lamda result log when OK(normal) status on cloudwatch alarm.
Is it possible on alarm?
Is there an any simple way?
It sounds like your requirements are:
Trigger an AWS Lambda function when a CloudWatch alarm enters the ALARM state
Trigger an AWS Lambda function when a CloudWatch alarm enters the OK state
Each AWS CloudWatch alarm can be configured with multiple Actions.
Therefore, you can create one Action for ALARM and another action for OK:
The CloudWatch Alarm can send a notification to an Amazon SNS topic. The AWS Lambda function can subscribe to the SNS topic and will be triggered when the alarm sends the notification to SNS.
We have aws alarms set up to email on alarm but we would like to continue to get the alarm notification even if the state is in Alarm without a state change. How could I achieve this (would be happy to use a lambda but no idea how to do it)
Amazon CloudWatch alarm notifications are only sent when the state of the alarm changes. It is not possible to configure CloudWatch to continually send notifications while in the ALARM state.
You would need to write your own code to send such notifications. This could be accomplished via a cron job, scheduled AWS Lambda function or your own application.
Try with a script using Cloudwatch API for example with Boto3 + Python or a Lambda running every X minutes. I have a python script to get values from cloudwatch you can adapt it. http://www.dbigcloud.com/cloud-computing/230-integrando-metricas-de-aws-cloudwatch-en-zabbix.html
One alternative is, to create a Lambda function to send email and host that function using CloudWatch Rule with Scheduled option and target as Lambda function that you have created. In Schedule option, you can set the frequency of time that you expect to receive email. In defined frequency, the Rule will trigger Lambda Function to send email.