salt.modules.boto_elb

Connection module for Amazon ELB

New in version 2014.7.0.

configuration:

This module accepts explicit elb credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API and no further configuration is necessary. More Information available at:

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html

If IAM roles are not used you need to specify them either in a pillar or in the minion's config file:

elb.keyid: GKTADJGHEIQSXMKKRBJ08H
elb.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs

A region may also be specified in the configuration:

elb.region: us-east-1

If a region is not specified, the default is us-east-1.

It's also possible to specify key, keyid and region via a profile, either as a passed in dict, or as a string to pull from pillars or minion config:

myprofile:
    keyid: GKTADJGHEIQSXMKKRBJ08H
    key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
    region: us-east-1
depends:

boto >= 2.33.0

salt.modules.boto_elb.apply_security_groups(name, security_groups, region=None, key=None, keyid=None, profile=None)

Apply security groups to ELB.

CLI Example:

salt myminion boto_elb.apply_security_groups myelb '["mysecgroup1"]'
salt.modules.boto_elb.attach_subnets(name, subnets, region=None, key=None, keyid=None, profile=None)

Attach ELB to subnets.

CLI Example:

salt myminion boto_elb.attach_subnets myelb '["mysubnet"]'
salt.modules.boto_elb.create(name, availability_zones, listeners, subnets=None, security_groups=None, scheme='internet-facing', region=None, key=None, keyid=None, profile=None)

Create an ELB

CLI example to create an ELB:

salt myminion boto_elb.create myelb '["us-east-1a", "us-east-1e"]' '{"elb_port": 443, "elb_protocol": "HTTPS", ...}' region=us-east-1
salt.modules.boto_elb.create_listeners(name, listeners, region=None, key=None, keyid=None, profile=None)

Create listeners on an ELB.

CLI Example:

salt myminion boto_elb.create_listeners myelb '[["HTTPS", "HTTP", 443, 80, "arn:aws:iam::11  11111:server-certificate/mycert"]]'
salt.modules.boto_elb.create_policy(name, policy_name, policy_type, policy, region=None, key=None, keyid=None, profile=None)

Create an ELB policy.

New in version 2016.3.0.

CLI Example:

salt myminion boto_elb.create_policy myelb mypolicy LBCookieStickinessPolicyType '{"CookieExpirationPeriod": 3600}'
salt.modules.boto_elb.delete(name, region=None, key=None, keyid=None, profile=None)

Delete an ELB.

CLI example to delete an ELB:

salt myminion boto_elb.delete myelb region=us-east-1
salt.modules.boto_elb.delete_listeners(name, ports, region=None, key=None, keyid=None, profile=None)

Delete listeners on an ELB.

CLI Example:

salt myminion boto_elb.delete_listeners myelb '[80,443]'
salt.modules.boto_elb.delete_policy(name, policy_name, region=None, key=None, keyid=None, profile=None)

Delete an ELB policy.

New in version 2016.3.0.

CLI Example:

salt myminion boto_elb.delete_policy myelb mypolicy
salt.modules.boto_elb.delete_tags(name, tags, region=None, key=None, keyid=None, profile=None)

Add the tags on an ELB

name

name of the ELB

tags

list of tags to remove

CLI Example:

salt myminion boto_elb.delete_tags my-elb-name ['TagToRemove1', 'TagToRemove2']
salt.modules.boto_elb.deregister_instances(name, instances, region=None, key=None, keyid=None, profile=None)

Deregister instances with an ELB. Instances is either a string instance id or a list of string instance id's.

Returns:

  • True: instance(s) deregistered successfully

  • False: instance(s) failed to be deregistered

  • None: instance(s) not valid or not registered, no action taken

CLI Example:

salt myminion boto_elb.deregister_instances myelb instance_id
salt myminion boto_elb.deregister_instances myelb "[instance_id, instance_id]"
salt.modules.boto_elb.detach_subnets(name, subnets, region=None, key=None, keyid=None, profile=None)

Detach ELB from subnets.

CLI Example:

salt myminion boto_elb.detach_subnets myelb '["mysubnet"]'
salt.modules.boto_elb.disable_availability_zones(name, availability_zones, region=None, key=None, keyid=None, profile=None)

Disable availability zones for ELB.

CLI Example:

salt myminion boto_elb.disable_availability_zones myelb '["us-east-1a"]'
salt.modules.boto_elb.enable_availability_zones(name, availability_zones, region=None, key=None, keyid=None, profile=None)

Enable availability zones for ELB.

CLI Example:

salt myminion boto_elb.enable_availability_zones myelb '["us-east-1a"]'
salt.modules.boto_elb.exists(name, region=None, key=None, keyid=None, profile=None)

Check to see if an ELB exists.

CLI Example:

