<p>I don't think CodeDeploy is designed to include these type of use cases (also because the ramifications and options of allowing that flexibility are pretty much infinite). CodeDeploy is designed to manage B/G deployments for a single micro-service and not for a complex app like you are describing (sure your app isn't very complex but where do you stop supporting complex configurations?). In the context of CodeDeploy these would be two separate B/G deployments (and you'd need to test the back end service via API).</p>
<p>The only alternative I can think of to make this work is to create an additional (hidden/secured?) path in your front-end (e.g. <code>/SS_UI-8080</code> or perhaps passing a parameter to the <code>/SS_UI</code> path?) that allows you to modify (in your code) the port to use to connect to the back end service via the LB.</p>

CC BY-SA 4.0
2022-03-04T14:07:26.677Z
2022-03-04T14:07:26.677Z
mreferre
<p>I have two ECS services. UI(<code>http://&lt;LB&gt;/SS_UI/</code>) and API(<code>http://&lt;LB&gt;/webservice/</code>).
UI calls API and it's config file will have references to the API e.g.</p>
<pre><code>public static springURL = &quot;http://&lt;LB&gt;/webservice/&quot;
</code></pre>
<p>The documentation for blue green deployment for ECS(<a href="https://cicd-pipeline-cdk-eks-bluegreen.workshop.aws/en/ecsbg/serviceupd.html" rel="nofollow noreferrer">https://cicd-pipeline-cdk-eks-bluegreen.workshop.aws/en/ecsbg/serviceupd.html</a>) suggests creating two listener on the load balancer and two target groups</p>
<pre><code>&lt;LB&gt;:80 -&gt; Original set with live traffic
&lt;LB&gt;:8080 -&gt; Replacement set for testing
</code></pre>
<p>This works if I want to test changes to individual projects. I commit to API. Old version of API is on port 80. New version is on port 8080. After testing <code>http://&lt;LB&gt;:8080/webservice/</code> the switchover can happen after pre-defined time(pic)
<a href="https://i.sstatic.net/7eQEB.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/7eQEB.png" alt="enter image description here" /></a></p>
<p>But it doesn't work if I want to test from the UI because UI references the old version of API on port 80</p>
<p>If I commit changes to the UI project by referencing <code>http://&lt;LB&gt;:8080/webservice/</code>, even though I can test from UI at <code>http://&lt;LB&gt;:8080/SS_UI/</code>, I cannot allow the replacement set for UI to become the original set because API on port 8080 will eventually get deleted. How can I ensure that as soon as replacement set for API at port 8080 moves to port 80, the UI also starts referencing API of port 80?</p>

<amazon-web-services><amazon-ecs><bluegreen>
Making blue green deployment work for dependent ECS services
Rohini
# Making blue green deployment work for dependent ECS services

(Asked by: username_0 on 2021-12-19)

I have two ECS services. UI(http:///SS_UI/) and API(http:///webservice/).
UI calls API and it's config file will have references to the API e.g.
public static springURL = "http:///webservice/"

The documentation for blue green deployment for ECS(https://cicd-pipeline-cdk-eks-bluegreen.workshop.aws/en/ecsbg/serviceupd.html) suggests creating two listener on the load balancer and two target groups
:80 -> Original set with live traffic
:8080 -> Replacement set for testing

This works if I want to test changes to individual projects. I commit to API. Old version of API is on port 80. New version is on port 8080. After testing http://:8080/webservice/ the switchover can happen after pre-defined time(pic)

But it doesn't work if I want to test from the UI because UI references the old version of API on port 80
If I commit changes to the UI project by referencing http://:8080/webservice/, even though I can test from UI at http://:8080/SS_UI/, I cannot allow the replacement set for UI to become the original set because API on port 8080 will eventually get deleted. How can I ensure that as soon as replacement set for API at port 8080 moves to port 80, the UI also starts referencing API of port 80?

**Tags:** amazon-web-services, amazon-ecs, bluegreen


---

## 1 answers

### Answer by username_1 on 2022-03-04. Score: 0 | Accepted answer

I don't think CodeDeploy is designed to include these type of use cases (also because the ramifications and options of allowing that flexibility are pretty much infinite). CodeDeploy is designed to manage B/G deployments for a single micro-service and not for a complex app like you are describing (sure your app isn't very complex but where do you stop supporting complex configurations?). In the context of CodeDeploy these would be two separate B/G deployments (and you'd need to test the back end service via API).

The only alternative I can think of to make this work is to create an additional (hidden/secured?) path in your front-end (e.g. `/SS_UI-8080` or perhaps passing a parameter to the `/SS_UI` path?) that allows you to modify (in your code) the port to use to connect to the back end service via the LB.


---

