AWS ECS Container Communication

I have been to deploy a Postgres Container and Node JS Container too. I have them on the same Task Definition but my Hostname/ Server Name is not working, hence no communication. I have tried the following Host Names:

“localhost”
“localhost:5432”
“”

All the above are not working , What could I be Doing wrong?

Hi @Ndambuki

Is this part of a task on one of the AWS courses? Can you share the link,

No not part of a task but I was practicing on ECS and the instructor used ‘localhost’ .

I am not sure about the configurations of your task definition.
You probably need to add the PostgreSQL credentials as ENV in your task definition.

I have added the relevant ENV variables on both containers