Config for lambda internal queue batch size

0

have a query around lambda trigger notifications: sources i am referring to:

  1. https://docs.aws.amazon.com/lambda/latest/dg/with-s3-example.html
  2. https://docs.aws.amazon.com/lambda/latest/dg/with-sqs-example.html

Observations: though trigger from S3 has field records a list in the payload but it has only one record while sqs payloads have a no of events as per the batch size

Query: Couldn’t find if any aggregation happens in lambda’s internal queue, and in case there is any operation happening in the lambda’s internal queue, how can we config the batch size for the internal queue? Add is the batchSize always 1 in case of S3?

2 個答案
0

Although I can't find any document stating that the batchSize will always be 1 I think it will be.

Nevertheless usually when I implemented these lambda's I used one of the following patterns:

  • just create a loop over the records. just in case it changes in future...
  • refuse events that have > 1 record count, generate an error -> cloudwatch logs -> alarm
profile picture
JaccoPK
已回答 2 年前
0

Only Event source mapping (SQS, Kinesis, MQ, DDB Streams) invocation allow for batching. All other invocation, synchronous (e.g., API Gateway) or asynchronous (e.g., S3, even though there is an internal queue), deliver the events to Lambda with a single event at a time.

If you want to handle S3 events in a batch you can use S3 -> SQS -> Lambda.

profile pictureAWS
專家
Uri
已回答 2 年前

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

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

回答問題指南