0
votes

I have successfully deployed a MEAN app on AWS ECS, but there are a couple things I don't have set-up properly.

1) If I spin up a new task, the Mongo data does not persist between the containers

2) Should my Mongo container and my frontend container be in the same task definition? This seems wrong because I feel like they should be able to scale independently of each other. But if they should be in separate task definitions, do I link them the same way?

Current Architecture:

  • 1 Task Defintion

    • contains frontend container and mongo container which are linked
    • I did not define any mounts or volumes (which I assume is why data isn't persisting, but I am struggling to figure out how to properly set this up)
  • 1 Cluster

  • 1 service

    • contains load balancer and auto-scaling group (when this auto-scaling group creates a new task, I run into the issue of not having data persistence)
1

1 Answers

0
votes

I guess what you assume is correct. Since you are not defining any mounts the data is not persistent. I recommend using Amazon EFS to Persist Data from Amazon ECS Containers.You can find step by step guide below to achieve the same.

Using Amazon EFS to Persist Data from Amazon ECS Containers