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 Antworten
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
beantwortet vor 2 Jahren
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
EXPERTE
Uri
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen