ALB and ECS Service

The Run Task method used in the previous section is great for testing, but if needed to run the platform apply it as a long-running process. You need to use Elastic Load Balancing Application Load Balancer (ALB) to deliver requests to your running containers. In addition to simple load balancing, it also creates capabilities such as path-based routing to different services.
ECS helps maintain the number of desired tasks (the number of containers running for a long time) and integrates ALB (handles the registration/deregistering of containers into the ALB)
The original ECS and ALB service was created by CloudFormation. In this lab, you will update those resources to host the encapsulated monolith service. Then you will create a new service from scratch after breaking the monolith.
- Access to CloudFormation
- Select STACK_NAME
- Select Stack details
- Select Outputs
- Select LoadBalancerDNS

- Use your browser to access LoadBalancerDNS

- Go to ECS
- Select Clusters
- Select Cluster-STACK_NAME

- In the Cluster-STACK_NAME interface, we proceed to update service
- In the Services section, choose the lab service
- Click Update

- In the service update interface
- Select the latest Revision
- Click Update

- Service update is successful.

- In the Cluster-STACK_NAME interface
- Select Task
- Check Monolith-Definition-STACK_NAME has been updated to Revision 22 (or any latest revision)

- Access to CloudFormation
- Select STACK_NAME
- Select Stack details
- Select Outputs
- Select S3WebsiteURL

- Use a browser to access S3WebsiteURL

- Perform user interface experience operations

- Access to ECS
- Select Cluster
- Select Cluster-STACK_NAME
- Select Tasks
- Select Monolith-Definition-STACK_NAME revision 2

- Select Logs

- Check the logs to make sure the monolith can read and write DynamoDB and can handle the like.

- Check CloudWatch logs from ECS to make sure Like processed

- Access CloudWatch
- Select Log groups
- Observe event log

- To distinguish between service and task. We can do the following steps:
- Select the service with the latest Revision
- Click Update

- Increase Desired task to 3 and update.

- After a successful update.
- Select Task to see 3 running tasks.
- From there, we see ECS services is a concept in which ECS allows running and maintaining a specific number of containers of task definitions in an ECS cluster. A service consists of many tasks and is maintained.
