How much does it cost to run a Django app on AWS using Elastic Beanstalk?

I've been running a Django app on Elastic Beanstalk for a couple of months and I have a decent idea now of the costs involved and the pros and cons of this approach. My goal was to get something going as soon as possible and I'd say Elastic Beanstalk is good for that purpose. There are a few things that took me more time to figure out and I might write about them too, but overall everything is running smoothly now.

Let's first describe what my setup is. Elastic Beanstalk is AWS's PaaS offering. I use a MySQL database running on RDS, a load balancer, a single EC2 instance and I have a DNS setup on Route 53. And that's more or less what I'm paying for. My bill was $42.58 last month. Breaking it down, here are the three major components it has:

  • EC2

I'm running a t2.micro instance. It costs $0.013 per hour and I paid for 745 hours. Total: $9.69.

  • Load balancing

Load balancing is not cheap. It costs $0.025 per hour and for 744 hours shown, that comes down to $18.60.

  • RDS

RDS costs $0.017 per RDS T2 Micro instance hour and for 743 hours shown, I paid $12.63.

If we sum these three, it comes down to $40.92. I also paid the following:

  • $0.56 for RDS service storage.
  • $0.45 for EBS.
  • $0.51 for Route 53.
  • $0.07 for data transfer (my site being served to places around the world, but my site is not popular yet).
  • $0.05 for S3 costs.
  • $0.01 for data processed by the load balancer.
  • $0.01 for SES.

These are minimal costs. Some of these are going to increase if my site becomes popular, but right now they are minimal.

How can I bring these costs down?

It's possible to do all of this with a single EC2 instance and avoid paying for load balancing and RDS. What I get from these components right now is convenience and scalability. I don't really need scalability, since I don't operate at scale and might not come to that point. Convenience can be traded for the learning experience of settings up things manually. AWS has an article on how to install a LAMP setup on EC2. It doesn't look too complicated. Supposedly my bill will be around $10 per month for my 1GB RAM t2.micro machine.

Another option would be to use Digital Ocean. They're basically offering something similar to EC2 instances, but I haven't looked too much in detail. Digital Ocean is an IaaS provider, you need to do some manual setup. Their cost is pretty similar. An offering with 1GB of RAM costs $10 per month too. That's a very rough comparison, but it seems like we're in the same ballpark if we're not pushing the limits on disk space or bandwidth.

It should also be possibe to continue to use Elastic Beanstalk, but run a MySQL server directly on the EC2 instance. Here's a long white paper that talks about this.