AWS CDN
AWS CloudFront
CloudFront functions vs Lambda@Edge
Feature | CloudFront Functions | Lambda@Edge |
---|---|---|
Programming languages | JavaScript (ECMAScript 5.1 compliant) | Node.js and Python |
Event sources | Viewer request, Viewer response | Viewer request, Viewer response, Origin request, Origin response |
Scale | 10,000,000 requests per second or more | Up to 10,000 requests per second per Region |
Function duration | Submillisecond | Up to 5 seconds (viewer request and viewer response), Up to 30 seconds (origin request and origin response) |
Maximum memory | 2 MB | 128 – 3,008 MB |
Maximum size of the function code and included libraries | 10 KB | 1 MB (viewer request and viewer response), 50 MB (origin request and origin response) |
Network access | No | Yes |
File system access | No | Yes |
Access to the request body | No | Yes |
Access to geolocation and device data | Yes | No (viewer request), Yes (origin request, origin response, and viewer response) |
Can build and test entirely within CloudFront | Yes | No |
Function logging and metrics | Yes | Yes |
Pricing | Free tier available; charged per request | No free tier; charged per request and function duration |
来源
- Choosing between CloudFront functions and Lambda@Edge: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/edge-functions-choosing.html