I'm trying to setup a basic web application, which has an associated database, in AWS ECS. Locally I have these setup in different containers, and on ECS, I'd like to have separate task definitions so that I may scale the two separately.
- I registered my first task definition as
david_mongodb
successfully in ECS. It has a container nameddavid_mongodb
in it. - Then I attempted to register my second task definition as
david_web
, which has a container nameddavid_web
that links the database viadavid_mongodb:db
. When I click 'Create', it returns an error:
Unable to create Task Definition Linked container 'david_mongodb:db' doesn't exist.
It seems like task definitions can't see container names in other task definitions? I'm thinking putting both david_web
and david_mongodb
containers in the same task definition would work, but I don't want to do that: it would prevent me from scaling either web app or database separately. This overview seems to confirm that my architecture is recommended...
So how do I link containers that live in different task definitions? Or is there another clever way of handling this?