Update the Service

Now update the Service with the new Task Definition.

Select the Clusters from the left panel -> Select the Cluster that we created manually -> Select the Services tab -> Check mark the Service we created -> Click "Update" as shown below: dashboard Select the latest Task Definition you created dashboard Select Next Step and you would see a Configure Deployments screen where we select the CodeDeploy "Application" and "Deployment Group" from the drop-down list: dashboard Once selected, go ahead selecting Next Step and eventually click Update Service button -> It will trigger this new code deployment on the ECS using Blue/Green method.

In this case, the "Blue" environment refers to the container instance running as original task under this Service, accessed via port 80. However, during Blue/Green deploykent, a new Task with updated ECR image is spawned under the same service, representing the Green environment.

You may click the shortcut link to CodeDeploy console in the above screen OR Go to Services -> CodeDeploy -> Deployments -> Watch the current deployment in progress: dashboard Now monitor how the original traffic is still going through the Original Task set. dashboard During this time, if you access the load balancer DNS URL, it will show the original background color. After a pre-configured interval, it will switch the traffic to Green environment as shown below: dashboard At this time, your Load balancer DNS URL will show an updated background color. During this time, it will offer an option to stop the deployment and rollback. This time period is configurable and if no action is taken, it will destory the original task environment and leave the new task running as shown below. dashboard The switchover time can be customized as per your preference as shown below: CodeDeploy Console -> Applications -> Select the created application -> Select your newly created Deployment Group -> Click Edit -> Scroll down to "Deployment Settings" dashboard