AWS Load Balancer Interview Questions
1. What is an Elastic Load Balancer (ELB)?
Elastic Load Balancing (ELB) is a load-balancing service for Amazon Web Services (AWS) deployments. ELB automatically distributes incoming application traffic and scales resources to meet traffic demand. It also helps an IT team adjust capacity according to incoming application and network traffic. Load balancing divides the amount of work that a computer has to do among multiple computers so that users, in general, get served faster. ELB offers enhanced features including:
Detection of unhealthy Elastic Compute Cloud (EC2) instances.
Spreading instances across healthy channels only.
Flexible cipher support.
Centralized management of Secure Sockets Layer (SSL) certificates.
Optional public key authentication.
Support for both IPv4 and IPv6.
2. What are the key features provided by Elastic Load Balancer (ELB)?
Elastic Load Balancer (ELB) is a load balancing service provided by Amazon Web Services (AWS). It automatically distributes incoming application traffic across multiple targets, such as Amazon EC2 instances, containers, and IP addresses, in one or more Availability Zones. ELB helps to increase the availability and fault tolerance of your application.
Here are some key features provided by ELB:
- High availability: ELB automatically distributes traffic across multiple targets in multiple Availability Zones, which helps to increase the availability of your application.
- Health checks: ELB can perform health checks on your targets and automatically route traffic only to the healthy targets.
- Automatic scaling: ELB can scale automatically in response to incoming traffic, so you don’t have to worry about manually adding or removing targets as demand changes.
- SSL/TLS offloading: ELB can terminate SSL/TLS connections, which frees up your targets to focus on processing requests rather than handling encryption and decryption.
- Sticky sessions: ELB can maintain session affinity, or “stickiness,” so that requests from a particular client are always routed to the same target.
- Cross-zone load balancing: ELB can evenly distribute traffic across all targets in all enabled Availability Zones, which helps to increase the fault tolerance of your application.
- Customized health checks: ELB allows you to customize the health check settings for your targets, such as the ping target, the interval between pings, and the number of consecutive failures required before marking a target as unhealthy.
- Multiple load balancer types: ELB provides three types of load balancers: Application Load Balancer, Network Load Balancer, and Classic Load Balancer. Each type is optimized for different workloads and use cases.
3. How AWS Elastic Load Balancing Works?
A load balancer accepts incoming traffic from clients and routes requests to its registered targets (such as EC2 instances) in one or more Availability Zones. The load balancer also monitors the health of its registered targets and ensures that it routes traffic only to healthy targets. When the load balancer detects an unhealthy target, it stops routing traffic to that target. It then resumes routing traffic to that target when it detects that the target is healthy again.
A listener is a process that checks for connection requests. It is configured with a protocol and port number for connections from clients to the load balancer. Likewise, it is configured with a protocol and port number for connections from the load balancer to the targets.
4. What do you mean by a target group in AWS Load Balancing?
A target group is a group of resources that you can load balance across in Amazon Web Services (AWS). It is used to specify a group of targets, such as Amazon EC2 instances, containers, and IP addresses, that you want to route traffic to. Target groups are used with Application Load Balancers and Network Load Balancers in AWS.
5. What is the difference between auto-scaling and ELB?
Load balancing evenly distributes load to application instances in all availability zones in a region while auto scaling makes sure instances scale up or down depending on the load.
Auto-scaling is a cloud computing technique for dynamically allocating computational resources. Depending on the load to a server farm or pool, the number of servers that are active will typically vary automatically as user needs fluctuate.
Auto-scaling and load-balancing are related because an application typically scales based on load-balancing serving capacity. In other words, the serving capacity of the load balancer is one of several metrics that shape the auto-scaling policy.
6. How do you configure session affinity in an AWS Elastic Load Balancer?
Session affinity, also known as sticky sessions, is a technique used to route traffic from a user to the same web server during the duration of that user’s session. This ensures that all requests from that user are handled by the same server, which can be important for maintaining state information or ensuring that a user’s data is always available.
To configure session affinity in an AWS Elastic Load Balancer, you first need to create a load balancer and add your web servers to it. Then, you need to enable session affinity for the load balancer and specify the duration of the session. Finally, you need to configure your web servers to use the load balancer as their session affinity provider
7. Explain NLB in AWS?
AWS Network Load Balancer (NLB) is an Amazon Web Services (AWS) tool that distributes end user traffic across multiple cloud resources to ensure low latency and high throughput for applications.When a target becomes slow or unavailable, the Network Load Balancer routes traffic to another target.
A load balancer accepts incoming traffic from clients and routes requests to its registered targets (such as EC2 instances) in one or more Availability Zones. The load balancer also monitors the health of its registered targets and ensures that it routes traffic only to healthy targets.
8. What are the different types of load balancers?
There are three main types of load balancers: hardware, software, and cloud. Hardware load balancers are physical devices that are installed in between the server and the client. Software load balancers are installed on the server and work with the server software to distribute traffic. Cloud load balancers are hosted in the cloud and work with cloud-based applications.
9. What are the types of load balancers?
Elastic Load Balancing supports the following types of load balancers:
Application Load Balancers – It allows a developer to configure and route incoming end-user traffic to applications based in the Amazon Web Services (AWS) public cloud. It pushes traffic across multiple targets in multiple AWS Availability Zones.
Network Load Balancers – The Network Load Balancing feature distributes traffic across several servers by using the TCP/IP networking protocol. It works by combining two or more computers that are running applications into a single virtual cluster, NLB provides reliability and performance for web servers and other mission-critical servers.
- Gateway Load Balancers – GLB enables you to deploy, scale, and manage virtual appliances, such as firewalls, intrusion detection and prevention systems, and deep packet inspection systems. A Gateway Load Balancer operates at the third layer of the Open Systems Interconnection (OSI) model, the network layer.
- Classic Load Balancers – It provides basic load balancing across multiple Amazon EC2 instances and operates at both the request level and connection level. Classic Load Balancer is intended for applications that are built within the EC2-Classic network.
10. How can we assign a static IP address to an ELB?
The network interfaces IP address and Windows adapter IP addresses must match for a successful network connection.
- Open the Amazon Elastic Compute Cloud (Amazon EC2) console.
- Choose the Region where you want to create your Network Load Balancer.
- Allocate Elastic IP addresses for your Network Load Balancer.
- Note: Be sure to create the same number of Elastic IP addresses as the number of subnets that you select in each Availability Zone. For more information, see Elastic IP address limit.
- Under Load Balancing, choose Load Balancers.
- Choose Create Load Balancer.
- For Network Load Balancer, choose to Create.
- Select the VPC where you plan to provide the Network Load Balancer.
- Select the check box for the desired Availability Zone. Then, select the subnet in that Availability Zone.
- By default, the Network Load Balancer assigns a public IP address. If you want to use an Elastic IP address: For an IPv4 address, choose Choose an Elastic IP.
- Select one of the Elastic IP addresses available in the specified Region. This IP address will be assigned to the Network Load Balancer’s interfaces.
- (Optional) If you have multiple Availability Zones, repeat steps 8-9 for each zone.
- Complete the remaining steps for creating a Network Load Balancer.
11. What is VPC load balancer?
When you provision an Elastic Load Balancer for your VPC, you can assign security groups to it. You can place ELBs into VPC subnets, and you can also use subnet ACLs(Access Control Lists). The EC2 instances that you register with the Elastic Load Balancer do not need to have public IP addresses.
12. Which ELB component is responsible for monitoring the Load Balancers?
The controller service
The load balancers monitor the traffic and handle requests and The controller service is responsible for monitoring the load balancers, adding and removing load balancers as required and verifying that the load balancers are functioning properly.
13. What are the different types of load balancing options provided by Amazon Elastic Load Balancing (ELB)?
Amazon Elastic Load Balancing (ELB) provides three types of load balancers:
- Application Load Balancer: This type of load balancer is optimized for load balancing HTTP and HTTPS traffic. It allows you to specify routing rules based on the content of the request, such as the host, the path, and the query string.
- Network Load Balancer: This type of load balancer is optimized for load balancing TCP traffic and is designed to handle millions of requests per second with low latency. It can be used to load balance traffic to Amazon EC2 instances, containers, and IP addresses.
- Classic Load Balancer: This is the original type of load balancer provided by ELB and is designed to load balance HTTP, HTTPS, and TCP traffic. It is a good choice for applications that require simple load balancing with basic health checks.
14. Can we have internal or private ELB as origin in cloudfront?
No, it should be public as cloudfront doesn’t have a way to access private ELB.
15. Can you explain what round-robin load balancing is?
Round-robin load balancing is a method of load balancing that distributes traffic evenly across a number of servers. This is done by taking turns sending requests to each server in a sequence. This ensures that all servers receive an equal amount of traffic, and helps to prevent any one server from becoming overloaded.
16. Are you using Auto Scaling for your EC2 instances ? How have you configured Auto scaling policy ?
yes, you can create auto scaling policy to set max and min no of instance.
17. What is the best way to set up a load balancer in a cloud environment like Amazon Web Services?
The best way to set up a load balancer in a cloud environment like Amazon Web Services is to use a combination of an Elastic Load Balancer (ELB) and an Auto Scaling group. The ELB will distribute traffic evenly between the instances in the Auto Scaling group, and the Auto Scaling group will ensure that there are always enough instances available to handle the traffic.
18. List the types of techniques that are used by load balancers?
- Round Robin.
- Weighted Round Robin.
- Least Connection.
- Weighted Least Connection.
- Resource Based (Adaptive)
- Resource-Based (SDN Adaptive)
- Fixed Weighting.
- Weighted Response Time.
19. What is the difference between cluster and load balancing?
Here is a summary of the key differences between cluster and load balancing:
Feature | Cluster | Load Balancing |
---|---|---|
Purpose | Improved availability and fault tolerance | Improved performance and scalability |
How it works | Multiple servers work together as a single system | Incoming requests are distributed across multiple servers |
Failover | Automatically switches to a standby server in case of a failure | Automatically routes requests to healthy servers |
Scaling | Scales vertically by adding more servers to the cluster | Scales horizontally by adding more servers to the pool |
Load balancing algorithm | Typically uses active/passive or active/active configuration | Can use various algorithms, such as round robin, least connection, and source hash |
Example use cases | Database clusters, web servers | Web servers, application servers |
Cluster refers to a group of servers that work together as a single system to improve the availability and fault tolerance of a service. A cluster typically consists of multiple servers configured in an active/passive or active/active configuration, with one or more servers serving as standby servers that can take over if the primary server fails. Clusters are used to improve the availability of critical services, such as databases and web servers.
Load balancing refers to the process of distributing incoming requests across multiple servers in order to improve the performance and scalability of a service. Load balancing can be used with various types of servers, such as web servers and application servers, and can use various algorithms to determine how to distribute the requests. Load balancing helps to ensure that incoming requests are handled efficiently and that the service remains available even if one or more servers fail.
20. What’s the difference between Active and Passive Health Checks?
Active health checks are initiated by the load balancer itself, and passive health checks are initiated by the server. Active health checks are generally more accurate, because the load balancer can directly check whether the server is responding. Passive health checks are less accurate, because the server may be responding to the load balancer but not to actual client requests.
21. Why is it important to have fault tolerance when using a load balancer?
A load balancer is a key component in a high availability system, and as such, it is important to have a fault tolerance strategy in place in case the load balancer itself fails. One common way to achieve this is to use a redundant array of independent load balancers (RAIL), which provides a measure of protection should one of the load balancers fail.
22. When would you choose a Layer 4 vs a Layer 7 load balancer?
Layer 4 load balancers work at the transport layer, which means they are only concerned with the source and destination IP addresses and port numbers of packets. This makes them much simpler and faster than Layer 7 load balancers, which have to inspect the contents of each packet to make routing decisions. However, this also means that Layer 4 load balancers cannot make decisions based on things like the contents of HTTP headers, so they are not well-suited for load balancing web traffic.
23. Can you give me some examples of real world use cases for DNS load balancing?
DNS load balancing can be used in a number of different ways, depending on your specific needs. For example, if you have a website that gets a lot of traffic, you might use DNS load balancing to distribute that traffic across multiple servers, in order to avoid overloading any one server. Alternatively, you might use DNS load balancing to provide redundancy in case one of your servers goes down. There are many other potential use cases for DNS load balancing, but these are two of the most common.
24. Can you explain how DNS load balancing works? How does it differ from other forms of load balancing?
DNS load balancing is a method of load balancing that uses the Domain Name System (DNS) to distribute traffic across a number of servers. This type of load balancing is often used because it is simple to set up and does not require any special hardware or software. DNS load balancing is different from other forms of load balancing because it relies on the DNS system to route traffic, rather than using a dedicated load balancer.
25. What are some advantages of using a reverse proxy as opposed to a forward proxy with load balancing?
A reverse proxy can provide a single point of contact for clients, which can simplify the configuration of firewalls and improve security. Additionally, a reverse proxy can perform caching and compression, which can improve performance.
26. How can you improve security when using load balancers?
One way to improve security when using load balancers is to use a reverse proxy. A reverse proxy is a server that sits between the load balancer and the web server. The reverse proxy can provide an additional layer of security by filtering traffic and only allowing requests that meet certain criteria to pass through to the web server.
27. Is it possible to implement SSL encryption when using a load balancer? If yes, then how?
Yes, it is possible to implement SSL encryption when using a load balancer. This can be done by setting up a secure socket layer (SSL) between the load balancer and the web server. This will ensure that all data passing between the two is encrypted and secure.
28. What is the purpose of sticky sessions when using a load balancer?
Sticky sessions are used to ensure that all requests from a particular user are routed to the same server. This is important because it can help to ensure that session information is not lost and that the user experience is consistent.
29. Which of the Load balancer – Application / Network provides advanced features ? What is the use of other Load Balancer than if one provides advanced feature than other?
Application Load Balancer is high level ( Level 7 Networking Layer ) and provides better features and flexibility than Network Load Balancer ( Level 4 Network Layer) Network Load Balancer is turn provides better performance as it regulates raw traffic.
30. Difference between internal and external Load Balancer?
Here is a summary of the key differences between internal and external Elastic Load Balancers (ELBs) in Amazon Web Services (AWS):
Feature | Internal Load Balancer | External Load Balancer |
---|---|---|
Purpose | Load balancing within a Virtual Private Cloud (VPC) | Load balancing between the internet and a VPC |
Accessibility | Only accessible from within the VPC | Accessible from the internet |
Domain name | Uses a private IP address as the domain name | Uses a public DNS name as the domain name |
Supported protocols | HTTP, HTTPS, TCP | HTTP, HTTPS, TCP |
Supported load balancer types | Application Load Balancer, Network Load Balancer | Application Load Balancer, Network Load Balancer, Classic Load Balancer |
Health checks | Can perform health checks on targets within the VPC | Can perform health checks on targets within and outside the VPC |
Example use cases | Load balancing within a VPC, connecting multiple VPCs | Load balancing between the internet and a VPC, exposing a VPC-based service to the internet |
An internal Load Balancer is a type of ELB that is used to load balance traffic within a VPC. It is only accessible from within the VPC and uses a private IP address as the domain name. Internal Load Balancers are often used to load balance traffic between private subnets within a VPC or to connect multiple VPCs.
An external Load Balancer is a type of ELB that is used to load balance traffic between the internet and a VPC. It is accessible from the internet and uses a public DNS name as the domain name. External Load Balancers are often used to expose a VPC-based service to the internet or to load balance traffic between the internet and a VPC.