DEV Community

Marin Radjenovic for AWS Community Builders

Posted on

3

Lambda@Edge or Cloudfront Functions

Both AWS services provide the same concept of delivering processing power with the lowest latency to the user. In essence, they act as HTTP middleware that enables the execution of request & response related processing. However, even though the purpose is the same there are significant differences that can be used in specific cases.

Cloudfront Functions— run on the edge locations themselves. There are currently more than 400 edge locations in the world run by AWS. Edge locations are dominantly used for caching the content served by Cloudfront.
Cloudfront functions are also running on the edge locations. With that said, the power and execution time is very limited. However, startup time is measured in submillisecond and scaling is rapidly fast to handle hundreds of million requests per second.
However, Cloudfront Functions have a few limitations that might be an issue when architecting a solution. Some of the CF Functions' limitations are: memory is limited to 2 MB, max function code size is limited to 10KB, only JS can be used for coding, no internet access, no access to a request body, no 3rd party libs and etc.
Also, there are some advantages over Lambda@Edge functions for instance rapid scaling and lower cost.

Lambda@Edge — is similar to Cloudfront Functions, but it runs on a Regional Edge Cache instead of an Edge location. So name as such, might be misleading. Lambda@Edge are following a similar concept as regular AWS Lambda, however, there are some significant differences. Such as It can last 5sec(30sec for origin req/resp), max memory can be 128MB to 3GB, and it can be coded only in JS or Pythons.
In comparison to Cloudfront Functions, it has access to the internet, other AWS services, and 3rd party libs that can be used. However, it scales a lot slower and costs much more.

SurveyJS custom survey software

Build Your Own Forms without Manual Coding

SurveyJS UI libraries let you build a JSON-based form management system that integrates with any backend, giving you full control over your data with no user limits. Includes support for custom question types, skip logic, an integrated CSS editor, PDF export, real-time analytics, and more.

Learn more

Top comments (0)

Best Practices for Running  Container WordPress on AWS (ECS, EFS, RDS, ELB) using CDK cover image

Best Practices for Running Container WordPress on AWS (ECS, EFS, RDS, ELB) using CDK

This post discusses the process of migrating a growing WordPress eShop business to AWS using AWS CDK for an easily scalable, high availability architecture. The detailed structure encompasses several pillars: Compute, Storage, Database, Cache, CDN, DNS, Security, and Backup.

Read full post

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay