salt.modules.boto_elb

Connection module for Amazon ELB

2014.7.0 新版功能.

configuration:

This module accepts explicit elb credentials but can also utilize IAM roles assigned to the instance trough 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.

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.

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_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)

Check to see if an ELB exists.

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

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_listener_policy(name, port, policies=None, region=None, key=None, keyid=None, profile=None)

Set the policies of an ELB listener.

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

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'}"