Invoking other Lambdas synchronously from a Lambda is a scalability anti-pattern. Lambdas have a maximum execution time before they timeout (15
minutes as of June 2025). Having to wait for another Lambda to finish its execution could lead to a timeout.
A better solution is to generate events that can be consumed asynchronously by other Lambdas.
Noncompliant code example
import boto3
client = boto3.client('lambda')
def lambda_handler(event, context):
response = client.invoke(
FunctionName='target-lambda-function-name',
InvocationType='RequestResponse' # Noncompliant `RequestResponse` InvocationType means that the lambda call is synchronous
Payload=json.dumps(event)
)
return response['Payload'].read()
Compliant code example
import boto3
client = boto3.client('lambda')
def lambda_handler(event, context):
response = client.invoke(
FunctionName='target-lambda-function-name',
InvocationType='Event' # Compliant `Event` InvocationType means that the lambda call is asynchronous
Payload=json.dumps(event)
)
return response['Payload'].read()