Cloud hosting costs optimization
What are the components of JAMSTACK hosting?
We need some compute to build the pages and CDN to host them.
It can be provided by same platform like Vercel or Netlify or we can use 3rd party CDN's like Fastly or Bunny CDN.
When it comes to where to host JAMSTACK websites there are following options:
Netlify - convinient but charging for the build minutes therefore difficult to predict the costs and while easy and quick to setup can be problematic down the road
Vercel - same
Quantum CDN z ktorym mielismy kontakt ktory obiecywal brak overage fees
Thats not all because AWS can actually offer 2 separate configs:
- Amplify (build and host) but for websites that are not larger than 6000 pages
- S3(data) + ECS(build) + Step Functions(orchestration) + S3(final html) + Cloudfront(serving final HTML via CDN)
Lets go config by config:
What are you being charged for on Netlify?
Dependent on the plan you can have better specs of the hardware which will allow to use less build minutes - more RAM and CPU faster the build time.
Overage fees are charged for traffic and build minutes, btw you can't limit build minutes anyhow and if you would refresh the content on the site too often or some sort of a glitch you can end up having hefty bill for a build minutes.
[screenshot of the post on facebook where netlify charged a ton of money for build minutes]
However one non-obvious charge besides those described above is amount of contributors to your repository - you going to be charged $30 per month per commit author, what does it mean in practice is that if someone shown up to make a quick fix and pushed it to the repository from which deployments are triggered, netlify will count them to the bill.
What are you being charged for on AWS?
AWS is granular, so this way you can see super small nano charges on 5-10 places, however your main cost would be compute - "build minutes" and writing into S3
why Im oddly specific about writing operation to S3 is that because S3 is generally very very cheap and cost nothing except for a situation where you actually putting files there.
To mitigate this situation we end up implementing an interesting workaround
[description about last updated date lambda and partial builds not running if nothing new arrived]