Skip to content

Register to ecs services to the same target group

0

Is it possible to register two ecs services to the same target group.

The end goal is to test two versions of the app simultaneously and slowly route traffic from the old version to the new version.

Originally, I was going to register the new version to a new target group and do the routing at the ALB level. However, because of the number of rules, this becomes tedious and difficult to manage.

So my idea is to register both to the same target group. And manage routing (unscientifically) by increasing the tasks of the new service, and decreasing the tasks of the old service.

Is this possible? (obviously there are better solutions like code deploy but I need a quick and ugly way now)

asked 2 years ago1.5K views

2 Answers
2

Hello,

Registering Two ECS Services to the Same Target Group

It is possible to register two ECS services to the same target group to test two versions of your application simultaneously.

1.Select Target Group:

  • Navigate to the EC2 dashboard.
  • Select “Target Groups” under “Load Balancing” in the navigation pane.
  • Create a new target group or note the ARN of the existing one you want to use.

Create/select ECS Services:

  • Go to the ECS dashboard.
  • Select “Clusters” and choose your cluster.
  • Click “Create” under “Services”.

For each version of your app:

  • Choose the same cluster.

  • Select launch type (EC2 or Fargate).

  • Configure your service name and number of tasks.

  • Under “Load balancing”, select “Application Load Balancer”.

  • Choose the listener and select the target group you created or selected earlier.

  • Repeat for both versions.

Adjust Task Counts:

  • Go to the “Services” tab in your ECS cluster.
  • Select the service for the old version and click “Update”.
  • Adjust the “Desired tasks” to decrease the count.
  • Select the service for the new version and click “Update”.
  • Adjust the “Desired tasks” to increase the count.

Referral Documentation: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/register-multiple-targetgroups.html

EXPERT

answered 2 years ago

1
  • Hello, Thanks for the response, but I mentioned code deploy in my question, we cannot use it currently.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.