0 votes
in AWS by

I have two applications, “Image Processing” & “Order Processing,” hosted on my website on different EC2 servers in an Auto Scaling Group.

What is the best way to provide access to a user for any of these applications on this website?

1 Answer

0 votes
by

Answer: C.

Option A is incorrect.

While it is possible to provide a public DNS URL or a public IP address of your site to a user, it is not the best practice for several reasons.

It will be inefficient & cumbersome having the users to know many URL's or IP addresses as the number of applications increase.

Load distribution will not be possible with this scenario resulting in possible Single Point of Failures & unacceptable application performance as the load increases.

High Availability & failover will not be possible since we are exposing a static IP address or URL.

Option B is incorrect.

Classic Load Balancer provides basic load balancing capabilities that will distribute traffic equally among many servers under it.

Option C is CORRECT.

Application Load Balancer supports a feature named Path-based routing that will route requests based on URL patterns provided in the request.

Application Load Balancer achieves this feature by using Target groups that hold a specific set of resources.

EC2 instances, Auto Scaling groups, ECS tasks etc.

It is the responsibility of the Target group which keeps track of the instances of that particular class and intelligently route requests based on the load within a specific group.

Option D is incorrect.

Network Load balancers distribute load based on network variables like IP address, destination ports.

It is layer 4 (TCP) and below and is not designed to take into consideration anything at the application layer such as content type, cookie data, custom headers, user location, or the application behavior.

So Network Load balancer cannot ensure the availability of applications.

Diagram:

As seen in the diagram below, the Application Load Balancer acts as a single point of entry to various applications hosted on a website.

Based on the URL pattern, e.g., www.example.com/orders, the ALB will route the request based on the Path to a specific Target Group hosting the application.

In this case, the Orders Auto Scaling group will be held by the ALB's Target Group.

Within the Auto Scaling group, the ALB will intelligently route the request to different server instances depending on the load.

References:

https://youtu.be/-hFAWk6hyZA https://aws.amazon.com/elasticloadbalancing/#:~:text=Elastic%20Load%20Balancing%20automatically%20distributes,or%20across%20multiple%20Availability%20Zones. https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html https://docs.aws.amazon.com/autoscaling/plans/userguide/what-is-aws-auto-scaling.html

www.example.com  Application Load Balancing  /orders /images /registration  Orders | | images | Registration |  l | | )  | | | Auto Scaling. | Auto Scaling | Auto Scaling | group J | | group) ( =T ‘WrallabiMy Zor =a )

The best way to provide access to a user for any of these applications on the website is to use a load balancer. A load balancer is a tool that distributes incoming network traffic across multiple servers to ensure that no single server is overwhelmed. This helps to improve the availability and scalability of the website.

There are three types of load balancers in AWS:

  1. Classic Load Balancer (CLB): It routes traffic based on either Layer 4 (TCP/UDP) or Layer 7 (HTTP/HTTPS) information. It can balance traffic across EC2 instances in one or more Availability Zones.

  2. Application Load Balancer (ALB): It is designed to route traffic based on application-level content, such as URL or HTTP headers. It can balance traffic across multiple services or EC2 instances in one or more Availability Zones.

  3. Network Load Balancer (NLB): It is designed to handle TCP/UDP traffic at high speed, routing traffic based on IP protocol data. It can balance traffic across EC2 instances in one or more Availability Zones.

Considering the given scenario, as we have two applications, we should choose the Application Load Balancer (ALB) because it is specifically designed to route traffic based on application-level content. ALB allows routing traffic based on HTTP requests' contents, such as URL, headers, and cookies, to different EC2 instances running the two applications. ALB can also perform path-based routing, redirecting traffic to different servers based on the URL path specified in the request.

Using the public DNS URL of each server where applications are hosted may work, but it is not the best solution as it does not distribute traffic evenly, leading to potential overload of one server and underutilization of another.

Therefore, the correct answer to the given question is option C: I can use the Application Load Balancer that will route requests to different applications depending on the user's request.

...