Adds new instances to the LoadBalancer.
Once the instance is registered, it starts receiving traffic and requests from the LoadBalancer. Any instance that is not in any of the Availability Zones registered for the LoadBalancer will be moved to the OutOfService state. It will move to the InService state when the Availability Zone is added to the LoadBalancer.
In order for this call to be successful, the client must have created the LoadBalancer. The client must provide the same account credentials as those that were used to create the LoadBalancer.
Completion of this API does not guarantee that operation has completed. Rather, it means that the request has been registered and the changes will happen shortly.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Required |
The name associated with the LoadBalancer. The name must be unique within the client AWS account. |
|
|
Required |
A list of instance IDs that should be registered with the LoadBalancer. When the instance is stopped and then restarted, the IP addresses associated with your instance changes. Elastic Load Balancing cannot recognize the new IP address, which prevents it from routing traffic to your instances. We recommend that you de-register your Amazon EC2 instances from your load balancer after you stop your instance, and then register the load balancer with your instance after you’ve restarted. To de-register your instances from load balancer, use
|
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
---|---|
A |
Examples
Register one or more EC2 instances with a load balancer.
To set up a new load balancer for one or more instances, you need to:
- Create a new load balancer with
create_load_balancer()
. - Register one or more EC2 instances with the load balancer using
register_instances_with_load_balancer()
.
$elb = new AmazonELB(); $response = $elb->register_instances_with_load_balancer('my-load-balancer', array( array('InstanceId' => 'i-7e8d2913'), array('InstanceId' => 'i-8f9e4217') )); // 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