Home > OS >  AWS Lambda repeatedly invoked by ALB every 35 seconds
AWS Lambda repeatedly invoked by ALB every 35 seconds

Time:05-01

I have an ALB with a listener rule that forwards incoming requests (matched on path and host header) to a target group. That target group targets a Lambda to process the request.

If I send a request to that ALB that matches that listener rule, something gets triggered that continually invokes the lambda every few seconds (about every 35 seconds).

If I replace the ALB as the trigger with API Gateway, the Lambda only gets invoked once.

I'm at a loss for why the ALB or the Target Group could somehow trigger the Lambda to be invoked more than once.

CodePudding user response:

You have a health check for your Lambda target group (TG), which you can modify or disable if you like. These are regular 'pings' to your Lambda to assert & test its status.

As per documentation, 35 seconds is the default HealthCheckIntervalSeconds for a TG if the target type is a Lambda, which explains the timing:

HealthCheckIntervalSeconds

The approximate amount of time, in seconds, between health checks of an individual target. The range is 5–300 seconds. The default is 30 seconds if the target type is instance or ip and 35 seconds if the target type is lambda.

  • Related