intel 1

How to auto register and deregister EC2 Instances behind Application Load Balancer (ALB) using Lambda?

Consider that you’re running an eCommerce website that doesn’t have scaling capability in place, and also you’re much aware of the load such as when the load will increase and decrease. You also don’t want to assign a dedicated person to manually add or

3 min read
Share:
How to auto register and deregister EC2 Instances behind Application Load Balancer (ALB) using Lambda?

Benefits of Using Lambda

AWS Lambda offers Scalability and you will be charged only when your code runs. There is no charge when your code is not running.

No need to create, manage and monitor servers. AWS will do it for you by running the code on a high-availability compute environment.

  • No servers to Manage

  • Continuous Scaling

  • Cost-optimized with milliseconds metering

  • Consistent performance at any scale

Supported Languages

  • Java 11, Java 8

  • Node.js 14.x , Node.js 12.x , Node.js 10.x

  • Python 3.6, Python 3.7, Python 3.8 

  • Ruby 2.7, Ruby 2.5

  • Go 1.x

  • .NET Core 2.1 (C#/Powershell)

  • .NET Core 3.1 (C#/Powershell)

What is Elastic Compute Cloud?

Elastic Compute Cloud is a primary service in the massive AWS ecosystem that is highly used by users. It is a virtual server with customizable hardware components and an OS using which you can run applications on the AWS infrastructure. It allows you to configure and run multiple virtual OS and manage the same with a single hardware. 

EC2 Instance Types:

AWS EC2 offers different types of EC2 instances based on different use cases.

Each instance type has a varying combination of CPU, Memory, Disk, and Network performance and we can choose the appropriate instance type that best fits our applications.

  • General purpose Instance types:

These instance types provide a balance of CPU, memory, and network resources and it is ideal for web servers and for hosting self-managed code repositories.

  • Compute-optimized Instance types:

These instance types are most suited for high-performance web servers, batch processing workloads, high-performance computing (HPC), machine learning interfaces, gaming servers, etc. 

  • Memory-optimized Instance types:

These instance types deliver high performance for workloads that manage huge data sets in memory. For example MongoDB.

  • Accelerated computing Instance types:

These instances use hardware accelerators to perform processing of graphics, data pattern matching, etc.

  • Storage optimized instance types:

These instances are designed for high workloads that perform sequential read and write operations on the large data which are stored locally.

What is Elastic Load Balancing?

Elastic load balancing automatically distributes incoming requests across multiple targets such as EC2 instances, containers, and lambda functions.

It can handle the load by spreading the traffic to multiple targets which are hosted in a single or across multiple availability zones.

There are four types of load balancers that offer auto-scaling and high availability

What is Elastic Load Balancing?

Application Load Balancer

  • Operated at the request level 

  • Routes based on the content of the request (layer 7)

  • Supports host-based routing, path-based routing, query string parameter-based routing, and source IP address-based routing 

  • Supports IP addresses, Lambda functions, and containers as targets 

Application Load Balancer

Classic Load Balancer

Classic Load Balancer

Network Load Balancer

  • Operated at the connection level 

  • Routes connections based on IP protocol data 

  • Offers high performance, low latency, and TLS offloading at a high scale 

  • Can have static IP/Elastic IP

  • Supports static IP addresses and UDP as targets

Network Load Balancer

Gateway Load Balancer

  • Gateway Load Balancer makes it easy to deploy, scale, and run third-party virtual networking appliances.

  • An ideal choice for working with third-party appliances for security, network analytics, and other use cases.

  • Can be deployed using orchestration tools from industry leaders


Related Articles

Stay in the loop

Get the latest insights and stories delivered to your inbox weekly.