2015/07/20 - Apache Deltacloud has been retired.

For more information, please explore the Attic.


Load balancers

Load balancers allow distribution of ingress network traffic received by a specified IP address to a number of running instances. For example, a number of instances that are fulfilling the role of web servers can be attached to a single load balancer. It allows you to handle a large number of requests without influence on website performance.

This collection is not supported by all back-end cloud providers and at present, it is implemented for the Fujitsu GCP, Gogrid and Amazon EC2 cloud drivers. A load balancer is launched into a specific realm. Only instances within this specific realm may be attached to the balancer. Each load balancer has

  • a list of instances;
  • a public address representing the IP address that the balancer will respond on to client requests;
  • a created_at timestamp; and
  • a list of listeners.

Each listener has a protocol (e.g. TCP), a load balancer port and an instance port. The load balancer represents the port on which the balancer accepts connections. The instance port represents the port on which network traffic is forwarded to instances in the instance list.



Get the details of all load balancers

To retrieve details of all load balancers use call GET /api/load_balancers.

Example request:

GET /api/load_balancers?format=xml HTTP/1.1
Authorization: Basic AU1J3UB2121Afd1DdyQWxLaTYTmJMNF4zTXBoRGdhMDh2RUw5ZDAN9zVXVa==
User-Agent: curl/7.20.1 (i386-redhat-linux-gnu)
Host: localhost:3001
Accept: */*

Server response:

HTTP/1.1 200 OK
Content-Type: application/xml
Date: Thu, 28 Jul 2011 13:37:19 GMT
Content-Length: 1844

<?xml version='1.0' encoding='utf-8' ?>
<load_balancers>
  <load_balancer href='http://localhost:3001/api/load_balancers/webtraffic-balancer' id='webtraffic-balancer'>
    <actions>
      <link href='http://localhost:3001/api/load_balancers/webtraffic-balancer' method='delete' rel='destroy' />
      <link href='http://localhost:3001/api/load_balancers/webtraffic-balancer/register' method='post' rel='register' />
    </actions>
    <public_addresses>
      <address>webtraffic-balancer-1306196965.us-east-1.elb.amazonaws.com</address>
    </public_addresses>
    <created_at>Thu Jul 28 13:29:52 UTC 2011</created_at>
    <realm href='http://localhost:3001/api/realms/us-east-1a' id='us-east-1a'></realm>
    <listeners>
      <listener protocol='HTTP'>
        <load_balancer_port>80</load_balancer_port>
        <instance_port>3001</instance_port>
      </listener>
    </listeners>
    <instances>
    </instances>
  </load_balancer>
  <load_balancer href='http://localhost:3001/api/load_balancers/secure-site-balancer' id='secure-site-balancer'>
    <actions>
      <link href='http://localhost:3001/api/load_balancers/secure-site-balancer' method='delete' rel='destroy' />
      <link href='http://localhost:3001/api/load_balancers/secure-site-balancer/register' method='post' rel='register' />
    </actions>
    <public_addresses>
      <address>secure-site-balancer-1347100846.us-east-1.elb.amazonaws.com</address>
    </public_addresses>
    <created_at>Thu Jul 28 13:36:29 UTC 2011</created_at>
    <realm href='http://localhost:3001/api/realms/us-east-1a' id='us-east-1a'></realm>
    <listeners>
      <listener protocol='HTTP'>
        <load_balancer_port>443</load_balancer_port>
        <instance_port>443</instance_port>
      </listener>
    </listeners>
    <instances>
    </instances>
  </load_balancer>
</load_balancers>

Get the details for a load balancer

To retrieve details for a specific load balancer use call GET /api/load_balancers/:id.

Example request:

GET /api/load_balancers/secure-site-balancer?format=xml HTTP/1.1
Authorization: Basic AU1J3UB2121Afd1DdyQWxLaTYTmJMNF4zTXBoRGdhMDh2RUw5ZDAN9zVXVa==
User-Agent: curl/7.20.1 (i386-redhat-linux-gnu)
Host: localhost:3001
Accept: */*

Server response:

HTTP/1.1 200 OK
Content-Type: application/xml
Date: Thu, 28 Jul 2011 18:11:49 GMT
Content-Length: 1361

<?xml version='1.0' encoding='utf-8' ?>
<load_balancer href='http://localhost:3001/api/load_balancers/secure-site-balancer' id='secure-site-balancer'>
  <actions>
    <link href='http://localhost:3001/api/load_balancers/secure-site-balancer' method='delete' rel='destroy' />
    <link href='http://localhost:3001/api/load_balancers/secure-site-balancer/register' method='post' rel='register' />
  </actions>
  <public_addresses>
    <address>secure-site-balancer-1347100846.us-east-1.elb.amazonaws.com</address>
  </public_addresses>
  <created_at>Thu Jul 28 13:36:29 UTC 2011</created_at>
  <realm href='http://localhost:3001/api/realms/us-east-1a' id='us-east-1a'></realm>
  <listeners>
    <listener protocol='HTTP'>
      <load_balancer_port>443</load_balancer_port>
      <instance_port>443</instance_port>
    </listener>
  </listeners>
  <instances>
    <instance href='http://localhost:3001/api/instances/i-4f06b52e' id='i-4f06b52e'>
      <link href='http://localhost:3001/api/load_balancers/secure-site-balancer/unregister?instance_id=i-4f06b52e' rel='unregister' />
    </instance>
    <instance href='http://localhost:3001/api/instances/i-d706b5b6' id='i-d706b5b6'>
      <link href='http://localhost:3001/api/load_balancers/secure-site-balancer/unregister?instance_id=i-d706b5b6' rel='unregister' />
    </instance>
  </instances>