salt myminion boto_elb.exists myelb region=us-east-1
salt.modules.boto_elb.get_all_elbs(region=None, key=None, keyid=None, profile=None)

Return all load balancers associated with an account

CLI Example:

salt myminion boto_elb.get_all_elbs region=us-east-1
salt.modules.boto_elb.get_attributes(name, region=None, key=None, keyid=None, profile=None)

Check to see if attributes are set on an ELB.

CLI Example:

salt myminion boto_elb.get_attributes myelb
salt.modules.boto_elb.get_elb_config(name, region=None, key=None, keyid=None, profile=None)

Get an ELB configuration.

CLI Example:

salt myminion boto_elb.exists myelb region=us-east-1
salt.modules.boto_elb.get_health_check(name, region=None, key=None, keyid=None, profile=None)

Get the health check configured for this ELB.

CLI Example:

salt myminion boto_elb.get_health_check myelb
salt.modules.boto_elb.get_instance_health(name, region=None, key=None, keyid=None, profile=None, instances=None)

Get a list of instances and their health state

CLI Example:

salt myminion boto_elb.get_instance_health myelb
salt myminion boto_elb.get_instance_health myelb region=us-east-1 instances="[instance_id,instance_id]"
salt.modules.boto_elb.list_elbs(region=None, key=None, keyid=None, profile=None)

Return names of all load balancers associated with an account

CLI Example:

salt myminion boto_elb.list_elbs region=us-east-1
salt.modules.boto_elb.listener_dict_to_tuple(listener)

Convert an ELB listener dict into a listener tuple used by certain parts of the AWS ELB API.

CLI Example:

salt myminion boto_elb.listener_dict_to_tuple '{"elb_port":80,"instance_port":80,"elb_protocol":"HTTP"}'
salt.modules.boto_elb.register_instances(name, instances, region=None, key=None, keyid=None, profile=None)

Register instances with an ELB. Instances is either a string instance id or a list of string instance id's.

Returns:

  • True: instance(s) registered successfully

  • False: instance(s) failed to be registered

CLI Example:

salt myminion boto_elb.register_instances myelb instance_id
salt myminion boto_elb.register_instances myelb "[instance_id,instance_id]"
salt.modules.boto_elb.set_attributes(name, attributes, region=None, key=None, keyid=None, profile=None)

Set attributes on an ELB.

name (string)

Name of the ELB instance to set attributes for

attributes

A dict of attributes to set.

Valid attributes are:

access_log (dict)
enabled (bool)

Enable storage of access logs.

s3_bucket_name (string)

The name of the S3 bucket to place logs.

s3_bucket_prefix (string)

Prefix for the log file name.

emit_interval (int)

Interval for storing logs in S3 in minutes. Valid values are 5 and 60.

connection_draining (dict)
enabled (bool)

Enable connection draining.

timeout (int)

Maximum allowed time in seconds for sending existing connections to an instance that is deregistering or unhealthy. Default is 300.

cross_zone_load_balancing (dict)
enabled (bool)

Enable cross-zone load balancing.

CLI example to set attributes on an ELB:

salt myminion boto_elb.set_attributes myelb '{"access_log": {"enabled": "true", "s3_bucket_name": "mybucket", "s3_bucket_prefix": "mylogs/", "emit_interval": "5"}}' region=us-east-1
salt.modules.boto_elb.set_backend_policy(name, port, policies=None, region=None, key=None, keyid=None, profile=None)

Set the policies of an ELB backend server.

CLI Example:

salt myminion boto_elb.set_backend_policy myelb 443 "[policy1,policy2]"
salt.modules.boto_elb.set_health_check(name, health_check, region=None, key=None, keyid=None, profile=None)

Set attributes on an ELB.

CLI example to set attributes on an ELB:

salt myminion boto_elb.set_health_check myelb '{"target": "HTTP:80/"}'
salt.modules.boto_elb.set_instances(name, instances, test=False, region=None, key=None, keyid=None, profile=None)

Set the instances assigned to an ELB to exactly the list given

CLI Example:

salt myminion boto_elb.set_instances myelb region=us-east-1 instances="[instance_id,instance_id]"
salt.modules.boto_elb.set_listener_policy(name, port, policies=None, region=None, key=None, keyid=None, profile=None)

Set the policies of an ELB listener.

New in version 2016.3.0.

CLI Example:

salt myminion boto_elb.set_listener_policy myelb 443 "[policy1,policy2]"
salt.modules.boto_elb.set_tags(name, tags, region=None, key=None, keyid=None, profile=None)

Add the tags on an ELB

New in version 2016.3.0.

name

name of the ELB

tags

dict of name/value pair tags

CLI Example:

salt myminion boto_elb.set_tags my-elb-name "{'Tag1': 'Value', 'Tag2': 'Another Value'}"