Per-environment load balancer setup


I’m building a Harness workflow for an Amazon ECS app with a service behind a load balancer, but a bit of the config seems to be in the wrong place, so I’m unsure if I’m using Harness correctly.

My dummy “Widget” app has two environments and the “Frontend” service is the one behind the LB.


In the environments for both I’ve happily defined the two different service infrastructures - pointing to different AWS resources, which covers the different VPCs, security groups and so on:


The confusing bit is when I come to the workflow, which is a blue/green replacement that I’ve parameterised by environment so it can be used in either:


If I click into the Setup Load Balancer step, it seems this is the point to link the step to a particular load balancer plus prod and stage listeners. Obviously, this varies between the two environments - should this configuration be in the service infrastructure section instead?

I’ve come up with a workaround by adding service variables (alb_name, prod_listener_arn, stage_listener_arn), overriding them in both environments and then using these in the Setup Load Balancer step instead. Unfortunately it’s a bit hacky as I have to drop into the configuration as code section and needs a bit of work to set up:

Is there any better way of setting up this Setup Load Balancer step across the environments with one workflow? Should it be set up in the service infrastructure?


Always a few ways to skin the proverbial cat :cat:

For reference if anyone else reads this thread:

You are spot on, you could wire up an ECS Service Definition in the Harness Service.

Low hanging fruit for the parameterized deployment you could always make more than one pipeline :stuck_out_tongue:

I’ll see if any other of my colleagues has other prospectives.



True, but they’ll probably start diverging before I know it :smile:

I was particularly worried because I thought trying to edit the Setup Load Balancer step via the UI might wipe out the change I made in the YAML to use variables, but actually, after testing again I found it didn’t. It’s a little bit confusing in the UI because you can’t see that variables are used for the listeners, but it does do the right thing in not breaking it, which is good :+1:

1 Like