The URL of the load balancer (autogenerated by Amazon) is something cryptic..  *12440-32.amazonaws.com… What you need is a way to map this to your application’s domain name (myapp.mycompany.com).

QuickStart 2 step guide – If you use your own cert

  1. You need to upload your certificate to IAM. Without this, your cert is invalid. Optionally, you can use AWS’ certificate Manager to create a new cert.
  2. You need to configure a CNAME entry in your DNS server that points to the ALB.

Application based Routing, Multiple Backend URLs

An ALB at a given IP will receive a request from the client on port 443 (HTTPS). The Application Load Balancer will process the request, not only by receiving port, but also by looking at the destination URL.

Multiple services can share a single load balancer using path-based routing. In the example given here, the client could request any of the following URLs:

  • http://www.example.com/login
  • http://www.example.com/subscribe
  • http://www.example.com/download

The Application Load Balancer will be aware of each of these URLs based on patterns set up when configuring the load balancer, and can route to different clusters of servers depending on application need.

Host Based Routing combined with Path Based Routing

  • Application Load Balancers introduce the concept of rules, targets, and target groups. Rules determine how to route requests. Each rule specifies a target group, a condition, and a priority. An action is taken when the conditions on a rule are matched.
  • Targets are endpoints that can be registered as a member of a target group. Target groups are used to route requests to registered targets as part of the action for a rule.
  • Each target group specifies a protocol and target port. You can define health checks per target group and you can route to multiple target groups from each Application Load Balancer.
  • A new architecture shown here accomplishes with a single load balancer what previously required three. Here we’ve configured a single Application Load Balancer with three rules.

 

Container Service Integration

The Application Load Balancer also integrates with EC2 Container Service (ECS) using Service Load Balancing. This allows for dynamic mapping of services to ports as specified in the ECS task definition. Multiple containers can be targeted on the same EC2 instance, each running different services on different ports. The ECS task scheduler will automatically add these tasks to the ALB.

Route 53 Alias Record

If you don’t want to mess with your own DNS, you can add a Route 53 Alias Record, which will cost you about a $1 a month.

Anuj holds professional certifications in Google Cloud, AWS as well as certifications in Docker and App Performance Tools such as New Relic. He specializes in Cloud Security, Data Encryption and Container Technologies.

Initial Consultation

Anuj Varma – who has written posts on Anuj Varma, Hands-On Technology Architect, Clean Air Activist.