amazon-cloudfrontaws-lambda-edge

can lambda@edge events arrive in batches?


Creating an origin request lambda@edge to intercept cloudfront events. Every example I can see in the aws docs https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-examples.html refers to the event as

const request = event.Records[0].cf.request;

can the events be batched? unsure if I have to parse the whole array of records. Can't find a definitive answer in the docs


Solution

  • There's no need to worry about parsing the array as there will always be only a single record per event.

    The array of Records is there so that messages from different services have a similar structure (e.g. SQS, which potentially delivers messages in batches, and CloudFront or SNS, which don't).