Book Image

Salt Cookbook

By : Anirban Saha
Book Image

Salt Cookbook

By: Anirban Saha

Overview of this book

Table of Contents (18 chapters)
Salt Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

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 the Salt master by running...