CloudFront vs Fastly: Pricing Considerations

by Vantage Team


Note: This blog post has been done as an independent pricing evaluation for the benefit of Vantage users and the broader infrastructure community. While Vantage employees have met with both representatives of AWS and Fastly to confirm details, this is not a sponsored post and was not commissioned by either party.

Fastly is a global content delivery network (CDN) used to decrease latency and improve performance for images, video, software downloads and more through the Fastly edge cloud. CloudFront is a managed CDN service operated by AWS.

For this comparison, we’ll match Fastly against CloudFront to see who can deliver the most bytes the fastest for the least cost. This post is really more about explaining pricing structure than annointing winners but for the example service, CloudFront is 73% cheaper than Fastly. However, with a small architecture change, the script is flipped and Fastly comes out 24% cheaper than CloudFront.

Introduction

A content delivery network (CDN) is a set of servers, one of which is located geographically close to the user of your application, and sends data to that user’s device. Serving requests with cached content, especially bulkier media like video and images, closer to users is ideal: The data arrives faster, there are less transit fees, there’s less buffering and timeouts to the end-user.

The software infrastructure that powers CDNs is complex and involves solving numerous difficult computer science problems in networking and distributed systems. These days most companies buy versus build their CDNs. Companies like Akamai, Fastly, and Cloudflare and solutions like AWS CloudFront and Google Cloud CDN expose CDN services for a fee based on levels of usage and what kinds of requests are served.

Let’s look at two examples of how companies use Fastly and Amazon Cloudfront.

Example 1: LaunchDarkly’s 25 ms Feature Flags Using Fastly

LaunchDarkly has done years of work with Fastly to get the lowest latency possible. LaunchDarkly gives companies programmable feature flags, where they can enable new features in their app with a switch - or disable the feature if it is not working. They serve more than 20 trillion feature flag responses every day.

alt_text

Moving feature flag evaluation closer to the user with Fastly

LaunchDarkly uses Fastly Compute@Edge to actually evaluate whether they should return TRUE or FALSE for a particular feature on the CDN layer instead of their servers. By doing this, they can return a response in 25 ms. That’s faster than the 40-60 ms latency of most multiplayer games!

Example 2: Slack’s 200 ms API Responses Using CloudFront

In 2016, Slack gave a talk on how they reduced their API response times using CloudFront. The Slack REST API is used not only by developers building bots and integrations but also by the core messaging product itself. The Slack API returns things like channel lists when you first load the app.

alt_text

Note the impact of edge SSL termination on Slacks’ API response times

Slack wants channel lists show up right away so their app feels very fast. To reduce response times they put their entire API behind CloudFront, and saw a 50% drop in latency. Technically, the CDN is caching things like HTTPS headers when it passes traffic through to Elastic Load Balancer. This means that the SSL session can persist at the edge which avoids long roundtrips.

Comparing Pricing

With so many benefits that come from CDNs, most large software companies adopt them by default. Choosing a provider then comes down to cost, in addition to the feature set available. For each provider, the first table has traditional CDN pricing for bandwidth and requests. The second table shows pricing for edge compute, which is also what we focus on with an example workload.

Fastly Pricing

Fastly has 3 products with usage based pricing: a CDN, security solutions, and edge compute. Generally you see about a 30% discount after the first 10 TB of bandwidth are consumed. The regions below refer to where the cache is serving your content. Users located in Asia and India for example, have more expensive bandwidth and requests than in North America, and this is true across managed CDN providers. One reason is there are fewer data centers and racks available for these companies to purchase, in proportion to the greater number of users.

Region Price per GB Per 10K Requests
North America $0.12 $0.0075
Asia $0.19 $0.0090
India $0.28 $0.0160

Pricing by Gigabyte (GB) and HTTP requests for Fastly

On-demand pricing like this is the most expensive way to use Fastly on a per-unit basis. Fastly also offers tiers with a committed use amount, similar to the concept of coverage in cloud infrastructure pricing. For example on the Professional Plan customers get 10 TB per month at a lower rate than $0.12 per GB.

In addition to CDN, Fastly offers products in three other areas. On-demand pricing is not publicly available for Fastly’s Next-Gen WAF (firewall) or Observability (logging) products. Its latest offering, Fastly Compute@Edge is a very interesting serverless and edge compute product with usage-based pricing based on the amount of memory consumed by the function. This is the product LaunchDarkly is using above, albeit at massive volume discounts.

Per 1M Requests Per 128 MB Per 10 ms CPU
Compute@Edge $0.50 $0.000035 per GB sec $0.000045 per CPU sec

Usage based pricing for Fastly Compute@Edge

How can we reason about this? Let’s say I have a function that executes for 100 ms and uses 128 MB of memory and my service calls it 1M times a month. Start by getting the price per 128 MB and total runtime for the month in ms. Then convert to seconds and multiply. Calling this function 1M times would cost $0.44 + $0.50 for the million requests. Under $1 for 1M functions seems great.

