You can call this operation to query one or more classic network-type instances that are connected with VPCs.

Description

When you call this operation, take note of the following items:

  • This operation applies only to instances in the classic network.
  • You can query a maximum of 100 classic network-type instances at a time.
  • At least one of VpcId and InstanceId must be specified.

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 parameters

Parameter Type Required Example Description
Action String Yes DescribeClassicLinkInstances

The operation that you want to perform. Set the value to DescribeClassicLinkInstances.

RegionId String Yes cn-hangzhou

The region ID of the instance. You can call the DescribeRegions operation to query the most recent region list.

VpcId String No vpc-bp1vwnn14rqpyiczj****

The ID of the VPC. The ClassicLink feature must be enabled for the specified VPC. For more information, see Establish a ClassicLink connection.

InstanceId String No i-bp1a5zr3u7nq9cxh****

The ID of the instance. You can specify a maximum of 100 instance IDs in a single request. Separate multiple IDs with commas (,).

PageNumber String No 1

The number of the page to return. Pages start from page 1.

Default value: 1

PageSize String No 10

The number of entries to return on each page. Valid values: 1 to 100.

Default value: 10

Response parameters

Parameter Type Example Description
Links Array of Link

The details about the ClassicLink connections between the classic network-type instances and the VPC.

Link
InstanceId String i-test

The ID of the instance.

VpcId String vpc-test

The ID of the VPC.

PageNumber Integer 1

The page number of the returned page.

PageSize Integer 10

The number of entries returned per page.

RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

TotalCount Integer 2

The total number of connections.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=DescribeClassicLinkInstances
&RegionId=cn-hangzhou
&VpcId=vpc-bp1vwnn14rqpyiczj****
&InstanceId=i-bp1a5zr3u7nq9cxh****
&<Common request parameters>

Sample success responses

XML format

<DescribeClassicLinkInstancesResponse> 
      <PageNumber>1</PageNumber>
      <Links>
            <Link>
                  <InstanceId>i-bp1a5zr3u7nq9cxh****</InstanceId>
                  <VpcId>vpc-bp1vwnn14rqpyiczj****</VpcId>
            </Link>
            <Link>
                  <InstanceId>i-bp1a5zr3u7nq9abc****</InstanceId>
                  <VpcId>vpc-bp1vwnn14rqpyiczj****</VpcId>
            </Link>
      </Links>
      <TotalCount>2</TotalCount>
      <PageSize>10</PageSize>
      <RequestId>B154D309-F3E1-4AB7-BA94-FEFCA8B89001</RequestId>
</DescribeClassicLinkInstancesResponse>

JSON format

{
    "PageNumber":1,
    "Links":{
        "Link":[{
            "InstanceId":"i-bp1a5zr3u7nq9cxh****",
            "VpcId":"vpc-bp1vwnn14rqpyiczj****"
            },
           {
           "InstanceId": "i-bp1a5zr3u7nq9abc****",
           "VpcId": "vpc-bp1vwnn14rqpyiczj****"
           }]
    },
    "TotalCount":2,
    "PageSize":10,
    "RequestId":"B154D309-F3E1-4AB7-BA94-FEFCA8B89001"
}

Error codes

HTTP status code Error code Error message Description
403 InvalidInstanceId.NotFound The InstanceId provided does not exist in our records. The error message returned because the specified instance does not exist. Check whether the instance ID is correct.
403 InvalidParameter.ToManyInstanceIds No more than 100 InstanceIds can be specified. The error message returned because the maximum number of instance IDs that can be specified has been reached.
403 InvalidParameter.InvalidInstanceIdAndVpcId The parameter InstanceId and VpcId are not allowed to be empty at the same time. The error message returned because the InstanceId and VpcId parameters cannot be empty at the same time.
403 InvalidInstanceId.NotBelong The specified instance is not belong to you. The error message returned because the specified instance does not exist in your account.
403 InvalidVpc.NotBelong The specified vpc is not belong to you. The error message returned because the specified VPC does not exist in your account.

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