Now go to the ECS Service -> Select the Cluster that we created manually -> Create Service.
It will present the screen as shown below. Populate the information shown below by selecting:
- Select Fargate as Launch Type
- Task Definition, that we created earlier
- Ensure that the new manually created cluster is selected
- Give the Service Name
- Populate the Number of Tasks as 1 as we want to instantiate one container.
Under "Deployments" section, select the Deployment Type as "Blue/Green" and ensure the correct CodeDeploy role that we created earlier is selected
Under the "Configure Network" section, select the correct Cluster that we created manually, its subnets and the Security Group that allow port 80 and 8080 as shown below:
Select the Application Load Balancer that we created from the drop-down list (if missing, probably the Load Balancer is created in a different VPC, please check) and then click "Add to load balancer" button shown below:
Configure the Listener ports for Load Balancer for Production (Blue environment using port 80) and Test (Green environment using port 8080):
Populate the Target Group names as shown below:
Uncheck the Service Discovery Integration:
Leave the defaults for the "Service Auto SCaling" as Do not adjust.
Review the configuration and click "Create Service". Go ahead create this service and wait until it transitions to "Running" state as shown below: Now check the Service by going to EC2 Service -> Load Balancer -> Description Tab -> Copying the DNS name & accessing it via Web Browser as shown below: