Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

alexmamun085's avatar

How to deploy multi dockerized application to AWS?

SaaS Multi-tenant Multi-database Microservice Application

Project Overview: We are building a Saas application with 4 individual applications. 2 of them are built on laravel and other 2 are built on react. All the applications are dockerized. Our Laravel applications are multi-tenant with multi-database and the database we are using is postgres. For communicating with each services we are using RabbitMQ. As of React they are using the API’s from both laravel applications.

  1. Service 1 - Laravel API (Dockerized - nginx, php, postgresql, redis, queue)
  2. Service 2 - Laravel API (Dockerized - nginx, php, postgresql, redis, queue)
  3. Frontend 1 - React App (Dockerized - node) - integrated with Service 1 API
  4. Frontend 2 - React App (Dockerized - node) - integrated with Service 1 & Service 2 API

How are we using this application locally -

  • All the services are bind with different local ports. Like - Service 1 8080, Service 2 8081, Frontend 1 3000, Frontend 2 3001
  • Hosts created locally like saasapp.test, foo.saasapp.test, bar.saasapp.test
  • Accessing frontends, Frontend 1 - saasapp.test:3000 and Frontend 2 - foo.saasapp.test:3001
  • Accessing APIs, saasapp.test:8080, foo.saasapp.test:8080 and foo.saasapp.test:8081

Currently we don't have any plan to use Kubernetes or any other technologies, Only Docker.

Questions:

  1. What is the way to deploy these dockerized applications to AWS?
  2. Main domain will access Frontend 1 and Frontend 1 will use Service 1 & Service 2 APIs
  3. Also sub-domain will access Frontend 2 and Frontend 2 will use Service 1 & Service 2 APIs
0 likes
1 reply
LaryAI's avatar
Level 58

The best way to deploy these dockerized applications to AWS is to use Amazon Elastic Container Service (ECS). ECS is a fully managed container orchestration service that makes it easy to run, stop, and manage Docker containers on a cluster.

To deploy your applications, you will need to create a cluster in ECS and then create a task definition for each of your applications. The task definition will define the container image, memory, CPU, port mappings, and other settings for each application.

Once the task definitions are created, you can create a service for each application. The service will define the number of tasks to run and the desired state of the tasks.

You can then create an Application Load Balancer (ALB) to route traffic to your applications. The ALB will route traffic to the tasks based on the port mappings defined in the task definitions.

Finally, you can create a Route 53 record to point your domain to the ALB. This will allow you to access your applications using the domain names you defined locally.

For more information on how to deploy applications to ECS, see the following documentation:

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_AWSCLI.html

Please or to participate in this conversation.