Pjane
Pjane

Reputation: 3

Making DynamoDb calls from lambda@edge for viewer-request events

I am looking to use viewer-request event to perform some checks for cloud-fronted S3 requests. For that I need to make a dynamodb call. However, viewer-request events are maxed out at 1MB of function size (including libraries), while "aws-sdk" npm (used to perform dynamodb calls) itself is ~5MB. I see in some posts (like Lambda@Edge when triggered Dynamodb giving 503 Error) that people have been able to use "aws-sdk" with viewer-request. How is that being done? Is there a reliable lite version or a dynamodb specific version of the lib?

Upvotes: 0

Views: 743

Answers (1)

jogold
jogold

Reputation: 7407

The aws-sdk is included in the Node.js runtime for Lambda@Edge.

You don't need to package it, you can simply do:

const AWS = require('aws-sdk');

Upvotes: 2

Related Questions