ECS Deployment FAQs
Frequently asked questions about ECS Blue-Green deployments.
This article addresses some frequently asked questions about ECS deployments in Harness.
What's the difference between the Swap and Traffic Shift steps?
There are two distinct flows for ECS Blue-Green deployments. Only one can be used in a pipeline:
Swap Step (Traditional Flow)
The BG deploy step asks for prod and stage listener rules (two separate rules, typically on different ports)
Does NOT ask for stage target group input
Target groups are determined automatically based on which listener rule they're attached to
Running the pipeline multiple times with the same configuration automatically alternates two versions of services between Blue/Green
At the end of each deployment, the target group attached to the prod listener rule will have the blue service
Traffic Shift Step (New Flow)
The BG step asks for one listener rule only (production rule)
This rule must be attached to precisely two target groups: stage and prod
Requires manual input for the stage target group ARN to determine which of the two target groups is stage vs prod
This design choice was intentional because users often have configurations like 60-40 or 20-80 traffic splits, not just 0-100
With non-zero traffic on both target groups, Harness cannot automatically determine which is stage vs prod
Why doesn't Harness automatically determine the stage target group like it does for ASG?
In ASG deployments, Harness automatically determines the prod target group as the one with 100% weight. However, for ECS traffic shifting:
Users often maintain traffic configurations like 60-40, 20-80, or other splits
It's not always 0-100, making automatic determination unreliable
Requiring explicit stage target group input gives users complete control over which target group receives the new deployment
Why does my active service get deleted during deployment?
Symptom: You see logs like:
Root Cause: Harness deletes any non-blue services attached to the stage target group at the start of each deployment. If you reuse the same stage target group that contains your current blue (active) service, Harness will delete it.
Solution: You must alternate the stage target group between deployments:
First deployment: Use
target-group-aas stage target group → After 100% shift,target-group-ahas blue serviceSecond deployment: Use
target-group-bas stage target group → After 100% shift,target-group-bhas blue service,target-group-ahas green serviceThird deployment: Use
target-group-aas stage target group → Continues alternating
If I constantly shift 100% traffic, do I still need to alternate target groups?
Yes. Even with a 100% traffic shift, you must alternate the stage target group between deployments if you want to maintain two versions of services alternating between Blue and Green (similar to the traditional swap flow).
What happens if you don't alternate:
First deployment: Blue service
__1is created in the stage target group with 100% trafficSecond deployment (same stage target group): Harness sees service
__1attached to stage target group, considers it non-blue (because it's in the stage target group), and deletes it before deploying new service__2You lose the ability to maintain two alternating versions
What happens when you do alternate:
First deployment: Blue service
__1intarget-group-awith 100% trafficSecond deployment (using
target-group-b): Service__1is now tagged as green (in the prod target group), blue service__2is created intarget-group-bwith 100% trafficThird deployment (using
target-group-a): Service__2is now green, blue service__3is created intarget-group-awith 100% traffic
How can I achieve traffic shifting without manual stage target group selection?
You can automate stage target group selection using a shell script step before the ECS Blue Green Create Service step. This eliminates the need for manual selection on each deployment:
Then reference the output in your ECS Blue Green Create Service step:
Can Harness provide a plugin or automatic inference for stage target group selection?
Stage target group selection is a manual input to support various traffic split configurations. If you have a specific use case that requires automatic inference, you can raise an enhancement request with Harness Support to explore options like:
Publishing a plugin for automatic target group selection
Adding configuration options for automatic inference based on traffic weights
Supporting specific traffic patterns (e.g., always select 0% weight target group)
What are the best practices for stage target group selection?
Use runtime input: Configure
stageTargetGroupArn: <+input>to manually verify before each deploymentDocument your target groups: Keep a record of your two target group ARNs and which one was used in the last deployment
Implement automation: Use a shell script step to select the target group with lower/zero traffic automatically
Verify before deployment: Check the AWS Console to confirm which target group currently has 100% traffic (this is your blue service)
Select the opposite: Choose the other target group as the stage target group for the new deployment
Does Harness support Network Load Balancers (NLB) with multiple listeners for Blue/Green deployments?
Short answer: No, multi-listener Blue/Green deployments with NLB are not currently supported.
Detailed explanation:
Harness supports Blue/Green deployments using Network Load Balancers (NLB), but only with a single pair of stage/production listeners. If your ECS service uses an NLB with multiple listeners (multiple ports exposed), the Blue/Green deployment strategy with dynamic target group switching will not work.
Current Harness limitation:
Only one stage listener and one production listener pair is supported
Multi-listener configurations are not supported, even though ECS natively supports them
What this means:
If your NLB exposes multiple ports (e.g., port 80, port 443, port 8080), Harness cannot perform automatic traffic shifting across all these listeners
Only a single listener/target group pair will be managed by Harness during Blue/Green deployments
Alternative approaches:
Use Application Load Balancer (ALB) instead, which fully supports Blue/Green deployments with Harness
Use Rolling deployment strategy instead of Blue/Green if NLB with multiple listeners is required
Configure separate load balancers for each port/service if Blue/Green is required
Related documentation
Last updated
Was this helpful?