Associates a Server Load Balancer (SLB) instance with an application.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request headers

This operation uses only common request headers. For more information, see Common request parameters and common response parameters.

Request syntax

POST /pop/v1/sam/app/slb HTTP/1.1

Request parameters

Parameter Type Position Required Example Description
AppId String Query Yes 0099b7be-5f5b-4512-a7fc-56049ef1****

The ID of the application that you want to associate with the SLB instance.

Internet String Query No [{"port":80,"targetPort":8080,"protocol":"TCP"}]

Specifies the Internet-facing SLB instance. For example, when this parameter is set to [{"port":80,"targetPort":8080,"protocol":"TCP"}], the container port 8080 is exposed through port 80 of the SLB instance over Transmission Control Protocol (TCP). Parameter description:

  • port: the port of the SLB instance.
  • targetPort: the container port.
  • protocol: the network protocol. Valid values: TCP, HTTP, and HTTPS.
  • httpsCertId: the Secure Sockets Layer (SSL) certificate. You need to specify this field only when you set the protocol to HTTPS.
Intranet String Query No [{"port":80,"targetPort":8080,"protocol":"TCP"}]

Specifies the Internal-facing SLB instance. For example, when this parameter is set to [{"port":80,"targetPort":8080,"protocol":"TCP"}], the container port 8080 is exposed through port 80 of the SLB instance over TCP. Parameter description:

  • port: the port of the SLB instance.
  • targetPort: the container port.
  • protocol: the network protocol. Valid values: TCP, HTTP, and HTTPS.
  • httpsCertId: the SSL certificate. You need to specify this field only when you set the protocol to HTTPS.
InternetSlbId String Query No lb-bp1tg0k6d9nqaw7l1****

Specifies the ID of the purchased Internet-facing SLB instance. Shared-resource SLB instances are not supported.

IntranetSlbId String Query No lb-bp1tg0k6d9nqaw7l1****

Specifies the ID of the purchased Internal-facing SLB instance. Shared-resource SLB instances are not supported.

Response parameters

Parameter Type Example Description
RequestId String 91F93257-7A4A-4BD3-9A7E-2F6EAE6D****

The ID of the request.

Message String success

The returned message.

TraceId String 0a98a02315955564772843261e****

The ID of the trace. It can be used to query the details of a request.

Data Object

The returned data.

ChangeOrderId String 01db03d3-3ee9-48b3-b3d0-dfce2d88****

The ID of the change order. It can be used to query the task status.

ErrorCode String This parameter is left empty.

The error code.

  • The ErrorCode parameter is not returned when the request succeeds.
  • The ErrorCode parameter is returned when the request fails. For more information, see Error codes in this topic.
Code String 200

The HTTP status code. Valid values:

  • 2xx: indicates that the request was successful.
  • 3xx: indicates that the request was redirected.
  • 4xx: indicates that the request was invalid.
  • 5xx: indicates that a server error occurred.
Success Boolean true

Indicates whether the SLB instance was successfully associated with the application. Valid values:

  • true: The SLB instance was successfully associated with the application.
  • false: The SLB instance could not be associated with the application.

Examples

Sample requests

POST /pop/v1/sam/app/slb?AppId=0099b7be-5f5b-4512-a7fc-56049ef1****&Internet=[{"port":80,"targetPort":8080,"protocol":"TCP"}]&Intranet=[{"port":80,"targetPort":8080,"protocol":"TCP"}]&InternetSlbId=lb-bp1tg0k6d9nqaw7l1****&IntranetSlbId=lb-bp1tg0k6d9nqaw7l1**** HTTP/1.1
Host:sae.aliyuncs.com
Content-Type:application/json

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<BindSlbResponse>
    <RequestId>91F93257-7A4A-4BD3-9A7E-2F6EAE6D****</RequestId>
    <Message>success</Message>
    <TraceId>0a98a02315955564772843261e****</TraceId>
    <Data>
        <ChangeOrderId>01db03d3-3ee9-48b3-b3d0-dfce2d88****</ChangeOrderId>
    </Data>
    <Code>200</Code>
    <Success>true</Success>
</BindSlbResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "91F93257-7A4A-4BD3-9A7E-2F6EAE6D****",
  "Message" : "success",
  "TraceId" : "0a98a02315955564772843261e****",
  "Data" : {
    "ChangeOrderId" : "01db03d3-3ee9-48b3-b3d0-dfce2d88****"
  },
  "Code" : "200",
  "Success" : true
}

Error codes

HttpCode Error code Error message Description
400 Slb.NotFound The SLB instance does not exist: slbId [%s] The error message returned because the SLB instance is not found: slbId[%s].
400 InvalidApplication.NotFound The current application does not exist. The error message returned because the specified application is not found.
400 InvalidParameter.NotEmpty You must specify the parameter %s. The error message returned because the value of the %s parameter is invalid. This parameter cannot be left empty.
400 InvalidParameter.Obviously The specified parameter is invalid {%s}. The error message returned because the value of the %s parameter is invalid.
400 SlbHttpsCert.NotConsistent The HTTPS listening certificate for each listener must match. The error message returned because the certificates for HTTPS listeners on the SLB instance are inconsistent.
400 SlbHttpsCert.NotFound You must configure the certificate before you configure HTTPS listening for the SLB instance. The error message returned because no certificates are available for using HTTPS listeners on the SLB instance.
400 SlbListenerPort.NotAvailable The SLB listening port is unavailable: slbId [%s], port [%s] The error message returned because the port specified for the SLB listener is occupied: slbId[%s], port[%s].
400 SlbListenerType.Invalid An SLB listener type error occurred. Only HTTPS and TCP are supported. The error message returned because the protocol specified for the SLB listener is invalid. Only HTTPS and TCP are supported.
400 SlbSpec.NotSupport Shared performance SLB instances are not supported. The error message returned because shared-resource SLB instances are not supported.
400 SlbType.Invalid An SLB network type error occurred. The error message returned because the network type of the SLB instance is invalid.
400 SSLCert.NotFound The specified SSL certificate cannot be found. The error message returned because the specified SSL certificate is not found.
400 System.Upgrading The system is being upgraded. Please try again later. The error message returned because the system is being upgraded. Try again later.
400 Application.ChangerOrderRunning An application change process is in progress. Please try again later. The error message returned because an application change is in progress. Try again later.
400 Application.InvalidStatus The application status is abnormal. Please try again later. The error message returned because the application status is abnormal. Try again later.
400 Application.NotDeployYet The application has not been deployed. Please deploy it and try again. The error message returned because the application is not deployed. Deploy the application and try again.
400 InvalidParam.ProtocolNotSupport Only TCP protocol is supported. The error message returned because the specified protocol is not supported. Only TCP is supported.
400 SLBInstanceQuota.OverQuota The total number of SLB instances exceeds the quota. Please reduce the instances and try again. The error message returned because the number of SLB instances exceeds the limit. Remove SLB instances that you no longer need and try again.
400 Slb.Tag.Not.Qualified The current SLB instance cannot be reused because it may have been occupied by %s. The error message returned because the SLB instance is being used by %s. We recommend that you choose another instance.
400 Application.NoInstanceAvailable No instance is available for the application. Please scale out and try again. The error message returned because no instances are available for the application. Scale out the application and try again.
400 SlbAppVSwitch.NotMatch The SLB instance does not match the vSwitch of the current application. The error message returned because the SLB instance does not match the vSwitch of the application.
404 InvalidAppId.NotFound The specified AppId does not exist. The error message returned because the specified application ID does not exist.

For a list of error codes, visit the API Error Center.