Serverless blog costs on AWS S3
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:
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/ |
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
PageViews | Transfer | Requests | S3 Transfer + Requests | Route53 | Total |
---|---|---|---|---|---|
1k | 1 GB | 30k | $0.03 + $0.012 | $0.50 | $0.542 |
10k | 10 GB | 300k | $0.3 + $0.12 | $0.50 | $2 |
100k | 100 GB | 3 mln | $3 + $1.2 | $0.50 | $4 |
250k | 250 GB | 7.5 mln | $7.5 + $3 | $0.50 | $11 |
500k | 500 GB | 15 mln | $15 + $6 | $0.50 | $21.5 |
1 mln | 1 TB | 30 mln | $30 + $12 | $0.50 | $42.5 |
10 mln | 10 TB | 300 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!