admin管理员组

文章数量:1123412

I have an ECS service running a container with two port mappings:

"portMappings": [
    {
        "containerPort": 15672,
        "hostPort": 15672,
        "protocol": "tcp"
    },
    {
        "containerPort": 5672,
        "hostPort": 5672,
        "protocol": "tcp"
    }
]

I am using an AWS Network Load Balancer (NLB) with two listeners:

Listener 1 on port 15672, associated with Target Group 1 Listener 2 on port 5672, associated with Target Group 2 However, when the ECS task starts, it only registers with Target Group 2 (port 5672) for both listeners, even though the container exposes both port 15672 and 5672. I want the task to be registered with both target groups, one for each port.

What I’ve checked so far: Listener and Target Group Setup: Both listeners (on ports 15672 and 5672) are correctly configured on the NLB, with each targeting its own respective target group. ECS Service Configuration: The service includes both port mappings in the container definition. Health Checks: Health checks for both target groups are configured to check their respective ports (15672 for Target Group 1 and 5672 for Target Group 2). Question: Why is the ECS task only registering with Target Group 2 (port 5672) despite having a valid port mapping for both 15672 and 5672? What steps should I take to ensure that the task is properly registered with both target groups based on the respective listener ports?

I have an ECS service running a container with two port mappings:

"portMappings": [
    {
        "containerPort": 15672,
        "hostPort": 15672,
        "protocol": "tcp"
    },
    {
        "containerPort": 5672,
        "hostPort": 5672,
        "protocol": "tcp"
    }
]

I am using an AWS Network Load Balancer (NLB) with two listeners:

Listener 1 on port 15672, associated with Target Group 1 Listener 2 on port 5672, associated with Target Group 2 However, when the ECS task starts, it only registers with Target Group 2 (port 5672) for both listeners, even though the container exposes both port 15672 and 5672. I want the task to be registered with both target groups, one for each port.

What I’ve checked so far: Listener and Target Group Setup: Both listeners (on ports 15672 and 5672) are correctly configured on the NLB, with each targeting its own respective target group. ECS Service Configuration: The service includes both port mappings in the container definition. Health Checks: Health checks for both target groups are configured to check their respective ports (15672 for Target Group 1 and 5672 for Target Group 2). Question: Why is the ECS task only registering with Target Group 2 (port 5672) despite having a valid port mapping for both 15672 and 5672? What steps should I take to ensure that the task is properly registered with both target groups based on the respective listener ports?

Share Improve this question asked 16 hours ago Ivan YalovetsIvan Yalovets 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

Just having the ports mapped in the service is not enough. You have to register both target groups with the ECS service, so that the ECS service knows exactly which target groups it needs to update as it starts and stops tasks. This feature of ECS is documented here.

本文标签: amazon web servicesECS Task Registers Only on One Port for Both NLB Target GroupsStack Overflow