Deregistering VMs from a Load Balancer

You can deregister a backend virtual machine (VM) from a load balancer, for example in case of a decrease in traffic load on your backend VMs or if you need to service this VM.

As soon as a VM is deregistered from a load balancer, this load balancer stops routing the traffic to this VM. However, deregistering a VM does not stop the VM.

Deregistering VMs from a Load Balancer Using Cockpit v2

  1. In the Load Balancers dashboard, click the name of the load balancer you want to deregister a VM from.
    The load balancer details panel appears.

  2. Click on the Backend VMs tab and then click on IconAddFull Update.
    The UPDATE BACKEND VMS dialog box appears.

  3. From the VMs list, click IconClose next to the name of the VM you want to deregister from the load balancer.

  4. Click Update.
    The VM is deregistered from the load balancer.

Deregistering VMs from a Load Balancer Using OSC CLI

The UnlinkLoadBalancerBackendMachines command detaches one or more backend virtual machines (VMs) from a load balancer. You need to specify at least the BackendIps or the BackendVmIds parameter.

Request sample: Unlinking VMs from a load balancer
$ osc-cli api UnlinkLoadBalancerBackendMachines --profile "default" \
    --LoadBalancerName "example-lbu" \
    --BackendVmIds '["i-12345678", "i-87654321"]'
Request sample: Unlinking public IPs from a load balancer
$ osc-cli api UnlinkLoadBalancerBackendMachines --profile "default" \
    --LoadBalancerName "example-lbu" \
    --BackendIps '["192.0.2.0", "198.51.100.0"]'

This command contains the following attributes that you need to specify:

  • BackendIps: (optional) One or more public IPs of backend VMs.

  • BackendVmIds: (optional) One or more IDs of backend VMs.

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • LoadBalancerName: The name of the load balancer.

The UnlinkLoadBalancerBackendMachines command returns the following elements:

  • ResponseContext: Information about the context of the response.

Result sample: Unlinking VMs from a load balancer
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  }
}
Result sample: Unlinking public IPs from a load balancer
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  }
}

Deregistering Instances from a Load Balancer Using AWS CLI

To deregister an instance, use the deregister-instances-from-load-balancer command following this syntax:

Request sample
$ aws elb deregister-instances-from-load-balancer \
    --profile YOUR_PROFILE \
    --load-balancer-name LB_NAME \
    --instances i-01234567 \
    --endpoint https://lbu.eu-west-2.outscale.com

This command contains the following attributes that you need to specify:

  • (optional) profile: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI.

  • load-balancer-name: The name of the load balancer.

  • instances: One or more instance IDs.

  • endpoint: The endpoint corresponding to the Region you want to send the request to.

The deregister-instances-with-load-balancer command returns the following elements:

  • Instances: Information about one or more remaining instances registered with the load balancer. This element contains the following information for each registered instance:

    • InstanceId: The ID of the instance.

Result sample
{
    "Instances":
        {
            "InstanceId": "i-87654321"
        }
}

The specified instances are deregistered from the load balancer.

If an instance is receiving inbound traffic at the time you are deregistering it, the instance is only deregistered when the operation is finished.

Related Pages

Corresponding API Methods

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.