Serverless blog costs on AWS S3

Cover Image for Serverless blog costs on AWS S3
Sergej Brazdeikis
Sergej Brazdeikis

AWS Setup Costs

I was setting up the blog in AWS Ireland region, all prices will have reference to this region.

In the beginning of the blog only thing which does cost is - Amazon Route53 which will allow to setup your custom domain. It costs 0.50 Euro cents per month. The queries to alias records are for free.

Table of costs depending on the usage:

TypeCommentCostUrl
S3 Trafficfor First 1 TB / month$0.0300 per GBhttps://aws.amazon.com/s3/pricing/
S3 RequestsGET and all other Requests$0.004 per 10,000 requestshttps://aws.amazon.com/s3/pricing/
Route53for first 25 Hosted Zones$0.50 per hosted zonehttps://aws.amazon.com/route53/pricing/

Let's see how does it scale with blog, where 1 post contains on average 1 Mb page size and 30 requests to load it

PageViewsTransferRequestsS3 Transfer + RequestsRoute53Total
1k1 GB30k$0.03 + $0.012$0.50$0.542
10k10 GB300k$0.3 + $0.12$0.50$2
100k100 GB3 mln$3 + $1.2$0.50$4
250k250 GB7.5 mln$7.5 + $3$0.50$11
500k500 GB15 mln$15 + $6$0.50$21.5
1 mln1 TB30 mln$30 + $12$0.50$42.5
10 mln10 TB300 mln$300 + $120$0.50$479.9

Results

This setup scales well until 100k - 200k while still having reasonable price $5-$12 per month It is basically for free up to 10k pageviews When the blog scales, $24.5 is still good price for this availability

Most expensive parts of the traffic would be:

  • S3 Data Transfer

Quick Costs optimizations

S3 Data transfer

First, let's use easy techniques which do not interfere with content:

  • Assets browser caching
  • Image lazy loading
  • Combining JS and CSS into single files per page type
  • Minify HTML, JS, CSS
  • Compress Image, HTML, JS, CSS

Optimizations interfering with content:

  • Put fewer images, more code examples

Amazon Cloudfront is ~3x more expensive than S3 in Europe and US. In other parts of the world almost ~5x. It starts at $0.085 per GB, so I wouldn't recommend having this in front of S3 if you are in Europe. Here S3 delivers reasonable 20-30 ms response times.

Also, using CloudFlare free plan could be an option.

Summary

Serverless setup on Amazon S3:

  • is almost for free when traffic < 10k - $2
  • This setup is reasonable until 100k pageviews under $5
  • This setup is reasonable still until 200k-500k pageviews under $25. Higher, I suggest looking for possible content serving optimization with server side logic
  • Higher Traffic is expensive. All Content needs to be compressed and minified
  • Amazon CDN is expensive. Do not use it unless you really need assets distributed in exact world locations. Try Cloudflare.

Thanks and Happy blogging!

Sergej Brazdeikis
Sergej Brazdeikis