Web Server Load Balancing with NGINX Plus

Part of the appeal of cloud computing is the promise of greater uptime. To achieve that, all parts of your architecture must be highly available, including the load balancer. Now you can achieve high availability (HA) for NGINX Plus on AWS with a new solution that combines keepalived and the AWS Elastic IP address feature.

[Editor – For details about our other solution for highly available NGINX Plus on AWS in combination with the AWS Network Load Balancer (NLB), see our deployment guide.]

One widely used approach for HA on AWS is to put Elastic Load Balancer (ELB) in front of NGINX Plus instances. While this approach can be a good starting point, using ELB not only increases complexity and cost, but also imposes the following limitations:

  • ELB does not expose a static IP address, which is critical requirement for some applications.
  • ELB IP addresses are published using a DNS CNAME record; you cannot map a root domain (for example, to a CNAME unless you delegate all DNS to Route 53.
  • ELB does not support UDP, so you cannot take advantage of NGINX Plus’ UDP load balancing.
  • ELB doesn’t scale quickly, so large traffic spikes can result in dropped traffic.

To avoid these limitations, our solution eliminates ELB in favor of a combination of keepalived and an AWS Elastic IP address. An Elastic IP address is a single static IP address assigned to an active‑passive pair of NGINX Plus instances. If the primary NGINX Plus instance goes out of service, keeaplived automatically promotes the backup instance to primary and transfers the Elastic IP address to it as shown in the figure.

When two NGINX Plus nodes hosted in AWS share an elastic IP address, the address switches to the backup automatically when the primary goes down, preserving high availability

For more information, including step‑by‑step instructions, see our deployment guide. For information about on‑premises high availability of NGINX Plus, including a solution based on keepalived, see the NGINX Plus Admin Guide.

[Editor – For details about our other solution for highly available NGINX Plus on AWS in combination with AWS NLB, see our deployment guide.]

New to NGINX Plus on AWS? Try it free for 30 days. For links to the available AMIs, see Installing NGINX Plus AMIs on Amazon EC2.

Hero image
Free O'Reilly eBook: The Complete NGINX Cookbook

Updated for 2022 – Your Guide to Everything NGINX

About The Author

Michael Pleshakov

Michael Pleshakov

Platform Integration Engineer

About F5 NGINX

F5, Inc. is the company behind NGINX, the popular open source project. We offer a suite of technologies for developing and delivering modern applications. Together with F5, our combined solution bridges the gap between NetOps and DevOps, with multi-cloud application services that span from code to customer.

Learn more at or join the conversation by following @nginx on Twitter.