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.

RegionId String Yes cn-hangzhou

The ID of the region where the VPC is deployed.

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

VpcId String No vpc-bp1b1xjllp3ve5yze****

The ID of the VPC.

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

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): queries all VPCs in the specified region.
  • false: does not query the default VPC.
DryRun Boolean No false

Specifies whether to precheck this request. Valid values:

  • true: prechecks the API request. Resources are not queried. The system checks whether your AccessKey pair is valid, whether the RAM user is authorized, and whether required parameters are set. If the request fails the precheck, the corresponding error code is returned. If the request passes the precheck, the DryRunOperation error code is returned.
  • false: sends the request. This is the default value. If the request passes the precheck, a 2XX HTTP status code is returned and the resource is queried.
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 12345678

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

DhcpOptionsSetId String No dopt-o6w0df4epg9zo8isy****

The ID of the DHCP options set.

Response parameters

Parameter Type Example Description
Vpcs Array of Vpc

The detailed information about the VPC.

Vpc
CenStatus String Attached

The state 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.

CidrBlock String 192.168.0.0/16

The IPv4 CIDR block of the VPC.

CreationTime String 2018-04-18T15:02:37Z

The time when the VPC was created.

Description String This is my VPC.

The description of the VPC.

DhcpOptionsSetId String dopt-o6w0df4epg9zo8isy****

The ID of the DHCP options set.

DhcpOptionsSetStatus String Available

The state of the DHCP options set. Valid values:

  • Available: The DHCP options set is available for use.
  • InUse: The DHCP options set is being used.
  • Deleted:The DHCP options set is deleted.
  • Pending: The DHCP options set is being configured.
Ipv6CidrBlock String 2408:XXXX:0:a600::/56

The IPv6 CIDR block of the VPC.

Ipv6CidrBlocks Array of Ipv6CidrBlock

The IPv6 CIDR block of the VPC.

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

The IPv6 CIDR block of the VPC.

Ipv6Isp String BGP

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

  • BGP(default): Alibaba Cloud BGP IPv6
  • ChinaMobile: China Mobile (single line)
  • ChinaUnicom: China Unicom (single line)
  • ChinaTelecom: China Telecom (single line)
Note If your Alibaba Cloud account is allowed to activate single-ISP bandwidth, you can set the parameter to ChinaTelecom, ChinaUnicom, and ChinaMobile.
IsDefault Boolean false

Indicates whether the VPC is the default one in the region.

  • true: yes
  • false: no
NatGatewayIds List nat-245xxxftwt45bg****

The ID of the NAT gateway.

OwnerId Long 1234567

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

RegionId String cn-hangzhou

The ID of the region where the VPC is deployed.

ResourceGroupId String rg-acfmxazb4ph****

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

RouterTableIds List vtb-bp1krxxzp0c29fmon****

The ID of the route table.

SecondaryCidrBlocks List 192.168.20.0/24

The secondary IPv4 CIDR block of the VPC.

Status String Available

The status of the VPC. Valid values:

  • Pending: being configured
  • Available: available
Tags Array of Tag

The tag information about the VPC.

Tag
Key String env

The keys of the tags that are added to the VPC.

Value String internal

The values of the tags that are added to the VPC.

UserCidrs List 10.0.0.0/8

The list of customer-side CIDR blocks.

VRouterId String vrt-bp1jcg5cmxjbl9xgc****

The ID of the vRouter.

VSwitchIds List vsw-bp1nhbnpv2blyz8dl****

The list of vSwitches in the VPC.

VpcId String vpc-bp1qpo0kug3a20qqe****

The ID of the VPC.

VpcName String vpc1

The name of the VPC.

TotalCount Integer 2

The total number of entries returned.

PageNumber Integer 1

The page number of the returned page.

PageSize Integer 10

The number of entries returned per page.

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

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=DescribeVpcs
&RegionId=cn-hangzhou
&<Common request parameters>

Sample success responses

XML format

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

JSON format

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

Error codes

HttpCode Error code Error message Description
500 InternalError The request processing has failed due to some unknown error. The error message returned because unknown errors have occurred.
400 InvalidResourceGroupId The specified ResourceGroupId does not exist. The error message returned because the specified resource group ID is invalid.

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