All Products
Search
Document Center

:DescribeVpcs

Last Updated:Aug 23, 2023

Queries virtual private clouds (VPCs) in a region.

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 DescribeVpcs

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

VpcId String No vpc-bp1b1xjllp3ve5yze****

The ID of the VPC.

You can specify up to 20 VPC IDs. Separate multiple IDs with commas (,).

RegionId String Yes cn-hangzhou

The region ID of the VPC.

You can call the DescribeRegions operation to query the most recent region list.

VpcName String No Vpc-1

The name of the VPC.

IsDefault Boolean No false

Specifies whether to query the default VPC in the specified region. Valid values:

  • true (default)
  • false
DryRun Boolean No false

Specifies whether to perform only a dry run, without performing the actual request. Valid values:

  • true: performs only a dry run. The system checks the request for potential issues, including missing parameter values, incorrect request syntax, and service limits. If the request fails the dry run, an error message is returned. If the request passes the dry run, the DryRunOperation error code is returned.
  • false (default): performs a dry run and performs the actual request. If the request passes the dry run, a 2xx HTTP status code is returned and the operation is performed.
ResourceGroupId String No rg-acfmxvfvazb4p****

The ID of the resource group to which the VPC to be queried belongs.

PageNumber Integer No 1

The number of the page to return. Default value: 1.

PageSize Integer No 10

The number of entries to return on each page. Maximum value: 50. Default value: 10.

VpcOwnerId Long No 253460731706911258

The ID of the Alibaba Cloud account to which the VPC belongs.

DhcpOptionsSetId String No dopt-o6w0df4epg9zo8isy****

The ID of the DHCP options set.

Tag.N.Key String No FinanceDept

The key of tag N to add to the resource. You can specify at most 20 tag keys. The tag key cannot be an empty string.

The tag key can be up to 128 characters in length. It cannot start with aliyun or acs:, and cannot contain http:// or https://.

Tag.N.Value String No FinanceJoshua

The value of tag N to add to the resource. You can specify at most 20 tag values. The tag value can be an empty string.

The tag value can be up to 128 characters in length, and cannot contain http:// or https://. The tag value cannot start with aliyun or acs:.

Response parameters

Parameter Type Example Description
PageSize Integer 10

The number of entries per page.

RequestId String C6532AA8-D0F7-497F-A8EE-094126D441F5

The request ID.

PageNumber Integer 1

The number of the returned page.

TotalCount Integer 2

The total number of entries returned.

Vpcs Array of Vpc

The details of the VPCs.

Vpc
CreationTime String 2021-04-18T15:02:37Z

The time when the VPC was created.

Status String Available

The status of the VPC. Valid values:

  • Pending
  • Available
VpcId String vpc-bp1qpo0kug3a20qqe****

The ID of the VPC.

IsDefault Boolean false

Indicates whether the VPC is the default VPC in the region. Valid values:

  • true
  • false
OwnerId Long 253460731706911258

The ID of the Alibaba Cloud account to which the VPC belongs.

RegionId String cn-hangzhou

The region ID of the VPC.

VpcName String vpc1

The name of the VPC.

VRouterId String vrt-bp1jcg5cmxjbl9xgc****

The ID of the vRouter.

DhcpOptionsSetStatus String Available

The status of the DHCP options set. Valid values: Valid values:

  • Available
  • InUse
  • Deleted
  • Pending
CidrBlock String 192.168.0.0/16

The IPv4 CIDR block of the VPC.

Description String This is my VPC.

The description of the VPC.

ResourceGroupId String rg-acfmxazb4ph****

The ID of the resource group to which the VPC belongs.

DhcpOptionsSetId String dopt-o6w0df4epg9zo8isy****

The ID of the DHCP options set.

Ipv6CidrBlock String 2408:XXXX:0:a600::/56

The IPv6 CIDR block of the VPC.

CenStatus String Attached

The status of the Cloud Enterprise Network (CEN) instance to which the VPC is attached.

Attached is returned only when the VPC is associated with a CEN instance.

Tags Array of Tag

The tag information about the VPC.

Tag
Key String env

The key of tag N.

Value String internal

The value of tag N.

Ipv6CidrBlocks Array of Ipv6CidrBlock

The IPv6 CIDR blocks of the VPC.

Ipv6CidrBlock
Ipv6Isp String BGP

The Internet service provider (ISP) for IPv6 addresses of the VPC. Valid values:

  • BGP
  • ChinaMobile
  • ChinaUnicom
  • ChinaTelecom
Note If you are allowed to use single-ISP bandwidth, valid values are ChinaTelecom, ChinaUnicom, and ChinaMobile.
Ipv6CidrBlock String 2408:XXXX:0:a600::/56

The IPv6 CIDR block of the VPC.

VSwitchIds Array of String vsw-bp1nhbnpv2blyz8dl****

The vSwitches in the VPC.

You can query up to 300 vSwitches in the VPC. The information about the latest vSwitches is returned. If you want to query the information about all vSwitches in a VPC, call the DescribeVSwitches operation.

SecondaryCidrBlocks Array of String 192.168.20.0/24

The secondary CIDR block of the VPC.

UserCidrs Array of String 10.0.0.0/8

The list of user CIDR blocks.

NatGatewayIds Array of String nat-245xxxftwt45bg****

The ID of the NAT gateway.