Not so fast though. Each of these functions runs for 100 ms, of which 20 ms are included and each additional 10 ms increment is charged. That means our 1M requests have 80M ms of charged CPU time. Convert to seconds and multiply and we get a compute charge of $3.60 for this batch of function calls. Add everything together and serving 1M requests costs under $4.54.

Who says performance doesn’t matter anymore? If our functions were under 20 ms in runtime, we would save 80% of this monthly bill. With economics like this, you can see why a URL shortener like bit.ly that could take advantage of an edge compute architecture can serve unlimited requests for free.

CloudFront Pricing

CloudFront pricing is based on GBs of bandwidth, number of requests, and GBs of compute memory.

Region Price per GB Per 10K Requests
North America $0.085 $0.010
Asia $0.12 $0.012
India $0.109 $0.012

CloudFront pricing by Gigabyte (GB) and by HTTP Request

CloudFront actually has more tiers and discounts up to 5 PB per month available. We can assume these are competitive to Fastly. CloudFront’s firewall product, Origin Shield, does have a price per request available. There is also a logging charge of $0.01 for every 1M log files published to CloudWatch or another logging destination.

As we might expect with CloudFront as well, there is an edge compute product - although actually there are two: CloudFront Functions and Lambda@Edge. CloudFront functions are really constrained and meant for things like rewriting URL headers. Lambda@Edge is more closely analogous to Compute@Edge from Fastly and is administered through the AWS Lambda console.

Per 1M Requests Per 128 MB Per 10 ms CPU
CloudFront Functions $0.10
Lambda@Edge $0.60 $0.000050 per GB sec

Pricing for two AWS edge computing products: CloudFront Functions and Lambda@Edge

How much do 1M requests for our 128 MB function that runs for 100 ms cost now? (pause for time to calculate).

All together this is 100M ms of runtime, convert to seconds and multiply by $0.00000625 and we have a total cost of $0.63 + $.60 for the request and a total of $1.23. That means that running this application through CloudFront is 73% cheaper than through Fastly. As we saw above though, if our function calls all had shorter runtimes, it would be Fastly that is 24% cheaper than CloudFront.

Comparing Free Tiers

Before you get started piping hundreds of millions of requests and Petabytes of data through Fastly or CloudFront, you can always test them out for free! Of course, like the example above, each service has some areas where it would be more advantageous to use one or the other.

Fastly Free Tier

Fastly looks at your overall bill and says the first $50 of spend are free. They also throw in 5 free certificates from non profit certificate authorities (CAs) like Let’s Encrypt.

Service Pricing Total free
Bandwidth $0.12 per GB 0.5 TB
Requests $0.0075 per 10K 70M
Function Calls $0.000035 per GB second 1.5M

Amount of free usage on the Fastly free tier

Like we saw in the paid analysis, Fastly does very well with the number of HTTP requests made.

CloudFront Free Tier

CloudFront gives you a quota of each type of product it offers. Once you hit this quota, you start paying the charges outlined above.

Service Pricing Total free
Bandwidth 1 TB
Requests 10M
Function Calls 2M

Amount of free usage on the CloudFront free tier

Similar to the paid discussion, CloudFront’s bandwidth is more generous and the number of requests it will serve is far less. Function calls are dependent on the runtime of the function.

Requests or Bandwidth - How to Choose Fastly or CloudFront

We can see that Fastly has cheaper requests through their CDN and lower prices if the edge functions execute quickly. CloudFront bandwidth is a better deal, notwithstanding what we do not know about how Fastly pricing scales. You can see why LaunchDarkly would go with Fastly for their Feature Flags at the Edge product. It’s the most economical platform for that usage pattern. On the other hand, Slack is getting more mileage out of the bandwidth that it’s sending through CloudFront for its API.

The same holds true of compute. Fastly dominates short lived functions but prices quickly escalate when more compute needs to be done. The richness and variety of software services today dictate that there is ample room in the market for both - and which one to choose comes down to more than cost.

Other Considerations

We have touched on use case a bit here in the pricing conversation but there are other factors worth noting as well:

  • Feature Set: Fastly offers a comprehensive platform for these workloads. Of course, many of their products would compete against other AWS services, with Lambda@Edge being the most direct. AWS is well stocked with observability solutions whereas Fastly has an in-house offering. Developer experience, vendor lock-in, support, and reliability are all other factors to consider in a buying decision.
  • Many details of Fastly pricing are not known, and likewise on AWS there is a Security Savings Bundle for CloudFront which is similar to a Savings Plan for making upfront financial commitments. The discounts from these programs can change the monthly bill dramatically.
  • Usage patterns are key. You can see how dramatically the cost to run in the cloud can swing depending on what types of requests needs to be processed. Cloud costs are truly about cloud architecture and CDN pricing is no different.