create_load_balancer_listeners ( $load_balancer_name, $listeners, $opt )

Creates one or more listeners on a LoadBalancer for the specified port. If a listener with the given port does not already exist, it will be created; otherwise, the properties of the new listener must match the properties of the existing listener.

Access

public

Parameters

Parameter

Type

Required

Description

$load_balancer_name

string

Required

The name of the new LoadBalancer. The name must be unique within your AWS account.

$listeners

array

Required

A list of LoadBalancerPort, InstancePort, Protocol, and SSLCertificateId items.

  • x - array - Optional - This represents a simple array index.
    • Protocol - string - Required - Specifies the LoadBalancer transport protocol to use for routing - HTTP, HTTPS, TCP or SSL. This property cannot be modified for the life of the LoadBalancer.
    • LoadBalancerPort - integer - Required - Specifies the external LoadBalancer port number. This property cannot be modified for the life of the LoadBalancer.
    • InstanceProtocol - string - Optional - Specifies the protocol to use for routing traffic to back-end instances - HTTP, HTTPS, TCP, or SSL. This property cannot be modified for the life of the LoadBalancer.

      If the front-end protocol is HTTP or HTTPS, InstanceProtocol has to be at the same protocol layer, i.e., HTTP or HTTPS. Likewise, if the front-end protocol is TCP or SSL, InstanceProtocol has to be TCP or SSL.

      If there is another listener with the same InstancePort whose InstanceProtocol is secure, i.e., HTTPS or SSL, the listener’s InstanceProtocol has to be secure, i.e., HTTPS or SSL. If there is another listener with the same InstancePort whose InstanceProtocol is HTTP or TCP, the listener’s InstanceProtocol must be either HTTP or TCP.

    • InstancePort - integer - Required - Specifies the TCP port on which the instance server is listening. This property cannot be modified for the life of the LoadBalancer.
    • SSLCertificateId - string - Optional - The ARN string of the server certificate. To get the ARN of the server certificate, call the AWS Identity and Access Management UploadServerCertificate API.

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

Create a new load balancer listener.

$elb = new AmazonELB();

$response = $elb->create_load_balancer_listeners('my-load-balancer', array(
	array(
		'Protocol' => 'HTTP',
		'LoadBalancerPort' => 1024,
		'InstancePort' => 65533
	)
));

// Success?
var_dump($response->isOK());
Result:
bool(true)

Related Methods

Source

Method defined in services/elb.class.php | Toggle source view (12 lines) | View on GitHub

public function create_load_balancer_listeners($load_balancer_name, $listeners, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['LoadBalancerName'] = $load_balancer_name;
    
    // Required list + map
    $opt = array_merge($opt, CFComplexType::map(array(
        'Listeners' => (is_array($listeners) ? $listeners : array($listeners))
    ), 'member'));

    return $this->authenticate('CreateLoadBalancerListeners', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback