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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인