'Calling Service A from B is giving connecton refused using ECS CLI with docker compose. What might be the reason?
I have setup an ECS Cluster and I'm using ECS CLI to create services/tasks from my existing docker-compose file. This is how my compose file looks like:
version: "3"
services:
service-a:
image: 537403345265.dkr.ecr.us-west-1.amazonaws.com/service-a:latest
environment:
- SPRING_PROFILES_ACTIVE=dev
ports:
- "8100:8100"
service-b:
image: 537403345265.dkr.ecr.us-west-1.amazonaws.com/service-b:latest
environment:
- SPRING_PROFILES_ACTIVE=dev
- SERVICE_A_BASE=service-a:8100
ports:
- "8101:8101"
depends_on:
- service-a
and my ecs-params.yml:
version: 1
task_definition:
task_execution_role: ecsTaskExecutionRole
ecs_network_mode: awsvpc
os_family: Linux
task_size:
mem_limit: 2GB
cpu_limit: 256
run_params:
network_configuration:
awsvpc_configuration:
subnets:
- "subnet-xx"
- "subnet-xy"
security_groups:
- "sg-xz"
assign_public_ip: ENABLED
where I'm using SERVICE_A_BASE
as the base URL for calling service A from Service B.
The same compose file works fine in my local but it is not working inside my ECS Cluster.
I have set inbound rules to allow ports 8100
and 8101
in my security group.
What might be wrong or Is there an another way of doing this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|