Routing based on Cloudwatch metrics/alarms

0

Can you have Api Gateway or ALB do routing based on Cloudwatch metrics/Alarms? For example, check cloudwatch if a host is down, then route the request to a Lambda function instead

3 個答案
0

Why not just use the health check feature already on the ALB to check the host, which would redirect the traffic for you? To answer your question, yes you can use Cloudwatch event with Lambda as target to fulfill your request; I had worked on a scenario, where I used Cloudwatch event to trigger lambda functions - one lambda to deregister then stop EC2 and the other one to start another EC2/register in target group behind the ALB.

profile pictureAWS
Jules_N
已回答 2 年前
0

API Gateway does not support dynamic routing, even not based on CloudWatch. What you can do is invoke a Lambda function that performs the routing logic. Just note that it will require that the function will be running for the duration of the API, which will add you the cost.

profile pictureAWS
專家
Uri
已回答 2 年前
0

I suggest using the Route53 Health Check feature which can route traffic, e.g. depending on a host check or the state of a CloudWatch Alarm. This way, you don't need to build additional custom-built routing logic.

已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南