百度智能云

All Product Document

          Load Balance

          Application BLB Instance

          Application blb instances are aimed at users' complex application deployment architectures, especially large-scale website architectures. Constructed using a policy-based network management framework to achieve business-driven traffic load balancing.

          Self means app_blb_client; for the meaning of each parameter, please see the official blb documentation, Application blb Interface under API Reference

          Create Application blb Instance

          Description:

          • Create a LoadBalancer and return the assigned service address and instance ID.
          • The payment method is postpaid.
          • Identity and access management is required. If it does not pass the identity and access management, you may go to identity and access management under the Security Authentication in Baidu Open Cloud Console for authentication.

          You can create an application blb instance using the following code:

              @required(vpc_id=(bytes, str), 
                        subnet_id=(bytes, str)) 
              def create_app_loadbalancer(self, vpc_id, subnet_id, name=None, 
                                          desc=None, client_token=None, config=None): 

          The example is as follows:

              app_blb_client.create_app_loadbalancer(vpc_id="vpc-jupcnrwxqgvf", subnet_id="sbn-p64udgxpymae", name="blb_bj") 

          Update Application blb Instance

          Description:

          • Update the configuration information of a LoadBalancer.

          You can update an application blb instance using the following code:

              @required(blb_id=(bytes, str)) 
              def update_app_loadbalancer(self, blb_id, name=None, desc=None, 
                                          client_token=None, config=None): 

          The example is as follows:

              app_blb_client.update_app_loadbalancer(blb_id="lb-f27a5689", name="blb_bd") 

          Query the List of Application blb Instances

          Description:

          • Query all LoadBalancer information under the user account
          • Support query by id, name, and address of LoadBalancer. The matching rule supports partial inclusion (regular is not supported)
          • Support to find the bound LoadBalancer of the BCC specified by the bccId parameter
          • The returned result is the intersection of multiple query conditions
          • The result supports marker paging. The default paging size is 1,000, and can be specified by the maxKeys parameter

          You can query the list of application blb instances using the following code:

              def describe_app_loadbalancers(self, address=None, name=None, blb_id=None, 
                                             bcc_id=None, marker=None, max_keys=None, 
                                             config=None): 

          The example is as follows:

              app_blb_client.describe_app_loadbalancers() 

          Query Details of Application blb Instance

          Description:

          • Query details of all LoadBalancers under user account by id
          • Contain all listener port information of LoadBalancer

          You can query details of application blb instance using the following code:

              @required(blb_id=(bytes, str)) 
              def describe_app_loadbalancer_detail(self, blb_id, config=None): 

          The example is as follows:

              app_blb_client.describe_app_loadbalancer_detail(blb_id="lb-f27a5689") 

          Delete Application blb Instance

          Description:

          • Release the specified LoadBalancer which cannot be retrieved

          You can delete an application blb instance using the following code:

              @required(blb_id=(bytes, str)) 
              def delete_app_loadbalancer(self, blb_id, client_token=None, config=None): 

          The example is as follows:

              app_blb_client.delete_app_loadbalancer(blb_id="lb-f27a5689") 

          Create Application blb HttpListener Instance

          Description:

          • Under the specified LoadBalancer, create an application listener based on the HTTP protocol to listen to a frontend port and forward all HTTP requests sent to this port to the backend port monitored by the backend server according to the policy.

          You can create an application blb httpListener instance using the following code:

              @required(blb_id=(bytes, str), listener_port=int, 
                        scheduler=(bytes, str)) 
              def create_app_http_listener(self, blb_id, listener_port, 
                                           scheduler, keep_session=None, 
                                           keep_session_type=None, 
                                           keep_session_timeout=None, 
                                           keep_session_cookie_name=None, 
                                           x_forward_for=None, 
                                           server_timeout=None, 
                                           redirect_port=None, 
                                           client_token=None, 
                                           config=None): 

          The example is as follows:

              app_blb_client.create_app_http_listener(blb_id="lb-f27a5689", listener_port=80, scheduler="RoundRobin") 

          Create Application blb HttpsListener Instance

          Description:

          • Under the specified LoadBalancer, create an application listener based on the HTTPS protocol, listening to a frontend port, and converting all HTTPS requests sent to this port through SSL offload to HTTP requests before forwarding them to the backend port for monitoring the backend server according to the policy.

          You can create an application blb httpsListener instance using the following code:

              @required(blb_id=(bytes, str), listener_port=int, 
                        scheduler=(bytes, str), cert_ids=list) 
              def create_app_https_listener(self, blb_id, listener_port, 
                                            scheduler, cert_ids, 
                                            keep_session=None, 
                                            keep_session_type=None, 
                                            keep_session_timeout=None, 
                                            keep_session_cookie_name=None, 
                                            x_forward_for=None, server_timeout=None, 
                                            ie6_compatible=None, encryption_type=None, 
                                            encryption_protocols=None, 
                                            dual_auth=None, client_certIds=None, 
                                            client_token=None, config=None): 

          The example is as follows:

              app_blb_client.create_app_https_listener(blb_id="lb-f27a5689", listener_port=443, scheduler="RoundRobin", cert_ids=["cert-gs8bktrm7drp"]) 

          Create Application blb TcpListener Instance

          Description:

          • Under the specified LoadBalancer, create an application blb listener based on the TCP protocol to listen to a frontend port and forward all TCP traffic sent to that port according to the policy.

          You can create an application blb tcpListener instance using the following code:

              @required(blb_id=(bytes, str), 
                        listener_port=int, 
                        scheduler=(bytes, str)) 
              def create_app_tcp_listener(self, blb_id, listener_port, 
                                          scheduler, client_token=None, 
                                          config=None): 

          The example is as follows:

              app_blb_client.create_app_tcp_listener(blb_id="lb-f27a5689", listener_port=80, scheduler="RoundRobin") 

          Create Application blb UdpListener Instance

          Description:

          • Under the specified LoadBalancer, create an application listener based on the UDP protocol that listens to a frontend port and forwards all UDP traffic sent to that port according to the policy.

          You can create an application blb udpListener instance using the following code:

              @required(blb_id=(bytes, str), 
                        listener_port=int, 
                        scheduler=(bytes, str)) 
              def create_app_udp_listener(self, blb_id, listener_port, 
                                          scheduler, client_token=None, 
                                          config=None): 

          The example is as follows:

              app_blb_client.create_app_udp_listener(blb_id="lb-f27a5689", listener_port=53, scheduler="RoundRobin") 

          Create Application blb SslListener Instance

          Description:

          • Under the specified LoadBalancer, create an application blb listener based on the SSL protocol to listen to a frontend port and forward all SSL traffic sent to that port according to the policy.

          You can create an application blb sslListener instance using the following code:

              @required(blb_id=(bytes, str), listener_port=int, 
                        scheduler=(bytes, str), cert_ids=list) 
              def create_app_ssl_listener(self, blb_id, listener_port, 
                                          scheduler, cert_ids, 
                                          ie6_compatible=None, 
                                          encryption_type=None, 
                                          encryption_protocols=None, 
                                          dual_auth=None, client_certIds=None, 
                                          client_token=None, config=None): 

          The example is as follows:

              app_blb_client.create_app_ssl_listener(blb_id="lb-f27a5689", listener_port=443, scheduler="RoundRobin", cert_ids=["cert-gs8bktrm7drp"]) 

          Update Application blb HttpListener Instance

          Description:

          • Update the HTTP listener parameters under the specified LoadBalancer All the domains specified in the request parameters will be updated, the unspecified domains will remain unchanged, and the listener will be specified through the port.

          You can update the application blb httpListener instance using the following code:

              @required(blb_id=(bytes, str), 
                        listener_port=int) 
              def update_app_http_listener(self, blb_id, listener_port, 
                                           scheduler=None, keep_session=None, 
                                           keep_session_type=None, 
                                           keep_session_timeout=None, 
                                           keep_session_cookie_name=None, 
                                           x_forward_for=None, 
                                           server_timeout=None, 
                                           redirect_port=None, 
                                           client_token=None, 
                                           config=None): 

          The example is as follows:

              app_blb_client.update_app_http_listener(blb_id="lb-f27a5689", listener_port=80, scheduler="LeastConnection") 

          Update Application-ype blb HttpsListener Instance

          Description:

          • Update the HTTPS listener parameters under the specified LoadBalancer. All the domains specified in the request parameters will be updated, the unspecified domains will remain unchanged, and the listener will be specified through the port.

          You can update the application blb httpsListener instance using the following code:

              @required(blb_id=(bytes, str), listener_port=int) 
              def update_app_https_listener(self, blb_id, listener_port, 
                                            scheduler=None, 
                                            keep_session=None, 
                                            keep_session_type=None, 
                                            keep_session_timeout=None, 
                                            keep_session_cookie_name=None, 
                                            x_forward_for=None, 
                                            server_timeout=None, 
                                            cert_ids=None, 
                                            ie6_compatible=None, 
                                            encryption_type=None, 
                                            encryption_protocols=None, 
                                            dual_auth=None, 
                                            client_certIds=None, 
                                            client_token=None, 
                                            config=None): 

          The example is as follows:

              app_blb_client.update_app_https_listener(blb_id="lb-f27a5689", listener_port=443, scheduler="LeastConnection") 

          Update Application blb TcpListener Instance

          Description:

          • Update the TCP listener parameters under the specified LoadBalancer. All the domains specified in the request parameters will be updated. The unspecified domains remain unchanged, and the listener is specified by the port.

          You can update the application blb tcpListener instance using the following code:

              @required(blb_id=(bytes, str), 
                        listener_port=int) 
              def update_app_tcp_listener(self, blb_id, listener_port, 
                                          scheduler=None, 
                                          client_token=None, 
                                          config=None): 

          The example is as follows:

              app_blb_client.update_app_tcp_listener(blb_id="lb-f27a5689", listener_port=80, scheduler="LeastConnection") 

          Update Application blb UdpListener Instance

          Description:

          • Update the UDP listener parameters under the specified LoadBalancer. All the domains specified in the request parameters will be updated, the unspecified domains will remain unchanged, and the listener will be specified through the port.

          You can update the application blb udpListener instance using the following code:

              @required(blb_id=(bytes, str), 
                        listener_port=int) 
              def update_app_udp_listener(self, blb_id, listener_port, 
                                          scheduler=None, client_token=None, 
                                          config=None): 

          The example is as follows:

              app_blb_client.update_app_udp_listener(blb_id="lb-f27a5689", listener_port=53, scheduler="LeastConnection") 

          Update Application blb SslListener Instance

          Description:

          • Update the SSL listener parameters under the specified LoadBalancer. All the domains specified in the request parameters will be updated, the unspecified domains will remain unchanged, and the listener will be specified through the port.

          You can update the application blb sslListener instance using the following code:

              @required(blb_id=(bytes, str), listener_port=int) 
              def update_app_ssl_listener(self, blb_id, listener_port, 
                                          scheduler=None, 
                                          cert_ids=None, 
                                          ie6_compatible=None, 
                                          encryption_type=None, 
                                          encryption_protocols=None, 
                                          dual_auth=None, 
                                          client_certIds=None, 
                                          client_token=None, 
                                          config=None): 

          The example is as follows:

              app_blb_client.update_app_ssl_listener(blb_id="lb-f27a5689", listener_port=443, scheduler="LeastConnection") 

          Query Application blb HttpListener Instance

          Description:

          • Query information about all HTTP listeners under the specified LoadBalancer
          • Support matching query by listener port
          • The result supports marker paging. The default paging size is 1,000, and can be specified by the maxKeys parameter

          You can query the application blb httpListener instance using the following code:

              @required(blb_id=(bytes, str)) 
              def describe_app_http_listener(self, blb_id, listener_port=None, 
                                             marker=None, max_keys=None, 
                                             config=None): 

          The example is as follows:

              app_blb_client.describe_app_http_listener(blb_id="lb-f27a5689") 

          Query Application blb HttpsListener Instance

          Description:

          • Query information about all HTTPS listeners under the specified LoadBalancer
          • Support matching query by listener port
          • The result supports marker paging. The default paging size is 1,000, and can be specified by the maxKeys parameter

          You can query the application blb httpsListener instance using the following code:

              @required(blb_id=(bytes, str)) 
              def describe_app_https_listener(self, blb_id, listener_port=None, 
                                              marker=None, max_keys=None, 
                                              config=None): 

          The example is as follows:

              app_blb_client.describe_app_https_listener(blb_id="lb-f27a5689") 

          Query Application blb HttpListener Instance

          Description: 
          • Query information about all TCP listeners under the specified LoadBalancer
          • Support matching query by listener port
          • The result supports marker paging. The default paging size is 1,000, and can be specified by the maxKeys parameter

          You can query the application blb tcpListener instance using the following code:

              @required(blb_id=(bytes, str)) 
              def describe_app_tcp_listener(self, blb_id, listener_port=None, 
                                            marker=None, max_keys=None, 
                                            config=None): 

          The example is as follows:

              app_blb_client.describe_app_tcp_listener(blb_id="lb-f27a5689") 

          Query Application blb UdpListener Instance

          Description: 
          • Query information about all UDP listeners under the specified LoadBalancer
          • Support matching query by listener port
          • The result supports marker paging. The default paging size is 1,000, and can be specified by the maxKeys parameter

          You can query the application blb udpListener instance using the following code:

              @required(blb_id=(bytes, str)) 
              def describe_app_udp_listener(self, blb_id, listener_port=None, 
                                            marker=None, max_keys=None, 
                                            config=None): 

          The example is as follows:

              app_blb_client.describe_app_udp_listener(blb_id="lb-f27a5689") 

          Query Application blb HttpListener Instance

          Description: 
          • Query information about all SSL listeners under the specified LoadBalancer
          • Support matching query by listener port
          • The result supports marker paging. The default paging size is 1,000, and can be specified by the maxKeys parameter

          You can query the application blb sslListener instance using the following code:

              @required(blb_id=(bytes, str)) 
              def describe_app_ssl_listener(self, blb_id, listener_port=None, 
                                        marker=None, max_keys=None, config=None): 

          The example is as follows:

              app_blb_client.describe_app_ssl_listener(blb_id="lb-f27a5689") 

          Delete Application blb Listener Instance

          Description:

          • Releases the listener under the specified LoadBalancer. The listener is specified by the listening port.
          • Support batch release

          You can delete the application blb listener instance using the following code:

              @required(blb_id=(bytes, str), 
                        portList=list) 
              def delete_app_listeners(self, blb_id, portList, 
                                       client_token=None, 
                                       config=None): 

          The example is as follows:

              app_blb_client.delete_app_listeners(blb_id="lb-f27a5689", portList=[80]) 

          Create Application blb Policy

          Description:

          • Create a policy under the specified application BLB listener port

          You can create an application blb strategy using the following code:

              @required(blb_id=(bytes, str), 
                        listener_port=int, 
                        app_policy_vos=list) 
              def create_policys(self, blb_id, listener_port, 
                                 app_policy_vos, client_token=None, 
                                 config=None): 

          The example is as follows:

              appPolicyVos = [ 
                  { 
                      "appServerGroupId": "sg-bfd2e3c8", 
                      "backendPort": 80, 
                      "priority": 1, 
                      "ruleList": [ 
                          { 
                              "key": "host", 
                              "value": "baidu.com" 
                          } 
                      ] 
                  } 
              ] 
              app_blb_client.create_policys(blb_id="lb-f27a5689", listener_port=80, app_policy_vos=appPolicyVos) 

          Query Application blb Policy

          Description:

          • Query information about all policies under the corresponding port of LoadBalancer
          • Support matching query by listener port
          • The result supports marker paging. The default paging size is 1,000, and can be specified by the maxKeys parameter

          You can query the application blb policy using the following code:

              @required(blb_id=(bytes, str), 
                        listener_port=int) 
              def describe_policys(self, blb_id, listener_port, 
                                   marker=None, max_keys=None, 
                                   config=None): 

          The example is as follows:

              app_blb_client.describe_policys(blb_id="lb-f27a5689", listener_port=80) 

          Delete Application blb Policy

          Description:

          • Delete policies under corresponding BLB ports in batch

          You can delete an application blb strategy using the following code:

              @required(blb_id=(bytes, str), 
                        listener_port=int, 
                        policys_list=list) 
              def delete_policys(self, blb_id, listener_port, 
                                   policys_list,
                                   client_token=None, config=None): 

          The example is as follows:

              app_blb_client.delete_policys(blb_id="lb-f27a5689", listener_port=80, policys_list=["policy-d46a1b0f"]) 

          Create Application blb Server Group

          Description:

          • Under the specified application BLB, create a server group to bind the backend server and open the corresponding port for the listener

          You can create an application blb server group using the following code:

              @required(blb_id=(bytes, str)) 
              def create_app_server_group(self, blb_id, 
                                          name=None, 
                                          desc=None, 
                                          backend_server_list=None, 
                                          client_token=None, 
                                          config=None): 

          The example is as follows:

              app_blb_client.create_app_server_group(blb_id="lb-f27a5689", name="blb_sg_bj") 

          Update Application blb Server Group

          Description:

          • Update the TCP listener parameters under the specified LoadBalancer. All the domains specified in the request parameters will be updated. The unspecified domains remain unchanged, and the listener is specified by the port.

          You can update the application blb server group using the following code:

              @required(blb_id=(bytes, str), 
                        sg_id=(bytes, str)) 
              def update_app_server_group(self, blb_id, sg_id, 
                                          name=None, 
                                          desc=None, 
                                          client_token=None, 
                                          config=None): 

          The example is as follows:

              app_blb_client.update_app_server_group(blb_id="lb-f27a5689", sg_id="sg-60fd478d", name="blb_sg_bd") 

          Query Application blb Server Group

          Description:

          • Query information about all server groups under the specified LoadBalancer
          • The result supports marker paging. The default paging size is 1,000, and can be specified by the maxKeys parameter

          You can query the application blb server group using the following code:

              @required(blb_id=(bytes, str)) 
              def describe_app_server_group(self, blb_id, 
                                            name=None, 
                                            exactly_match=None, 
                                            marker=None, 
                                            max_keys=None, config=None): 

          The example is as follows:

              app_blb_client.describe_app_server_group(blb_id="lb-f27a5689") 

          Delete Application blb Server Group

          Description:

          • Delete server group specified by server group id

          You can delete an application blb server group using the following code:

              @required(blb_id=(bytes, str), 
                        sg_id=(bytes, str)) 
              def delete_app_server_group(self, blb_id, sg_id, 
                                          client_token=None, 
                                          config=None): 

          The example is as follows:

              app_blb_client.delete_app_server_group(blb_id="lb-f27a5689", sg_id="sg-60fd478d") 

          Create Application blb Server Group Port

          Description:

          • Under the specified application BLB, create a server group backend port to distribute all traffic sent to the port to the servers in the corresponding server list bound by weight

          You can create an application blb server group port using the following code:

              @required(blb_id=(bytes, str), 
                        sg_id=(bytes, str), port=int, 
                        protocol_type=(bytes, str)) 
              def create_app_server_group_port(self, blb_id, sg_id, 
                                               port, protocol_type, 
                                               health_check=None, 
                                               health_check_port=None, 
                                               health_check_urlpath=None, 
                                               health_check_timeout_insecond=None, 
                                               health_check_interval_insecond=None, 
                                               health_check_down_retry=None, 
                                               health_check_up_retry=None, 
                                               health_check_normal_status=None, 
                                               client_token=None, 
                                               config=None): 

          The example is as follows:

              app_blb_client.create_app_server_group_port(blb_id="lb-f27a5689", sg_id="sg-f3c86bc3", port=81, protocol_type="HTTP", health_check="HTTP") 

          Update Application blb Server Group Port

          Description:

          • Update the server group port based on the id.

          You can update an application blb server group port using the following code:

              @required(blb_id=(bytes, str), 
                        sg_id=(bytes, str), 
                        port_id=(bytes, str)) 
              def update_app_server_group_port(self, blb_id, sg_id, port_id, 
                                               health_check=None, 
                                               health_check_port=None, 
                                               health_check_urlpath=None, 
                                               health_check_timeout_insecond=None, 
                                               health_check_interval_insecond=None, 
                                               health_check_down_retry=None, 
                                               health_check_up_retry=None, 
                                               health_check_normal_status=None, 
                                               client_token=None, 
                                               config=None): 

          The example is as follows:

              app_blb_client.update_app_server_group_port(blb_id="lb-f27a5689", sg_id="sg-f3c86bc3", port_id="port-13afeaae", health_check="HTTP", health_check_port=82) 

          Delete Application blb Server Group Port

          Description:

          • Delete server group port specified by server group id

          You can delete an application blb server group port using the following code:

              @required(blb_id=(bytes, str), 
                        sg_id=(bytes, str), 
                        port_list=list) 
              def delete_app_server_group_port(self, blb_id, sg_id, 
                                               port_list,
                                               client_token=None, config=None): 

          The example is as follows:

              app_blb_client.delete_app_server_group_port(blb_id="lb-f27a5689", sg_id="sg-f3c86bc3", port_list=["port-460bb64f"]) 

          Add Application blb Backend Server

          Description:

          • Bind backend server RS under specified application BLB and server group

          You can add an application blb backend server using the following code:

              @required(blb_id=(bytes, str), 
                        sg_id=(bytes, str), 
                        backend_server_list=list) 
              def create_app_blb_rs(self, blb_id, sg_id, 
                                    backend_server_list,
                                    client_token=None, 
                                    config=None): 

          The example is as follows:

              backendServerList = [ 
                  { 
                      "instanceId": "i-jVRZWSXN", 
                      "weight": 100 
                  } 
              ] 
              app_blb_client.create_app_blb_rs(blb_id="lb-5fdcc990", sg_id="sg-44c611b9", backend_server_list=backendServerList) 

          Update Application blb Backend Server

          Description:

          • Update RS information under the specified server group

          You can update the application blb backend server using the following code:

              @required(blb_id=(bytes, str), 
                        sg_id=(bytes, str), 
                        backend_server_list=list) 
              def update_app_blb_rs(self, blb_id, sg_id, 
                                    backend_server_list,
                                    client_token=None, 
                                    config=None): 

          The example is as follows:

              backendServerList = [ 
                  { 
                      "instanceId": "i-jVRZWSXN", 
                      "weight": 60 
                  } 
              ] 
              app_blb_client.update_app_blb_rs(blb_id="lb-5fdcc990", sg_id="sg-44c611b9", backend_server_list=backendServerList) 

          Query the Backend Server Mounted by the Application blb

          Description:

          • Query the server bound to the server group

          You can query the backend server mounted by the application blb using the following code:

              @required(blb_id=(bytes, str), 
                        sg_id=(bytes, str)) 
              def describe_rs_mount(self, blb_id, sg_id, config=None): 

          The example is as follows:

              app_blb_client.describe_rs_mount(blb_id="lb-5fdcc990", sg_id="sg-44c611b9") 

          Query the Backend Server Not Mounted by the Application blb

          Description:

          • Query the RS unbound to the server group

          You can query the backend server nont mounted by the application blb using the following code:

              @required(blb_id=(bytes, str), 
                        sg_id=(bytes, str)) 
              def describe_rs_unmount(self, blb_id, sg_id, config=None): 

          The example is as follows:

              app_blb_client.describe_rs_unmount(blb_id="lb-5fdcc990", sg_id="sg-44c611b9") 

          Delete Backend Server of Application blb

          Description:

          • Delete server under server group specified by server group id

          You can delete an backend server of the application blb using the following code:

              @required(blb_id=(bytes, str), 
                        sg_id=(bytes, str), 
                        backend_server_list=list) 
              def delete_app_blb_rs(self, blb_id, sg_id, 
                                    backend_server_list,
                                    client_token=None, 
                                    config=None): 

          The example is as follows:

              app_blb_client.delete_app_blb_rs(blb_id="lb-5fdcc990", sg_id="sg-44c611b9", backend_server_list=["i-jVRZWSXN"]) 
          Previous
          Common BLB Instance
          Next
          Version Update Description