HAProxy Layer Reference - AWS OpsWorks

HAProxy Layer Reference


AWS OpsWorks Stacks is no longer accepting new customers. Existing customers will be able to use the OpsWorks console, API, CLI, and CloudFormation resources as normal until May 26, 2024, at which time they will be discontinued. To prepare for this transition, we recommend you transition your stacks to AWS Systems Manager as soon as possible. For more information, see AWS OpsWorks Stacks End of Life FAQs and Migrating your AWS OpsWorks Stacks applications to AWS Systems Manager Application Manager.


This layer is available only for Linux-based stacks.

A HAProxy layer uses HAProxy—a reliable high-performance TCP/HTTP load balancer— to provide high availability load balancing and proxy services for TCP- and HTTP-based applications. It is particularly useful for websites that must crawl under very high loads while requiring persistence or Layer 7 processing.

HAProxy monitors traffic and displays the statistics and the health of the associated instances on a web page. By default, the URI is http://DNSName/haproxy?stats, where DNSName is the HAProxy instance's DNS name.

Short name: lb

Compatibility: A HAProxy layer is compatible with the following layers: custom, db-master, and memcached.

Open ports: HAProxy allows public access to ports 22 (SSH), 80 (HTTP), and 443 (HTTPS).

Autoassign Elastic IP addresses: On by default

Default EBS volume: No

Default security group: AWS-OpsWorks-LB-Server

Configuration: To configure a HAProxy layer, you must specify the following:

  • Health check URI (default: http://DNSName/).

  • Statistics URI (default: http://DNSName/haproxy?stats).

  • Statistics password (optional).

  • Health check method (optional). By default, HAProxy uses the HTTP OPTIONS method. You can also specify GET or HEAD.

  • Enable statistics (optional)

  • Ports. By default, AWS OpsWorks Stacks configures HAProxy to handle both HTTP and HTTPS traffic. You can configure HAProxy to handle only one or the other by overriding the Chef configuration template, haproxy.cfg.erb.

Setup recipes:

  • opsworks_initial_setup

  • ssh_host_keys

  • ssh_users

  • mysql::client

  • dependencies

  • ebs

  • opsworks_ganglia::client

  • haproxy

Configure recipes:

  • opsworks_ganglia::configure-client

  • ssh_users

  • agent_version

  • haproxy::configure

Deploy recipes:

  • deploy::default

  • haproxy::configure

Shutdown recipes:

  • opsworks_shutdown::default

  • haproxy::stop


  • AWS OpsWorks Stacks uses the instance's package installer to install HAProxy to its default locations.

  • You must set up syslog to direct the log files to a specified location. For more information, see HAProxy.