What to do to include details of the target, whose health checks failed, in the mail notification? (Lambda, SNS)

0

Backend API applications could be running on an EC2 instance, a PaaS like Elastic Beanstalk or even a container runtime platform like ECS. As you might already be aware, we configure the Target Groups with the application's health check endpoint, and allow the Load Balancer to determine the health with certain threshold parameters. We are able to run the health check periodically and send out an email ONLY when the check does not pass. Now, what do I do to include details of the target, whose health checks failed, in the mail? and is there a way to do it completely through console?

1 Answer
0
Accepted Answer

Set CloudWatch alarms to alarm when health checks exceed thresholds.
Triggered by the alarm, Lambda executes "describe_target_health" to retrieve those with "unhealthy" status.
How about sending that information from Lambda to SNS for email notification?

Reference Documents:
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/elbv2/client/describe_target_health.html
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sns/client/publish.html

profile picture
EXPERT
answered a year ago
  • Thanks, I am getting some idea. And is there a way for it to do it completely through console

  • It is not possible to configure this setting using only the management console.
    The use of Lambda will be mandatory.
    If this answer has led to a solution, please approve the answer for the betterment of the community.

  • Thank you.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions