ALB and ECS Service

Scale the adoption platform monolith with an ALB and an ECS Service

Scale the adoption platform monolith with an ALB and an 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.

  1. Access to CloudFormation
  • Select STACK_NAME
  • Select Stack details
  • Select Outputs
  • Select LoadBalancerDNS

Deploy the container using AWS Fargate

  1. Use your browser to access LoadBalancerDNS

Deploy the container using AWS Fargate

  1. Go to ECS
  • Select Clusters
  • Select Cluster-STACK_NAME

Deploy the container using AWS Fargate

  1. In the Cluster-STACK_NAME interface, we proceed to update service
  • Select Services
  • Select Edit

Deploy the container using AWS Fargate

  1. In the service update interface
  • Select Revision 2
  • Select Update

Deploy the container using AWS Fargate

  1. Service update is successful.

Deploy the container using AWS Fargate

  1. In the Cluster-STACK_NAME interface
  • Select Task
  • Check Monolith-Definition-STACK_NAME has been updated Revision 2

Deploy the container using AWS Fargate

  1. Access to CloudFormation
  • Select STACK_NAME
  • Select Stack details
  • Select Outputs
  • Select S3WebsiteURL

Deploy the container using AWS Fargate

  1. Use a browser to access S3WebsiteURL

Deploy the container using AWS Fargate

  1. Perform user interface experience operations

Deploy the container using AWS Fargate

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

Deploy the container using AWS Fargate

  1. Select Logs

Deploy the container using AWS Fargate

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

Deploy the container using AWS Fargate

  1. Check CloudWatch logs from ECS to make sure Like processed

Deploy the container using AWS Fargate

  1. Access CloudWatch
  • Select Log groups
  • Observe event log

Deploy the container using AWS Fargate

  1. To distinguish between service and task. We can do the following steps:
  • Select Service
  • Select Edit

Deploy the container using AWS Fargate

  1. Increase Desired task to 3 and update.

Deploy the container using AWS Fargate

  1. 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.

Deploy the container using AWS Fargate