HAProxy Layer Reference - AWS OpsWorks

HAProxy Layer Reference


The AWS OpsWorks Stacks service reached end of life on May 26, 2024 and has been disabled for both new and existing customers. We strongly recommend customers migrate their workloads to other solutions as soon as possible. If you have questions about migration, reach out to the AWS Support Team on AWS re:Post or through AWS Premium Support.


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.