Heroku vs AWS Which is Best for Your Django project
Django Heroku Tutorial Series:
- Heroku vs AWS Which is Best for Your Django project
- How to deploy Django project to Heroku using Docker
- How to deploy Python project to Heroku in Gitlab CI
- How to use Heroku Pipeline
- Heroku Logs Tutorial
- How to monitor Heroku Postgres using heroku-pg-extras
Django Dokku Tutorial Series:
Introduction
Heroku and AWS might be the most popular options for people to host their Django projects. However, most people are confused about which one is best for their Django project.
In this Django Heroku tutorial, I will compare Heroku and AWS, after reading, you will get
- What is the relationship and difference between AWS and Heroku
- Which is best for your Django project.
IaaS vs PaaS
Infrastructure as a service (IaaS) is online service that provide high-level APIs used to dereference various low-level details of underlying network infrastructure like physical computing resources, location, data partitioning, scaling, security, backup, etc.
Most of Amazon computing services are IaaS
, such as Amazon EC2
, Amazon RDS
.
Platform as a Service (PaaS) is a category of cloud computing services that provides a platform allowing customers to develop, run, and manage applications without the complexity of building and maintaining the infrastructure typically associated with developing and launching an app_
Heroku is a PaaS platform.
Something in common
Many Heroku services (not third-party add-on) are based on AWS, for example, Heroku dyno
runs on Amazon EC2 instance, Heroku Redis
is based on AWS ElastiCache
.
You can see Heroku a high-level service on top of Amazon services. (or a wrapper of Amazon services)
AWS
AWS
includes many different cloud computing services, you can choose what you want and only pay what you used.
The AWS services are very flexible and stable, that is why many user like to use it to host Django project.
There is no solid answer to host Django project on AWS, so here I can give you some solutions.
-
You can deploy Django project on a single Amazon EC2 instance. You treat the EC2 instance as traditional server and install database on it.
-
You can choose
Amazon RDS
as your DB solution andAmazon s3
as your online storage solution -
You can use
Amazon CDN
andAmazon Elastic Load Balancing
to improve project performance.
Because AWS are so powerful, it is a very good option for large-scale Django project but you might need pro system admin or DevOps person to make it work as expected.
Heroku
Heroku provides an easy way for you to develop, deploy, monitor your project.
With Heroku, you can focus more on application development rather than the environment.
Heroku also has very detailed doc, you can find many useful articles from the doc.
Heorku has many Add-on, all can be used with Heroku app in an easy way. I like this feature very much because it is very flexible.
For example, if you do not know what 3-party package to handle Errors and Exceptions
in Django project, you can find some great options here.
Heroku is a very good option for small or mid sized company because you do not need to hire a pro sys admin. Heroku help you handle the job in pro way, that is why the Heorku cost you more money than AWS services. (in most cases)
Below is a typical solution for you to host Django project on Heroku.
- You deploy your Django code on Heroku Dyno.
- You use Heroku Postgres db service as DB for Django project.
- You use Amazon S3 storage to help you manage media files.
The interesting part here is, even you choose to use Heroku to host your Django project, you still need Amazon S3 storage service to let you upload media files. As I said, Heroku is a high-level service on top of Amazon services.
AWS Elastic Beanstalk
Some people found AWS has a service AWS Elastic Beanstalk
, and it seems very like Heroku
.
So here I would like to compare them to let you have a good understanding.
Heroku
and AWS Elastic Beanstalk
can both help you deploy your project and you do not need to config server, db, load balancers.
The doc of AWS Elastic Beanstalk
is not good compared with Heorku, I can only find some answers on Stackoverflow. Some advanced features is not frendly to users who have no DevOps background, so you might need an export when dealing with this.
AWS Elastic Beanstalk
would not cost you money, you should only pay for AWS basic services
such as EC2, S3 storage, RDS
, so Heroku would cost you more money compared with AWS Elastic Beanstalk
in most cases.
Docker
Both platforms has its own way to deploy Django project. For example, Heroku has buildpack
and many online resources would teach you to deploy in this way.
However, I would still recommend you to use Docker to deploy your project.
- It can save you time if you want to migrate the project to other platforms in the future.
- With Dockerfile, you can install OS dependency to your server, which is very flexible.
Conclusion
So which one is the winner? There is no solid answer here. When you decide which one to deploy your Django project, you need to check
-
If your team has a pro System admin, Devops person to handle this stuff, you can use AWS services. If not, I would recommend to use Heroku so you hired a virtual person (that is why you pay more) to do this and you can fosus on developing.
-
If you are new to Django, please use Heroku because it is easy for you to deploy your Django project even you do not understand what is Nginx and Gunicorn.
-
If your project is not big, I would also recommend Heroku because the final cost would have no big difference, but it can save your time when dealing with Devops work or if you have some similar problem.
Django Heroku Tutorial Series:
- Heroku vs AWS Which is Best for Your Django project
- How to deploy Django project to Heroku using Docker
- How to deploy Python project to Heroku in Gitlab CI
- How to use Heroku Pipeline
- Heroku Logs Tutorial
- How to monitor Heroku Postgres using heroku-pg-extras
Django Dokku Tutorial Series: