Blogging fun by Sergej Jevsejev

Serverless blog costs on AWS S3

· Read in about 3 min · (542 Words)

AWS Setup Costs

I was setting up 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 plus requests to DNS server.

Table of costs depending on the usage:

Type Comment Cost Url
S3 Traffic for First 1 TB / month $0.0300 per GB https://aws.amazon.com/s3/pricing/
S3 Requests GET and all other Requests $0.004 per 10,000 requests https://aws.amazon.com/s3/pricing/
Route53 for first 25 Hosted Zones $0.50 per hosted zone https://aws.amazon.com/route53/pricing/
Route53 Standard Queries first 1 Billion queries / month $0.400 per million queries https://aws.amazon.com/route53/pricing/

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

PageViews Transfer Requests S3 Transfer + Requests Route53 + Requests (50% of pageviews) Total
1k 1 GB 30k $0.03 + $0.012 $0.50 + $0.006 $0.548
10k 10 GB 300k $0.3 + $0.12 $0.50 + $0.06 $2.06
100k 100 GB 3 mln $3 + $1.2 $0.50 + $0.6 $5.3
250k 250 GB 7.5 mln $7.5 + $3 $0.50 + $1.5 $12.5
500k 500 GB 15 mln $15 + $6 $0.50 + $3 $24.5
1 mln 1 TB 30 mln $30 + $12 $0.50 + $6 $48.5
10 mln 10 TB 300 mln $300 + $120 $0.50 + $60 $480.5

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
  • Route53 Requests.

Quick Costs optimizations

S3 Data transfer

First lets use easy techniques which does 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 less 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.

Route53 Requests

These costs can be reduced by increasing TTL. This will decrease requests to Route53 effectively, because on the internet DNS proxies will cache it longer.

Most likely you will hit only tiny part of the estimated cost for it without any optimization More users will attend blog, more DNS proxies will cache your domain. Meaning more the percentage of users hitting Route53 DNS server directly will be decreasing.

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

Thanks and Happy blogging!