libcloud.loadbalancer.drivers.elb module

class libcloud.loadbalancer.drivers.elb.ElasticLBDriver(access_id, secret, region, token=None)[source]

Bases: Driver

Parameters:
  • key (str) – API key or username to be used (required)

  • secret (str) – Secret password to be used (required)

  • secure (bool) – Whether to use HTTPS or HTTP. Note: Some providers only support HTTPS, and it is on by default.

  • host (str) – Override hostname used for connections.

  • port (int) – Override port used for connections.

  • api_version (str) – Optional API version. Only used by drivers which support multiple API versions.

  • region (str) – Optional driver region. Only used by drivers which support multiple regions.

Return type:

None

balancer_attach_compute_node(balancer, node)[source]

Attach a compute node as a member to the load balancer.

Parameters:
  • balancer (LoadBalancer) – LoadBalancer which should be used

  • node (Node) – Node to join to the balancer

Returns:

Member after joining the balancer.

Return type:

Member

balancer_detach_member(balancer, member)[source]

Detach member from balancer

Parameters:
  • balancer (LoadBalancer) – LoadBalancer which should be used

  • member (Member) – Member which should be used

Returns:

True if member detach was successful, otherwise False.

Return type:

bool

balancer_list_members(balancer)[source]

Return list of members attached to balancer

Parameters:

balancer (LoadBalancer) – LoadBalancer which should be used

Return type:

list of Member

connectionCls

alias of ELBConnection

create_balancer(name, port, protocol, algorithm, members, ex_members_availability_zones=None)[source]

Create a new load balancer instance

Parameters:
  • name (str) – Name of the new load balancer (required)

  • port (str) – Port the load balancer should listen on, defaults to 80

  • protocol (str) – Loadbalancer protocol, defaults to http.

  • members (list of Member) – list of Members to attach to balancer

  • algorithm (Algorithm) – Load balancing algorithm, defaults to ROUND_ROBIN.

Return type:

LoadBalancer

destroy_balancer(balancer)[source]

Destroy a load balancer

Parameters:

balancer (LoadBalancer) – LoadBalancer which should be used

Returns:

True if the destroy was successful, otherwise False.

Return type:

bool

ex_create_balancer_listeners(name, listeners=None)[source]

Creates one or more listeners on a load balancer for the specified port

Parameters:
  • name (str) – The mnemonic name associated with the load balancer

  • listeners (``list of tuple`) – Each tuple contain values, (LoadBalancerPortNumber, InstancePortNumber, Protocol,[SSLCertificateId])

ex_create_balancer_policy(name, policy_name, policy_type, policy_attributes=None)[source]

Create a new load balancer policy

Parameters:
  • name (str) – Balancer name to create the policy for

  • policy_name (str) – policy to be created

  • policy_type (str) – policy type being used to create policy.

  • policy_attributes (PolicyAttribute list) – Each list contain values, [‘AttributeName’, ‘value’]

ex_delete_balancer_policy(name, policy_name)[source]

Delete a load balancer policy

Parameters:
  • name (str) – balancer name for which policy will be deleted

  • policy_name (str) – The Mnemonic name for the policy being deleted

ex_list_balancer_policies(balancer)[source]

Return a list of policy description string.

Return type:

list of str

ex_list_balancer_policy_types()[source]

Return a list of policy type description string.

Return type:

list of str

ex_set_balancer_policies_backend_server(name, instance_port, policies)[source]

Replaces the current set of policies associated with a port on which the back-end server is listening with a new set of policies

Parameters:
  • name (str) – balancer name to set policies of backend server

  • instance_port (int) – Instance Port

  • policies (``string list`) – List of policies to be associated with the balancer

ex_set_balancer_policies_listener(name, port, policies)[source]

Associates, updates, or disables a policy with a listener on the load balancer

Parameters:
  • name (str) – balancer name to set policies for listerner

  • port (str) – port to use

  • policies (string list) – List of policies to be associated with the balancer

get_balancer(balancer_id, ex_fetch_tags=False)[source]

Return a LoadBalancer object.

Parameters:

balancer_id (str) – id of a load balancer you want to fetch

Return type:

LoadBalancer

list_balancers(ex_fetch_tags=False)[source]

List all loadbalancers

Return type:

list of LoadBalancer

list_protocols()[source]

Return a list of supported protocols.

Return type:

list of str

name = 'Amazon Elastic Load Balancing'
signature_version = '4'
website = 'http://aws.amazon.com/elasticloadbalancing/'