Questions tagged [aws-lambda-edge]

AWS Lambda Edge or Lambda@Edge, lets user run AWS Lambda Functions across AWS edge locations globally using AWS-Cloudfront, which helps in sending responses to end users at the lowest latency.

AWS Lambda@Edge is a part of Amazon Web Services (AWS), which allows user to run AWS Lambda Functions across AWS edge locations globally.

It helps users in sending responses to their end users at the lowest latency by using AWS-CloudFront.

Lambda functions can be triggered by CloudFront events, such as requests for content to or from origin servers and viewers. Read More

Resources:

Documentation: What is AWS lambda@Edge?

Examples: Lambda@Edge

268 questions
0
votes
1 answer

Restrict s3 file download to authenticated user in cognito (preferred) or anyone at all. They should only be able to view but not download

I wanted to know if there is any way to let the aws cognito users or anyone else be able to only view or play aws s3 files, but no matter how they try, they shouldn't be able to download any file in my bucket. The docs are really confusing me with…
0
votes
0 answers

Lambda Edge - The specified key does not exist

I am using lambda edge to handle image compression with Sharp. The code works for now, but when I tried to add a new function to parse query parameter to let the user define the quality of the compression, Lambda/Cloudfront starts giving me a notice…
0
votes
1 answer

How to redirect www to non-www static website on AWS

I've spent a few hours to solve redirection from www to non-www version of static site hosted on AWS.
Adam Gajdečka
  • 305
  • 1
  • 4
  • 13
0
votes
1 answer

Lambda Edge 502 with custom response from viewer response

I'm using a URL query string to debug my viewer-request and viewer-response lambda@edge functions by returning the event as JSON to the frontend (FYI so I can check for the presence/absence of certain things via an external monitoring tool). This…
Max
  • 12,794
  • 30
  • 90
  • 142
0
votes
1 answer

How to locally trigger aws Lambda function?

I have a Greengrass Core device and on it I deployed a simple Lambda function but I don't know how to locally trigger it. Is it even possible? I am looking for a command line call, something like this: "aws lambda invoke --function-name…
0
votes
1 answer

Adding API Gateway as Trigger to Lambda Function Using Serverless Script not the UI

I want to write a script/code/serverless script that when run adds a trigger to the specified Lambda function. I can deploy a lambda function using a script, I have added a trigger by going to the aws console and clicking the options from there,…
0
votes
2 answers

aws cdk: Unable to delete lambda edge

Couldn't delete lambda stack via aws cdk: Lambda was unable to delete lambda because it is a replicated function.
0
votes
0 answers

Lambda@Edge URL redirect to s3 SignedUrl with NodeJS

I want to redirect cloud-front lambda@edge through redirect my s3 bucket signed url. exports.handler = async(event, context, callback) => { console.log(JSON.stringify(event)); const request = event.Records[0].cf.request; let path =…
0
votes
1 answer

AWS Lambda Edge - Detect that response comes from origin or not in viewer response function

Inside my lambda edge viewer response function I need to understand if the response comes from Cloudfront cache or Origin server - I was thinking to pass the response header from origin response function however its' value stays in cache so on…
0
votes
2 answers

How to Access documentDB from Lambda@Edge function?

I am trying to set up an event trigger lambda@Edge function from cloudFront. This function needs to access the database and replace the url's metadata before distributing out to users. Issues I am facing: My DocumentDB is placed in a VPC private…
0
votes
1 answer

convert "AWS::Lambda::Function" to "AWS::Serverless::Function"

I want to use code in file, but only inline code can be used in "AWS::Lambda::Function" template, can I convert "AWS::Lambda::Function" template to "AWS::Serverless::Function" template?
mikezang
  • 2,291
  • 7
  • 32
  • 56
0
votes
1 answer

Size of Cloudfront event function too big when combined with regular lambda function

I have created an S3 website and have wired up some Cloufront events using the '@silvermine/serverless-plugin-cloudfront-lambda-edge' plugin which both work as expected: functions: origin_request: handler: handler.origin_request …
Zakalwe
  • 1,444
  • 3
  • 14
  • 25
0
votes
1 answer

IE Edge not honoring Lambda@Edge HSTS

I have a React app hosted in AWS S3. To help secure it, I have implemented Lambda@Edge following the AWS guide: https://aws.amazon.com/blogs/networking-and-content-delivery/adding-http-security-headers-using-lambdaedge-and-amazon-cloudfront/ The…
0
votes
0 answers

AWS Lambda invocation takes a lot of time

My team has a strange problem with our Lambda invocations, which seem to behave strangely from time to time. We are well aware of the cold start time and we addressed that with warmup Lambdas, but this is really strange. Below I attached an image of…
Leon
  • 55
  • 6
0
votes
1 answer

How to respond to viewers without sending the request to the origin?

I am trying to implement in python a lambda edge that receives a file, evaluates it with the length of the content and if it is greater than allowed, respond to the viewer something without sending the request to the origin, otherwise it will be…
ldonado
  • 3
  • 3