What is the lambda?
Lambda is a service where you can run your application without a server. You only pay for the processing time you use.
What is the lambda@edge service?
Lambda@Edge is a feature of Amazon CloudFront that allows you to run your application closer to end-users, improve performance and reduce latency.
With Lambda@Edge you don't have to manage regions in multiple locations around the world and incur high costs.
What is the difference between lambda vs lambda@edge?
The major difference is in the API Gateway and the Lambda are regional service. Lambda@Edge is a global service. Lambda@Edge allows you to execute the logic across multiple location. This is the main difference between Lambda and Lambda@Edge, remaining all the things are mostly similar.. The main difference between Lambda and Lambda@Edge is everything else is similar.
The example projects
In this project, we will perform image resizing with lambda@edge. if you want to use the lambda@edge service you have to use the north Virginia service. Other regions unfortunately do not support it.
Create an S3 bucket and set it to this policy.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicRead",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject",
"s3:GetObjectVersion"
],
"Resource": "arn:aws:s3:::example-lambda-edge/*"
}
]
}
We import the relevant template to the cloudformation service. I prefer to import with s3 link. You can find the relevant link in the github link in the resources section.
Then we change only 3 options. Pay attention to the S3 bucket name.
We're going to the next step.
Click the Next button on the next pages. We don't need to take any action.
Here we deploy to the lambda@edge service
We deploy on the first lambda@edge.
We deploy 2 services on lambda@edge.
Then we test it. You can reach it from the link to try more different modules.
References
https://aws.amazon.com/lambda/edge/
https://aws.amazon.com/blogs/networking-and-content-delivery/resizing-images-with-amazon-cloudfront-lambdaedge-aws-cdn-blog/
http://www.thumbor.org/
https://www.youtube.com/watch?v=uVk-ffHeV7c&ab_channel=KoffeeWithKode
https://docs.aws.amazon.com/solutions/latest/serverless-image-handler/template.html
Top comments (0)