Why I Chose Amazon Web Services (AWS) As My Website Host
Up until this post, this website (isaacjordan.me) was hosted on DigitalOcean. It used the cheapest tier of DigitalOcean hosting: a $5 per month 512MB memory, single core, SSD machine. This machine also hosted the Postgres database locally.
However, there was a problem. Every time my site got a decent amount of traffic (thousands of pageviews per day), the page load time according to Google Analytics SHOT up. Here's a graph illustrating the problem (I'm not sure why the dates seem to be 1-2 days off):
I'm somewhat dubious about a 60+ second AVERAGE pageload speed with ~7,000 pageviews, but even I definitely noticed that site was taking a while to load under a bit of load.
I experimented a bit and found that increasing the hardware capacity of my server improved these metrics, but beyond the smallest tier DigitalOcean didn't seem to compare well to a more professional service such as AWS or Microsoft's Azure.
So I made the decision to move my site (and database) over to AWS. The resulting architecture is somewhat more complicated (and expensive) than the "single cheap machine" architecture. However, my initial reactions regarding speed are very positive - and another major factor is security. I'm much more trusting of AWS's EC2 security group management, and RDS instance network blocking, than I am of my own ability to lock down a public server.
So, the final result looks like this:
- Django running off Apache on EC2 (set-up via an Elastic Beanstalk) (likely to cost ~£5 - 8 per month), which is automatically updated by CodePipeline when I push to my private GitHub repo.
- Postgres running off a micro RDS (Relational Database Service) instance, locked down so that it is only accessible from the corresponding EC2 instance(s) (likely to cost ~£2 - 4 per month).
- Static files and media files are served from S3 (Simple Storage Service) since S3 if served over a CDN, and is incredibly fast and cheap (likely to cost ~£0.40 per month).
This is a high performance, high security, mostly low cost solution which is also easily scalable (Elastic Beanstalk can set up autoscaling Django instances, but it's a little more expensive - around £3 per month). I'll see how this system performs with a single nano EC2 instance, and a single micro RDS instance. But I have high hopes.
I plan on writing another post covering the details of how to set up this system, but I'll save it for another day.
If you enjoyed this post, please check out my other blog posts.