(opens in a new window)

Amazon Cloudfront Functions

Lightweight Functions Close to the End-User

Functions Edge Compute Free Tier

Amazon Cloudfront Functions Information Resource Links

Amazon Cloudfront Functions Overview

Functions Edge Compute
Free Plan

Amazon Cloudfront Functions Information Resource Links

What is Amazon Cloudfront Functions?

With Functions, Amazon Cloudfront CDN (Content Delivery Network) introduced cloud computing to every CloudFront PoP around the globe in 2021. This means you can run your functions directly at the edge of Amazon’s network, a proximity to end-users that can significantly reduce latency. With this change in approach, Amazon aims to further strengthen its position in the emerging space of IaaS (Infrastructure as a Service) and serverless computing at the edge. Given Amazon’s massive reach and the tremendously popular CloudFront product, this will surely be a success going forward.

Use Cases

  • Serverless Functions
  • Edge Computing
  • Cache Key Normalization
  • Header Manipulation
  • URL Redirects or Rewrites
  • Request Authorization

Focus

CloudFront Functions is designed for basic, short-running tasks such as cache key normalization, header manipulation, URL redirects or rewrites, and request authorization. The latest JavaScript 2.0 runtime environment is specifically optimized for high performance and low latency.

Functions does not provide a full Node.js environment, so users won’t have access to libraries or modules, just plain JavaScript. But, you can use the global, low-latency CloudFront KeyValueStore to store and retrieve lookup data from within CloudFront Functions.

Limitations

The quotas are intentionally low, allowing only for small optimized scripts that run for brief durations. The maximum execution time is a reported 1 milisecond, although the official Amazon documentation is not clear about this and only states that: ‘CloudFront Functions have a limit on the time they can take to run, measured as compute utilization. Compute utilization is a number between 0 and 100 that indicates the amount of time that the function took to run as a percentage of the maximum allowed time’.

This execution limitation enables Cloudfront Functions to handle millions of requests per second with sub-millisecond startup times, making them ideal for latency-sensitive tasks. We will test the actual metrics ourselves in the near future and report our findings here.

CloudFront Functions don’t have the capability to access the internet, as the infrastructure is designed for lightweight operations that execute quickly at the edge. CloudFront Functions also can’t access the filesystem, which limits their use to simple request and response manipulations.

CloudFront Functions or AWS Lambda@Edge?

AWS Lambda@Edge provides more runtime options, supports dependencies, and allows functions to access the internet. Since recently, Lambda@Edge functions are executed within CloudFront’s CDN edge network, as well as AWS’s broader network, which can include execution within customers’ VPNs or behind load balancers.

Amazon Cloudfront Functions Features

Service Types

Functions
Available
Edge Compute
Available

Supported Runtimes

JavaScript
Available

Execution Limits and Resource Quotas

Min. Memory
2 MB
Max. Memory
2 MB
Default Timeout
Max. Timeout
~1 ms
Request Payload
10 KB
Response Payload
10 KB

Amazon Cloudfront Functions Pricing

Free Tier Quota

Amazon CloudFront Free Tier includes free usage for data transfer, HTTP/HTTPS requests, CloudFront Functions, and KeyValueStore reads.
  • Free Function Invocations

    Per month (No Creditcard required)

    2 Million

  • Free Network Egress

    (Data Transfer Out to Internet) per month (No Creditcard required)

    1 TB

  • Free HTTP/HTTPS Requests

    Per month (No Creditcard required)

    10 Million

  • Free KeyValueStore Reads

    Per month (No Creditcard required)

    2 Million

  • SSL Certificates

    (No Creditcard required)

    Unlimited

  • Feature Availability

    (No Creditcard required)

    Unlimited

Resource Pricing

The charges beyond the free tier for the total number of invocations across all functions. CloudFront Functions counts an invocation each time it starts executing in response to a CloudFront event globally. Network Egress price is based on North American Regions with less than 10 TB data transfer. For any API actions not involving reads within CloudFront Functions, the cost is $1 per 1,000 API requests
  • Invocations

    per 1 Million

    $0.10

  • Network Egress to Internet

    (Regional Data Transfer Out to Internet) per GB

    $0.085

  • Network Egress to Origin

    (Regional Data Transfer Out to Origin) per GB

    $0.02

  • HTTP Requests

    per 10,000

    $0.0075

  • HTTPS Requests

    per 10,000

    $0.01

  • KeyValueStore Reads

    per 1 Million

    $0.03

Get an estimate of your project costs with Amazon Cloudfront Functions
Find the full pricing details on the official Amazon Cloudfront Functions

Amazon Cloudfront Functions Regions

CloudFront has 700+ POPs in 100+ cities across 50+ countries and 900+ embedded POPs across 300+ cities in North America, Europe, and Asia. Based on our research, we have identified 131 Edge locations.
An interactive map displaying Amazon Cloudfront Functions' 131 datacenter locations by region. (March 31, 2025) - Map by d3js.org

Source: https://aws.amazon.com/cloudfront/features/

Best Amazon Cloudfront Functions Alternatives

Alternatives to Amazon Cloudfront Functions are generated by matching platform type, use cases, supported runtimes and container support.