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 réponses
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
répondu il y a 2 ans
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
EXPERT
Uri
répondu il y a 2 ans
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.

répondu il y a 2 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions