What is the best way to host a React Native mobile app with a Django backend on AWS?

I want to build a mobile app using React Native (frontend) and Django (backend). I've never done this but ideally my application would have a simple frontend UI that displays data retrieved from Django (backend) which retrieves it from the MySQL database.

I am trying to grasp how I could host this using AWS but am having trouble as I cannot find the same question online. I have lots of programming experience but am a beginner when it comes to actually deploying code.

I could be thinking about this completely wrong, I am pretty lost, so any help would be very useful. Thank you in advance!

If you want to set up your project by using the right way, you must learn AWS of course. It depends on your requirements, I think you have 2 options:

  1. Learn AWS for setting up the project following best practices. A lot of things.
  2. If you want to deploy your app the fastest way. You just need to use an instance of AWS.

From easy to auto-scaling:

Method 1.

  • Create a EC2 instance,
  • ssh to it and setup nginx + uwsgi (or similar) as normal.
  • Make sure you create an instance with public IP and point DNS to it.

Method 2.

  • Create a EC2 instance as before
  • Package your django code with nginx + uwsgi as a docker container and start it on the EC2 instance.
  • Point DNS to the instance.

Method 3.

  • Create a ECS cluster
  • Package your django code with nginx + uwsgi as a docker container
  • Create a service and task-definition to run the docker image on the ECS cluster.
  • Point DNS to the cluster instance IP.

Method 4.

  • Create a ECS cluster
  • Package your django code with nginx + uwsgi as a docker container.
  • Create a service and task-definition to run the docker image on the ECS cluster.
  • Create a ELB load balancer and attach your django service as a listener to the ELB,
  • Point your DNS to the ELB.
  • Set up auto scaling alarms to start a new django service instance on for example CPU > 80% and memory > 80%, set alarms to scale down on CPU/memory < 40%

Method 5.

  • Create a ECS cluster
  • Package your django code with nginx + uwsgi as a docker container
  • Create a task-definition to run the docker image on the ECS cluster.
  • Create a ELB load balancer
  • Create and start two (for redundancy) Traefik instances to use as Ingress, attach your Traefik services as listeners to the ELB
  • Point your DNS to the ELB.
  • Add docker labels to route traffic to your different services via Traefik.
  • Set up auto scaling alarms to start a new django service instance on for example CPU > 80% and memory > 80%, set alarms to scale down on CPU/memory < 40%

For the database Create a managed RDS instance as you already figured out, its a normal postgres/mysql db just managed by AWS so you dont need to do it yourself.

Back to Top