Help Center> Elastic Load Balance> API Reference> Examples> Deleting a Shared Load Balancer

Deleting a Shared Load Balancer

Scenarios

Call the API to delete a dedicated load balancer.

Before you delete a load balancer, delete all resources associated with the load balancer. Figure 1 shows the associated resources.

Figure 1 Resources associated with a load balancer

Prerequisites

If you use a token for authentication, you must obtain the token and add X-Auth-Token to the request header of the ELB API when making a call. Obtain the token by following instructions in Authentication.

The token obtained from IAM is valid for only 24 hours. If you want to use a token for authentication, you can cache it to avoid frequent calling.

Procedure

Skip the corresponding step if the associated resources do not exist. For example, skip step 1 if no health check is configured for the backend server group associated with the load balancer.

  1. Delete the health check configured for each associated backend server group.
    1. Send DELETE https://{elb_endpoint}/v2/{project_id}/elb/healthmonitors/{healthmonitor_id}. project_id indicates the project ID, and healthmonitor_id indicates the health check ID.
    2. Add X-Auth-Token to the request header.
    3. Check the response.
  2. Remove backend servers from each associated backend server group.
    1. Send DELETE https://{elb_endpoint}/v2/{project_id}/elb/pools/{pool_id}/members/{member_id}. project_id indicates the project ID, pool_id indicates the backend server group ID, and member_id indicates the backend server ID.
    2. Add X-Auth-Token to the request header.
    3. Check the response.
  3. Delete each associated backend server group.
    1. Send DELETE https://{elb_endpoint}/v2/{project_id}/elb/pools/{pool_id}. project_id indicates the project ID, and pool_id indicates the backend server group ID.
    2. Add X-Auth-Token to the request header.
    3. Check the response.
  4. Delete the forwarding rules added to each listener.
    1. Send DELETE https://{elb_endpoint}/v2/{project_id}/elb/l7policies/{{policy_id}}/rules/{{rule_id}}". project_id indicates the project ID, policy_id indicates the forwarding policy ID, and rule_id indicates the forwarding rule ID.
    2. Add X-Auth-Token to the request header.
    3. Check the response.
  5. Delete the forwarding policies added to each listener.
    1. Send DELETE https://{elb_endpoint}/v2/{project_id}/elb/l7policies/{{policy_id}}. project_id indicates the project ID, and policy_id indicates the forwarding policy ID.
    2. Add X-Auth-Token to the request header.
    3. Check the response.
  6. Delete each listener added to the load balancer.
    1. Send DELETE https://{elb_endpoint}/v2/{project_id}/elb/listeners/{{listener_id}}. project_id indicates the project ID, and listener_id indicates the listener ID.
    2. Add X-Auth-Token to the request header.
    3. Check the response.
  7. Delete a load balancer.
    1. Send DELETE https://{elb_endpoint}/v2/{project_id}/elbloadbalancers/{{loadbalancer_id}}. project_id indicates the project ID, and loadbalancer_id indicates the load balancer ID.
    2. Add X-Auth-Token to the request header.
    3. Check the response.