</load_balancer>

Create a load balancer

To create a new load balancer use call POST /api/load_balancers. Clients must provide the load balancer name, the realm_id to which the balancer is applied, a listener_protocol which the balancer will respond to (one of HTTP or TCP), the listener_balancer_port which specifies the port that the load balancer will be expecting network traffic on and finally the listener_instance_port which specifies the port on which instances will be receiving network traffic forwarded by the load balancer. As with other operations in the Deltacloud API, parameters may be specified by a requesting client using multipart/form-data or as application/x-www-form-urlencoded data.

Example request:

OST /api/load_balancers?format=xml HTTP/1.1
Authorization: Basic AU1J3UB2121Afd1DdyQWxLaTYTmJMNF4zTXBoRGdhMDh2RUw5ZDAN9zVXVa==
User-Agent: curl/7.20.1 (i386-redhat-linux-gnu)
Host: localhost:3001
Accept: */*
Content-Length: 121
Content-Type: application/x-www-form-urlencoded

name=webtraffic-balancer&realm_id=us-east-1c&listener_protocol=HTTP&
listener_balancer_port=80&listener_instance_port=3001

Server response:

HTTP/1.1 201 Created
Content-Type: application/xml
Date: Thu, 28 Jul 2011 13:30:05 GMT
Content-Length: 884

<?xml version='1.0' encoding='utf-8' ?>
<load_balancer href='http://localhost:3001/api/load_balancers/webtraffic-balancer' id='webtraffic-balancer'>
  <actions>
    <link href='http://localhost:3001/api/load_balancers/webtraffic-balancer' method='delete' rel='destroy' />
    <link href='http://localhost:3001/api/load_balancers/webtraffic-balancer/register' method='post' rel='register' />
  </actions>
  <public_addresses>
    <address>webtraffic-balancer-1306196965.us-east-1.elb.amazonaws.com</address>
  </public_addresses>
  <created_at>Thu Jul 28 13:29:52 UTC 2011</created_at>
  <realm href='http://localhost:3001/api/realms/us-east-1a' id='us-east-1a'></realm>
  <listeners>
    <listener protocol='HTTP'>
      <load_balancer_port>80</load_balancer_port>
      <instance_port>3001</instance_port>
    </listener>
  </listeners>
  <instances>
  </instances>
</load_balancer>

Delete a load balancer

To delete the specified load balancer from the back-end cloud provider use call DELETE /api/load_balancers/:id. The Deltacloud server will respond with HTTP 204 No Content for a succesful operation

Example request:

DELETE /api/load_balancers/webtraffic-balancer?format=xml HTTP/1.1
Authorization: Basic AU1J3UB2121Afd1DdyQWxLaTYTmJMNF4zTXBoRGdhMDh2RUw5ZDAN9zVXVa==
User-Agent: curl/7.20.1 (i386-redhat-linux-gnu)
Host: localhost:3001
Accept: */*

Server response:

HTTP/1.1 204 No Content
Date: Thu, 28 Jul 2011 13:23:33 GMT

Register an instance with a load balancer

To register a running instance with a specified load balancer use call POST /api/load_balancers/:id/register. Clients must provide the instance_id as a parameter to the request. The Deltacloud server will respond with a HTTP 204 No Content after a succesful operation. The Deltacloud server will accept client request parameters encoded as multipart/form-data or as application/x-www-form-urlencoded data.

Example request:

POST /api/load_balancers/secure-site-balancer/register?format=xml HTTP/1.1
Authorization: Basic AU1J3UB2121Afd1DdyQWxLaTYTmJMNF4zTXBoRGdhMDh2RUw5ZDAN9zVXVa==
User-Agent: curl/7.20.1 (i386-redhat-linux-gnu)
Host: localhost:3001
Accept: */*
Content-Length: 22
Content-Type: application/x-www-form-urlencoded

instance_id=i-4f06b52e
Server response:
HTTP/1.1 204 No Content
Date: Thu, 28 Jul 2011 18:20:03 GMT

Unreagister an instance from a load balancer

To unregister a specified instance from the given load balancer use call POST /api/load_balancers/:id/unregister. The client must supply the instance_id parameter to identify the instance, either as multipart/form-data or as application/x-www-form-urlencoded data.

Example request:

POST /api/load_balancers/secure-site-balancer/unregister?format=xml HTTP/1.1
Authorization: Basic AU1J3UB2121Afd1DdyQWxLaTYTmJMNF4zTXBoRGdhMDh2RUw5ZDAN9zVXVa==
User-Agent: curl/7.20.1 (i386-redhat-linux-gnu)
Host: localhost:3001
Accept: */*
Content-Length: 22
Content-Type: application/x-www-form-urlencoded

instance_id=i-4f06b52e

Server response:

HTTP/1.1 204 No Content
Date: Thu, 28 Jul 2011 19:09:17 GMT

Storage resources