Using elastic load balancers

For a highly available infrastructure, in most modern production environments, load balancers are one of the most important components. In this recipe, we will learn how to configure AWS elastic load balancers using Salt modules.

How to do it...

  1. Create and edit /opt/ salt-cookbook/production/aws/elb.sls to have the following entries:
    salt-cookbook:
        boto_elb.present:
            - region: us-west-2
            - availability_zones:
                - us-west-2a
                - us-west-2c
            - keyid: <access-key>
            - key: '<secret-key>'
            - listeners:
                - elb_port: 80
                  instance_port: 80
                  elb_protocol: HTTP
            - attributes:
                cross_zone_load_balancing:
                  enabled: true
            - health_check:
                target: 'HTTP:80/'
            - cnames:
                - name: lb1.salt-cookbook.com.
                  zone: salt-cookbook.com.
                  ttl: 60
  2. Apply the state to ...

Get Salt Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.