Posted On: Sep 26, 2022
Amazon Lambda now supports configuring MaximumBatchingWindowInSeconds for Amazon SQS using the console, allowing customers to set the maximum amount of time, in seconds, that Lambda spends gathering records before invoking the function. You can configure MaximumBatchingWindowInSeconds to any value from 0 seconds to 300 seconds in increments of seconds.
Amazon Simple Queue Service (SQS) is a fully managed message queuing service that enables you to decouple and scale microservices, distributed systems, and serverless applications.
Amazon Lambda polls Amazon SQS and invokes a function when the number of messages reaches the specified batch size, or the payload exceeds 6MB. To avoid invoking the function with a small number of records, customers can tell the event source to buffer records for up to 5 minutes by configuring a batch window. For Amazon SQS event source, the default batching window is 0 seconds. With Amazon SQS event source, when you set BatchSize to a value greater than 10, you must set MaximumBatchingWindowInSeconds to at least 1.
To get started, select Amazon SQS as the event source for your Lambda function through the Amazon Web Services Management Console, Amazon CLI, Amazon SAM, or Amazon SDK for Lambda, and provide details for your SQS queue. Configuring MaximumBatchingWindowInSeconds for Amazon SQS in Console as a Lambda event source is available in Amazon Web Services China (Beijing) Region, operated by Sinnet, and Amazon Web Services China (Ningxia) Region, operated by NWCD. This feature incurs no additional charge. You pay for the Lambda invocations triggered by Amazon SQS. To learn more about building application with Lambda and Amazon SQS, read the Lambda Developer Guide.