aws / amazon-ecs-cli

The Amazon ECS CLI enables users to run their applications on ECS/Fargate using the Docker Compose file format, quickly provision resources, push/pull images in ECR, and monitor running applications on ECS/Fargate.
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_CLI.html
Other
1.76k stars 302 forks source link

ECS-CLI remembers old Target group ARN, refuses to take the new TG ARN #1108

Open SongGithub opened 3 years ago

SongGithub commented 3 years ago

Summary

after replaced Target group with Terraform, and running ECSCLI. The CLI prompts error "the old Target group not exist"

Description

Config files

Expected Behavior

ECSCLI takes the new TG, and deploy normally.

Observed Behavior

ECSCLI remembers the deleted old TG ARN, and complains that it is missing, refuses to take the newly given TG ARN.

bvtujo commented 3 years ago

Hi @SongGithub! Thanks for the bug report. I have a couple of follow up questions so we can best resolve this issue.

First, are you using Classic Load Balancing, or Load Balancing V2 for your service? There are different usages for the --load-balancer-name, --target-group-arn, and --target-groups flags depending on your use.

If you're using a classic load balancer, you will want to use the --load-balancer-name flag. If you're using an Application or Network Load Balancer, the --target-group-arn or --target-groups flag will let you specify ELBv2 target groups.

What I suspect is happening is that you specified an ELBv1 load balancer the first time this service was created, deleted the target group attached to it, and are now using --target-group-arn to specify the new one. Is that correct?

SongGithub commented 3 years ago

I am using ALB, and have always been using ALB, so there has been no transition from CLB to ALB

jaredchu commented 3 years ago

I'm facing the same issue.

echo "targetGroupArn=$AWS_TARGETGROUP_ARN,containerName=$CONTAINER_NAME,containerPort=$CONTAINER_PORT"

-> Returns the correct target-group-arn.

ecs-cli compose --file $DOCKERCOMPOSE_FILE --ecs-params $ECS_PARAMS_FILE --project-name $AWS_ECS_PROJECT_NAME service up --target-groups "targetGroupArn=$AWS_TARGETGROUP_ARN,containerName=$CONTAINER_NAME,containerPort=$CONTAINER_PORT" --create-log-groups --cluster-config $AWS_ECS_CONFIG_NAME --ecs-profile $AWS_ECS_PROFILE_NAME --region $AWS_REGION --timeout 12

-> Returns OLD target-group-arn does not exist.

Update: It's FIXED when I delete the old Service in ECS Cluster

blackvirus18 commented 2 years ago

Is there a fix that exists for this? Facing the same issue.

rlekey commented 1 year ago

Seems like the only fix I've found is to delete the old service, but that seems, meh...

jacobmakarsky commented 10 months ago

So do we have to delete the existing service and re-make to get it to work? Seems it's the only fix. Weird the Cloud Formation dashboard acknowledges the target group ARN has changed but provides no way to easily change it or force an update.

Issue on my end is the original target group was deleted and a new one made with same name, but AWS appends some auto-generated id at the end of the ARN.

fogonthedowns commented 2 months ago

I have this issue. Is there a fix? Really don't want to delete the old service