Removing a Load Balancer from AZs
Function
This API is used to remove a load balancer from one or more AZs where it is working.

Constraints
-
This API is only available for dedicated load balancers.
-
You cannot remove a load balancer from all AZs where it is working.
Calling Method
For details, see Calling APIs.
URI
POST /v3/{project_id}/elb/loadbalancers/{loadbalancer_id}/availability-zone/batch-remove
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Definition: Specifies the project ID. For details about how to obtain a project ID, see Obtaining a Project ID. Constraints: N/A Range: The value can contain a maximum of 32 characters, including digits and lowercase letters. Default value: N/A |
loadbalancer_id |
Yes |
String |
Definition: Specifies the load balancer ID. Constraints: N/A Range: N/A Default value: N/A |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
No |
String |
Definition: Specifies the token used for IAM authentication. Constraints: N/A Range: N/A Default value: N/A |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
availability_zone_list |
Yes |
Array of strings |
Definition: Specifies the AZs where the load balancer will be removed. Constraints: N/A Range: N/A Default value: N/A |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
loadbalancer |
LoadBalancer object |
Definition: Specifies the load balancer. |
request_id |
String |
Definition: Specifies the request ID. Range: The value is automatically generated, and can contain characters including digits, lowercase letters, and hyphens (-). |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Definition: Specifies the load balancer ID. Range: N/A |
description |
String |
Definition: Provides supplementary information about the load balancer. Range: N/A |
provisioning_status |
String |
Definition: Specifies the provisioning status of the load balancer. Range:
|
admin_state_up |
Boolean |
Definition: Specifies whether the load balancer is enabled. Range:
|
provider |
String |
Definition: Specifies the provider of the load balancer. The value is fixed to vlb. Range: N/A |
pools |
Array of PoolRef objects |
Definition: Lists the IDs of backend server groups associated with the load balancer. |
listeners |
Array of ListenerRef objects |
Definition: Lists the IDs of listeners associated with the load balancer. |
operating_status |
String |
Definition: Specifies the operating status of the load balancer. Range:
|
name |
String |
Definition: Specifies the load balancer name. Range: N/A |
project_id |
String |
Definition: Specifies the ID of the project where the load balancer is used. Range: N/A |
vip_subnet_cidr_id |
String |
Definition: Specifies the ID of the IPv4 subnet where the load balancer is located. This subnet is also called the frontend subnet. Range: N/A |
vip_address |
String |
Definition: Specifies the private IPv4 address of the load balancer. Range: N/A |
vip_port_id |
String |
Definition: Specifies the ID of the port bound to the private IPv4 address of the load balancer. Range: N/A |
tags |
Array of Tag objects |
Definition: Specifies the tags added to the load balancer. |
created_at |
String |
Definition: Specifies the time when the load balancer was created. Range: The value must be in the format of yyyy-MM-dd'T'HH:mm:ss'Z'. |
updated_at |
String |
Definition: Specifies the time when the load balancer was updated. Range: The value must be in the format of yyyy-MM-dd'T'HH:mm:ss'Z'. |
guaranteed |
Boolean |
Definition: Specifies whether the load balancer is a dedicated load balancer. Range:
|
vpc_id |
String |
Definition: Specifies the ID of the VPC where the load balancer is located. Range: N/A |
eips |
Array of EipInfo objects |
Definition: Specifies the EIP bound to the load balancer.
NOTE:
This parameter has the same meaning as publicips.
|
ipv6_vip_address |
String |
Definition: Specifies the IPv6 address of the load balancer. Range: N/A |
ipv6_vip_virsubnet_id |
String |
Definition: Specifies the ID of the IPv6 subnet where the load balancer is located. This subnet is also called the frontend subnet. Range: N/A |
ipv6_vip_port_id |
String |
Definition: Specifies the ID of the port bound to the IPv6 address of the load balancer. Range: N/A |
availability_zone_list |
Array of strings |
Definition: Specifies the list of AZs where the load balancers are created. Range: N/A |
enterprise_project_id |
String |
Definition: Specifies the ID of the enterprise project. Range:
|
billing_info |
String |
Definition: Provides resource billing information. Range:
This parameter is unsupported. Please do not use it. |
l4_flavor_id |
String |
Definition: Specifies the ID of a flavor at Layer 4. If the current load balancer is an elastic flavor instance, this parameter defines the maximum elastic flavor at Layer 4. Range: N/A |
l4_scale_flavor_id |
String |
Definition: Specifies the ID of an elastic flavor at Layer 4. Range: N/A
NOTE:
This parameter has been discarded. Do not use it.
|
l7_flavor_id |
String |
Definition: Specifies the ID of a flavor at Layer 7. If the current load balancer is an elastic flavor instance, this parameter defines the maximum elastic flavor at Layer 7. Range: N/A |
l7_scale_flavor_id |
String |
Definition: Specifies the ID of an elastic flavor at Layer 7. Range: N/A
NOTE:
This parameter has been discarded. Do not use it.
|
gw_flavor_id |
String |
Definition: Specifies the flavor ID of the gateway load balancer. Range: N/A This parameter is unsupported. Please do not use it. |
loadbalancer_type |
String |
Definition: Specifies the load balancer type. Range:
This parameter is unsupported. Please do not use it. |
publicips |
Array of PublicIpInfo objects |
Definition: Specifies the EIP bound to the load balancer.
NOTE:
This parameter has the same meaning as eips.
|
global_eips |
Array of GlobalEipInfo objects |
Definition: Specifies the global EIP bound to the load balancer. |
elb_virsubnet_ids |
Array of strings |
Definition: Specifies the network IDs of subnets on the downstream plane. Range: N/A |
elb_virsubnet_type |
String |
Definition: Specifies the type of the subnet on the downstream plane. Range:
|
ip_target_enable |
Boolean |
Definition: Specifies whether to add backend servers that are not in the load balancer's VPC. If you set it to true, you can associate servers in a VPC connected through a VPC peering connection, in a VPC connected through a cloud connection, or in an on-premises data center at the other end of a Direct Connect or VPN connection, by using server IP addresses. Range:
|
frozen_scene |
String |
Definition: Specifies the scenario where the load balancer is frozen. If there are multiple scenarios, separate them with commas (,). Range:
|
deletion_protection_enable |
Boolean |
Definition: Specifies whether to enable deletion protection. This parameter is returned only when the deletion protection is enabled in the current region. Range:
|
autoscaling |
AutoscalingRef object |
Definition: Specifies information about elastic scaling. If elastic scaling is enabled, the load balancer flavors can be automatically adjusted based on incoming traffic.
NOTE:
This parameter has been deprecated, but is retained for compatibility purposes. Using this parameter is not recommended. If this parameter is specified, the load balancer with minimum flavors will be created and you will be billed for the minimum flavors.
|
public_border_group |
String |
Definition: Specifies the public border group. Range:
|
charge_mode |
String |
Definition: Specifies the charge mode of the load balancer. Range:
This parameter is unsupported. Please do not use it. |
service_lb_mode |
String |
Definition: Specifies load balancer mode. Range:
This parameter is unsupported. Please do not use it. |
instance_type |
String |
Definition: Specifies the internal service to which the load balancer belongs. Range: N/A This parameter is unsupported. Please do not use it. |
instance_id |
String |
Definition: Specifies the ID of the instance with which the load balancer is associated. Range: N/A This parameter is unsupported. Please do not use it. |
proxy_protocol_extensions |
Array of ProxyProtocolExtension objects |
Definition: Specifies the proxy protocol extension. This parameter is unsupported. Please do not use it. |
waf_failure_action |
String |
Definition: Specifies traffic distributing policies when the WAF is faulty. Range: discard indicates traffic will not be distributed. forward indicates traffic will be distributed to the default backend servers. |
protection_status |
String |
Definition: Specifies the protection status. Range:
|
protection_reason |
String |
Definition: Specifies why modification protection is enabled. Range: The value can contain a maximum of 255 Unicode characters, excluding angle brackets (<>). |
log_group_id |
String |
Definition: Specifies the ID of the log group that is associated with the load balancer. Range: N/A |
log_topic_id |
String |
Definition: Specifies the ID of the log topic that is associated with the load balancer. Range: N/A |
custom_qos_limit |
CustomQosLimit object |
Definition: Specifies the rate limit information of the ELB flavors. Range: N/A This parameter is unsupported. Please do not use it. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Definition: Specifies the backend server group ID. Range: N/A |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Definition: Specifies the listener ID. Range: N/A |
Parameter |
Type |
Description |
---|---|---|
key |
String |
Definition: Specifies the tag key. Range: N/A |
value |
String |
Definition: Specifies the tag value. Range: N/A |
Parameter |
Type |
Description |
---|---|---|
eip_id |
String |
Definition: Specifies the EIP ID. Range: N/A |
eip_address |
String |
Definition: Specifies the EIP. Range: N/A |
ip_version |
Integer |
Definition: Specifies the IP address version. Range:
|
Parameter |
Type |
Description |
---|---|---|
publicip_id |
String |
Definition: Specifies the EIP ID. Range: N/A |
publicip_address |
String |
Definition: Specifies the EIP. Range: N/A |
ip_version |
Integer |
Definition: Specifies the IP address version. Range:
|
Parameter |
Type |
Description |
---|---|---|
global_eip_id |
String |
Definition: Specifies the ID of the global EIP. Range: N/A |
global_eip_address |
String |
Definition: Specifies the global EIP. Range: N/A |
ip_version |
Integer |
Definition: Specifies the IP address version. Range:
|
Parameter |
Type |
Description |
---|---|---|
enable |
Boolean |
Definition: Specifies whether to enable elastic scaling for the load balancer. Range:
|
min_l7_flavor_id |
String |
Definition: Specifies the ID of the minimum elastic flavor at Layer 7. Range: N/A |
Parameter |
Type |
Description |
---|---|---|
vip_address |
String |
Definition: Specifies the IPv4 address. Constraints: N/A Range: N/A Default value: N/A |
ipv6_vip_address |
String |
Definition: Specifies the IPv6 address. Constraints: N/A Range: N/A Default value: N/A |
extension |
Extension object |
Definition: Specifies the proxy protocol extension. Constraints: N/A |
Parameter |
Type |
Description |
---|---|---|
ep_id |
String |
Definition: Specifies the VPC endpoint ID. Constraints: N/A Range: N/A Default value: N/A |
ep_service_id |
String |
Definition: Specifies the VPC endpoint service ID. Constraints: N/A Range: N/A Default value: N/A |
Parameter |
Type |
Description |
---|---|---|
l4 |
L4Limit object |
Definition: Specifies the rate limit information of the ELB flavors at Layer 4. |
l7 |
L7Limit object |
Definition: Specifies the rate limit information of the ELB flavors at Layer 7. |
Example Requests
Removing a load balancer from AZs
POST https://{ELB_Endpoint}/v3/060576782980d5762f9ec014dd2f1148/elb/loadbalancers/9b663cd9-61e4-483d-b91f-92fc337fecec/availability-zone/batch-remove { "availability_zone_list" : [ "az2", "az3" ] }
Example Responses
Status code: 200
Successful request.
{ "request_id" : "6c63d0ac-7beb-451d-a3e0-a066beaea316", "loadbalancer" : { "id" : "9b663cd9-61e4-483d-b91f-92fc337fecec", "project_id" : "060576782980d5762f9ec014dd2f1148", "name" : "elb-reset", "description" : "", "vip_port_id" : null, "vip_address" : null, "admin_state_up" : true, "provisioning_status" : "ACTIVE", "operating_status" : "ONLINE", "listeners" : [ ], "pools" : [ ], "tags" : [ ], "provider" : "vlb", "created_at" : "2021-07-26T02:46:31Z", "updated_at" : "2021-07-26T02:46:59Z", "vpc_id" : "59cb11ef-f185-49ba-92af-0539e8ff9734", "enterprise_project_id" : "0", "availability_zone_list" : [ "az1" ], "ipv6_vip_address" : null, "ipv6_vip_virsubnet_id" : null, "ipv6_vip_port_id" : null, "publicips" : [ { "publicip_id" : "0c07e04d-e2f9-41ad-b934-f58a65b6734d", "publicip_address" : "97.97.2.171", "ip_version" : 4 } ], "elb_virsubnet_ids" : [ "7f817f9c-8731-4002-9e47-18cb8d431787" ], "elb_virsubnet_type" : "dualstack", "ip_target_enable" : false, "autoscaling" : { "enable" : false, "min_l7_flavor_id" : "" }, "frozen_scene" : null, "eips" : [ { "eip_id" : "0c07e04d-e2f9-41ad-b934-f58a65b6734d", "eip_address" : "97.97.2.171", "ip_version" : 4 } ], "guaranteed" : true, "billing_info" : null, "l4_flavor_id" : "636ba721-935a-4ca5-a685-8076ce0e4148", "l4_scale_flavor_id" : null, "l7_flavor_id" : null, "l7_scale_flavor_id" : null, "vip_subnet_cidr_id" : null, "public_border_group" : "center", "protection_status" : "nonProtection", "protection_reason" : "" } }
SDK Sample Code
The SDK sample code is as follows.
Removing a load balancer from AZs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.elb.v3.region.ElbRegion; import com.huaweicloud.sdk.elb.v3.*; import com.huaweicloud.sdk.elb.v3.model.*; import java.util.List; import java.util.ArrayList; public class BatchRemoveAvailableZonesSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); ElbClient client = ElbClient.newBuilder() .withCredential(auth) .withRegion(ElbRegion.valueOf("<YOUR REGION>")) .build(); BatchRemoveAvailableZonesRequest request = new BatchRemoveAvailableZonesRequest(); request.withLoadbalancerId("{loadbalancer_id}"); BatchRemoveAvailableZonesRequestBody body = new BatchRemoveAvailableZonesRequestBody(); List<String> listbodyAvailabilityZoneList = new ArrayList<>(); listbodyAvailabilityZoneList.add("az2"); listbodyAvailabilityZoneList.add("az3"); body.withAvailabilityZoneList(listbodyAvailabilityZoneList); request.withBody(body); try { BatchRemoveAvailableZonesResponse response = client.batchRemoveAvailableZones(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
Removing a load balancer from AZs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkelb.v3.region.elb_region import ElbRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkelb.v3 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = ElbClient.new_builder() \ .with_credentials(credentials) \ .with_region(ElbRegion.value_of("<YOUR REGION>")) \ .build() try: request = BatchRemoveAvailableZonesRequest() request.loadbalancer_id = "{loadbalancer_id}" listAvailabilityZoneListbody = [ "az2", "az3" ] request.body = BatchRemoveAvailableZonesRequestBody( availability_zone_list=listAvailabilityZoneListbody ) response = client.batch_remove_available_zones(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
Removing a load balancer from AZs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" elb "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := elb.NewElbClient( elb.ElbClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.BatchRemoveAvailableZonesRequest{} request.LoadbalancerId = "{loadbalancer_id}" var listAvailabilityZoneListbody = []string{ "az2", "az3", } request.Body = &model.BatchRemoveAvailableZonesRequestBody{ AvailabilityZoneList: listAvailabilityZoneListbody, } response, err := client.BatchRemoveAvailableZones(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
Status Code |
Description |
---|---|
200 |
Successful request. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot