In the first installment of the Architecture Series, we will look at how the static part of this website is hosted.
The infrastructure for CloudBanshee is completely serverless. For those of you unfamiliar with the term, serverless refers to cloud technologies which:
Using serverless technologies makes it very easy to quickly deploy applications, without worrying about the underlying infrastructure. Because of its pay per use model, the cost will be very low (often free!) for small website, while the price will go up when you get more visitors. This way, the price tag grows with your customer base and revenue.
In Amazon's object storage service (Amazon Simple Storage Service, or S3) creating buckets is free. Once you start reading and writing files, you pay:
S3 is fully managed, which means you have no worries about how the data is stored. You only need to know that it is stored, with 99.999999999% durability and 99.99% availability. Your files are accessible through CLI, SDKs, APIs and HTTP requests.
Generally, there are two types of website content; static and dynamic. As the names imply, static content doesn't change often, while dynamic content might change with every request, or might be different for separate users. If a website contains images, for example, that is most like static content. If the website contains a "currently logged in users" ticker, or shows your personal content and friends, that's dynamic content.
From an infrastructure point of view, the two types require very different systems. Static content requires no processing, so you can store it in object storage like S3, and it's easily cacheable. Dynamic content generally needs a server running a backend application, for example written in Python, Java or PHP. This application might connect to a database to look up what content should be displayed.
The file size of the website, including images, is in the 10's of megabytes. The number of S3 PUT requests is very low, they only occur when uploading files. The number of S3 GET requests scales with usage of the site, but most of it is cached at CloudFront.
CloudFront itself costs $0.085 per GB of outbound traffic and $0.0100 per 10.000 HTTPS requests.
All in all, if CloudBanshee would get 10,000 visitors per month (I wish!), each requesting 15 files on average for a total of 2MB, with a cache hit rate of 75%, the monthly cost would be:
Grand total: $1.8685 per month. Ka-ching!