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 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则