O'Reilly logo

Salt Cookbook by Anirban Saha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required