RouterTableIds Array of String vtb-bp1krxxzp0c29fmon****

The ID of the route table.

Examples

Sample requests

http(s)://[Endpoint]/?Action=DescribeVpcs
&VpcId=vpc-bp1b1xjllp3ve5yze****
&RegionId=cn-hangzhou
&VpcName=Vpc-1
&IsDefault=false
&DryRun=false
&ResourceGroupId=rg-acfmxvfvazb4p****
&PageNumber=1
&PageSize=10
&VpcOwnerId=253460731706911258
&DhcpOptionsSetId=dopt-o6w0df4epg9zo8isy****
&Tag=[{"Key":"FinanceDept","Value":"FinanceJoshua"}]
&Common request parameters

Sample success responses

XML format

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

<DescribeVpcsResponse>
    <PageSize>10</PageSize>
    <RequestId>C6532AA8-D0F7-497F-A8EE-094126D441F5</RequestId>
    <PageNumber>1</PageNumber>
    <TotalCount>2</TotalCount>
    <Vpcs>
        <CreationTime>2021-04-18T15:02:37Z</CreationTime>
        <Status>Available</Status>
        <VpcId>vpc-bp1qpo0kug3a20qqe****</VpcId>
        <IsDefault>false</IsDefault>
        <OwnerId>253460731706911260</OwnerId>
        <RegionId>cn-hangzhou</RegionId>
        <VpcName>vpc1</VpcName>
        <VRouterId>vrt-bp1jcg5cmxjbl9xgc****</VRouterId>
        <DhcpOptionsSetStatus>Available</DhcpOptionsSetStatus>
        <CidrBlock>192.168.0.0/16</CidrBlock>
        <Description>This is my VPC.</Description>
        <ResourceGroupId>rg-acfmxazb4ph****</ResourceGroupId>
        <DhcpOptionsSetId>dopt-o6w0df4epg9zo8isy****</DhcpOptionsSetId>
        <Ipv6CidrBlock>2408:XXXX:0:a600::/56</Ipv6CidrBlock>
        <CenStatus>Attached</CenStatus>
        <Tags>
            <Key>env</Key>
            <Value>internal</Value>
        </Tags>
        <Ipv6CidrBlocks>
            <Ipv6Isp>BGP</Ipv6Isp>
            <Ipv6CidrBlock>2408:XXXX:0:a600::/56</Ipv6CidrBlock>
        </Ipv6CidrBlocks>
        <VSwitchIds>vsw-bp1nhbnpv2blyz8dl****</VSwitchIds>
        <SecondaryCidrBlocks>192.168.20.0/24</SecondaryCidrBlocks>
        <UserCidrs>10.0.0.0/8</UserCidrs>
        <NatGatewayIds>nat-245xxxftwt45bg****</NatGatewayIds>
        <RouterTableIds>vtb-bp1krxxzp0c29fmon****</RouterTableIds>
    </Vpcs>
</DescribeVpcsResponse>

JSON format

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

{
  "PageSize" : 10,
  "RequestId" : "C6532AA8-D0F7-497F-A8EE-094126D441F5",
  "PageNumber" : 1,
  "TotalCount" : 2,
  "Vpcs" : [ {
    "CreationTime" : "2021-04-18T15:02:37Z",
    "Status" : "Available",
    "VpcId" : "vpc-bp1qpo0kug3a20qqe****",
    "IsDefault" : false,
    "OwnerId" : 253460731706911260,
    "RegionId" : "cn-hangzhou",
    "VpcName" : "vpc1",
    "VRouterId" : "vrt-bp1jcg5cmxjbl9xgc****",
    "DhcpOptionsSetStatus" : "Available",
    "CidrBlock" : "192.168.0.0/16",
    "Description" : "This is my VPC.",
    "ResourceGroupId" : "rg-acfmxazb4ph****",
    "DhcpOptionsSetId" : "dopt-o6w0df4epg9zo8isy****",
    "Ipv6CidrBlock" : "2408:XXXX:0:a600::/56",
    "CenStatus" : "Attached",
    "Tags" : [ {
      "Key" : "env",
      "Value" : "internal"
    } ],
    "Ipv6CidrBlocks" : [ {
      "Ipv6Isp" : "BGP",
      "Ipv6CidrBlock" : "2408:XXXX:0:a600::/56"
    } ],
    "VSwitchIds" : [ "vsw-bp1nhbnpv2blyz8dl****" ],
    "SecondaryCidrBlocks" : [ "192.168.20.0/24" ],
    "UserCidrs" : [ "10.0.0.0/8" ],
    "NatGatewayIds" : [ "nat-245xxxftwt45bg****" ],
    "RouterTableIds" : [ "vtb-bp1krxxzp0c29fmon****" ]
  } ]
}

Error codes

HttpCode Error code Error message Description
400 InvalidVpcIdNumber.NotSupported The number of vpcIds exceeds the limit. The number of VPC IDs exceeds the limit.
400 InvalidResourceGroupId The specified ResourceGroupId does not exist. The resource group ID does not exist.
400 InvalidTagKey The tag keys are not valid. The tag index is invalid.
400 InvalidTagValue The tag values are not valid. The tag value is invalid.
400 InvalidAccount.NotFound The account is invalid. The operation failed because an invalid account is used.
500 InternalError The request processing has failed due to some unknown error. Some unknown errors occurred.

For a list of error codes, see Service error codes.