Search code examples
amazon-web-servicesdockeramazon-ecsamazon-ecr

How to deploy multiple services to AWS ECS?


I have a docker-compose setup made up with 2+ containers that I use for local development. I'm trying to deploy the following to AWS ECS and I successfully deployed the first service but I'm struggling deploying more. It seems like I'm missing something in the configuration.

To deploy the first service to ECS, I followed these steps:

  1. Deployed docker image to ECR
  2. Created an ECS cluster
  3. Created a task that I attached my ECR image to
  4. Configured a VPC
  5. Configured ELB
  6. Successfully launched a new instance inside of my ECS container

To deploy the second service, I'm trying to follow steps 1,3 and 6 and it seems like it's deployed successfully. However, when I try to hit any endpoint from the second service, it results in /404 at the first one.

As I understand, my current ELB configuration is set up to route all the traffic to the first instance, so my question is - which steps I should also re-use while deploying the 2nd service? Should it have a separate ELB and security group?

I tried googling it but all the articles are about deploying a single instance which I had no problems with.


Solution

  • You dont need to create a cluster for second service. You need create another task definition with new image of second service (deployed to the ECR). Next step is create a service in the cluster and setup Service discovery in the Configure network step.

    Documentation