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 points:

  • You can query only instances in the classic network by calling this operation.
  • You can query a maximum of 100 classic network-type instances each time.
  • VpcId and InstanceId cannot be empty at the same time.

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
RegionId String Yes cn-hangzhou

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

Action String No DescribeClassicLinkInstances

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

InstanceId String No i-test

The ID of the instance. You can specify a maximum of 100 instance IDs. 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.

VpcId String No vpc-test

The ID of the VPC. The ClassicLink service must be enabled for the specified VPC. For more information, see Enable ClassicLink.

Response parameters

Parameter Type Example Description
Links

The links between the classic network-type instance and the VPC.

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 links.

Examples

Sample requests

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

Sample success responses

XML format

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

JSON format

{
	"PageNumber":1,
	"TotalCount":2,
	"Links":{
		"Link":[
			{
				"InstanceId":"i-test",
				"VpcId":"vpc-test"
			},
			{
				"InstanceId":"i-test1",
				"VpcId":"vpc-test"
			}
		]
	},
	"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 InstanceId parameter does not exist. Check whether the instance ID is correct.
403 InvalidParameter.ToManyInstanceIds No more than 100 DedicatedHostIds can be specified. The error message returned because you can specify a maximum of 100 instance IDs.
403 InvalidParameter.InvalidInstanceIdAndVpcId The parameter InstanceId and VpcId are not allowed to be empty at the same time. The error message returned because InstanceId and VpcId 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 under your account.
403 InvalidVpc.NotBelong The specified vpc is not belong to you. The error message returned because the specified VPC does not exist under your account.

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