- Newest
- Most votes
- Most comments
This error typically occurs during an Amazon ECS deployment using CodeDeploy when there's a configuration issue with the load balancer listeners and target groups. The error message suggests that the primary task set's target group is not properly associated with a listener on your Application Load Balancer (ALB).
To resolve this issue, you should:
-
Verify that both your production and test listeners are correctly configured and pointing to the appropriate target groups.
-
Check your AppSpec file to ensure that the target group configurations are correct.
-
Review your CodeDeploy deployment group settings, particularly the listener configurations.
-
Ensure that the IAM roles associated with your CodeDeploy service have the necessary permissions to modify the load balancer and target groups.
If you've recently made changes to your load balancer or listener configurations, double-check that these changes are consistent with your deployment setup.
If the issue persists after verifying these configurations, you may need to:
-
Temporarily suspend and then resume any Auto Scaling processes during the CodeDeploy deployment.
-
Consider using the AWS CLI or SDK to manually verify the state of your listeners and target groups.
-
Review the CodeDeploy and ECS service logs for any additional error messages or clues.
If you're still unable to resolve the issue after these steps, it may be beneficial to open a support case with AWS for a more in-depth investigation, as the root cause could be related to account-specific configurations or recent changes in your deployment process.
Sources
Troubleshoot Amazon ECS deployment issues - AWS CodeDeploy
answered a year ago
Hey, looks like the issue is that your ECS service is trying to use a target group that's not actually behind the listener you mentioned.
I've run into this before, here’s what you can check:
Go to your ALB in the AWS console, then to Listeners > pick the one from the error, and see if the target group your ECS service uses is actually there.
In your ECS service definition, check the loadBalancers section. The target group ARN you’re using there needs to match one that's attached to the listener.
If you’re using CodeDeploy with blue/green, make sure the production target group is correctly hooked into the listener in your deployment settings.
Hope that helps! Let me know if you want to walk through the setup — happy to help.
Steps: Validate Target Group Association: Make sure the primary target group is explicitly attached to the ALB listener ARN mentioned:
arn:aws:elasticloadbalancing:ap-southeast-1:791367083955:listener/app/ecs-dev-alb/72bfebe10b8ad3d2/8d5a7b137855163b
Check ECS Service Definition: In your ECS service (especially if using blue/green deployments), confirm that the loadBalancers block references the correct target group ARN.
"loadBalancers": [ { "targetGroupArn": "<must-match-attached-tg-to-listener>", "containerName": "your-container", "containerPort": 80 } ] Confirm Listener Rules:
Go to the ALB in the AWS Console → Listeners → View rules for the specified listener.
Ensure that the listener is configured to forward traffic to the target group your ECS service expects.
CI/CD Config (e.g., CodeDeploy):
If you're using AWS CodeDeploy for ECS blue/green deployments, ensure that the productionTargetGroup is mapped to the listener properly in the deployment configuration.
answered a year ago
Relevant content
asked a year ago
- AWS OFFICIALUpdated 2 years ago
