Queries one or more VPCs in a region.

Make the API call

You can use OpenAPI Explorer to make API calls, search for API calls, perform debugging, and generate SDK example code.

Request parameters

Parameter Type Required? Example value Description
Action String Yes DescribeVpcs

The name of this action. Value: DescribeVpcs

RegionId String Yes cn-hangzhou

The ID of the region to which the VPC belongs.

To query the region ID, call DescribeRegions.

VpcId String No vpc-bp1b1xjllp3ve5yze****

The ID of the VPC.

A maximum of 20 VPC IDs can be specified. Separate multiple VPC IDs with commas (,).

VpcName String No Vpc-1

The name of the VPC.

IsDefault Boolean No false

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

  • true (default): All VPCs in the specified region are queried.
  • false: The default VPC is not queried.
DryRun Boolean No false

Indicates whether to check this request only. Valid values:

  • true: Send a check request without querying the resource status. The system checks whether the AccessKey is valid, whether the RAM user is authorized, and whether the required parameters are set. If the check fails, a corresponding error is returned. If the check succeeds, the error DryRunOperation is returned.
  • false (default): Send a normal request, return the 2XX HTTP status code after the check, and query the resource status directly.
ResourceGroupId String No rg-acfmxvfvazb4p****

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

PageNumber Integer No 1

The page number. Default value: 1.

PageSize Integer No 10

The number of entries per page in the case of a paged query result. Maximum value: 50. Default value: 10

Response parameters

Parameter Type Example value Description
RequestId String C6532AA8-D0F7-497F-A8EE-094126D441F5

The ID of the request.

TotalCount Integer 2

The number of total entries.

PageNumber Integer 1

The current page number.

PageSize Integer 10

The number of entries per page.

Vpcs Array

Details of the VPCs.

VpcId String vpc-bp1qpo0kug3a20qqe****

The ID of the VPC.

RegionId String cn-hangzhou

The ID of the region to which the VPC belongs.

Status String Available

The status of the VPC. Valid values:

  • Pending: The VPC is being configured.
  • Available: The VPC is available.
VpcName String vpc1

The name of the VPC.

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

The time at which the VPC was created.

CidrBlock String 10.0.0.0/24

The IPv4 CIDR block of the VPC.

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

The IPv6 CIDR block of the VPC.

VRouterId String vrt-bp1jcg5cmxjbl9xgc****

The ID of the VRouter.

Description String This is my VPC.

The description of the VPC.

IsDefault Boolean false

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

  • true: The VPC is the default VPC in the specified region.
  • false: The VPC is not the default VPC in the specified region.
ResourceGroupId String rg-acfmxazb4ph****

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

CenStatus String Detached

Indicates whether the VPC is attached to any Cloud Enterprise Network (CEN) instance.

  • Detached: The VPC is not attached to any CEN instance.
  • Available: The VPC is attached to one or more CEN instances.
Tags Array

Details of the VPC tags.

Key String env

The tag key bound to the VPC.

Value String internal

The tag value bound to the VPC.

VSwitchIds List vsw-bp1nhbnpv2blyz8dl****

A list of VSwitches in the VPC.

UserCidrs List 10.0.0.0/8

A list of user CIDRs.

NatGatewayIds List nat-245xxxftwt45bg****

A list of IDs of NAT Gateways.

RouterTableIds List vtb-bp1krxxzp0c29fmon****

A list of IDs of route tables.

SecondaryCidrBlocks List 192.168.20.0/24

A list of secondary IPv4 CIDR blocks of the VPC.

Examples

Request example

https://vpc.aliyuncs.com/?Action=DescribeVpcs
&RegionId=cn-hangzhou
&<CommonParameters>

Response example

XML format

<DescribeVpcsResponse>
  <PageNumber>1</PageNumber>
  <Vpcs>
		    <Vpc>
			      <VpcName>abc</VpcName>
			      <Description>abc</Description>
			      <IsDefault>false</IsDefault>
			      <ResourceGroupId>rg-acfmxazb4ph****</ResourceGroupId>
			      <UserCidrs></UserCidrs>
			      <NatGatewayIds></NatGatewayIds>
			      <RouterTableIds>
				        <RouterTableIds>vtb-bp1krxxzp0c29fmon****</RouterTableIds>
			      </RouterTableIds>
			      <VpcId>vpc-bp1qpo0kug3a20qqe****</VpcId>
			      <VRouterId>vrt-bp1jcg5cmxjbl9xgc****</VRouterId>
			      <CreationTime>2018-12-06T06:11:55Z</CreationTime>
			      <Status>Available</Status>
			      <CidrBlock>172.16.0.0/12</CidrBlock>
			      <VSwitchIds></VSwitchIds>
			      <RegionId>cn-hangzhou</RegionId>
			      <Ipv6CidrBlock></Ipv6CidrBlock>
		    </Vpc>
		    <Vpc>
			      <VpcName>kttest</VpcName>
			      <Description></Description>
			      <IsDefault>false</IsDefault>
			      <ResourceGroupId>rg-acfmxazb4ph****</ResourceGroupId>
			      <UserCidrs></UserCidrs>
			      <NatGatewayIds></NatGatewayIds>
			      <RouterTableIds>
				        <RouterTableIds>vtb-bp1blq1oh0ybfnpm1****</RouterTableIds>
			      </RouterTableIds>
			      <VpcId>vpc-bp1aevy8sofi8mh1q****</VpcId>
			      <VRouterId>vrt-bp149ve7yeyvio4nc****</VRouterId>
			      <CreationTime>2018-11-08T08:54:03Z</CreationTime>
			      <Status>Available</Status>
			      <CidrBlock>192.168.0.0/16</CidrBlock>
			      <VSwitchIds>
				        <VSwitchId>vsw-bp12mw1f8k3jgygk****</VSwitchId>
			      </VSwitchIds>
			      <RegionId>cn-hangzhou</RegionId>
			      <Ipv6CidrBlock></Ipv6CidrBlock>
		    </Vpc>
	  </Vpcs>
	
  <TotalCount>2</TotalCount>
  <PageSize>10</PageSize>
  <RequestId>C6532AA8-D0F7-497F-A8EE-094126D441F5</RequestId>
</DescribeVpcsResponse>

JSON format

{
    "PageNumber": 1,
    "Vpcs": {
        "Vpc": [
            {
                "VpcName": "abc",
                "Description": "abc",
                "IsDefault": false,
                "ResourceGroupId": "rg-acfmxazb4ph****",
                "UserCidrs": {
                    "UserCidr": []
                },
                "NatGatewayIds": {
                    "NatGatewayIds": []
                },
                "RouterTableIds": {
                    "RouterTableIds": [
                        "vtb-bp1krxxzp0c29fmon****"
                    ]
                },
                "VpcId": "vpc-bp1qpo0kug3a20qqe****",
                "VRouterId": "vrt-bp1jcg5cmxjbl9xgc****",
                "CreationTime": "2018-12-06T06:11:55Z",
                "Status": "Available",
                "CidrBlock": "172.16.0.0/12",
                "VSwitchIds": {
                    "VSwitchId": []
                },
                "RegionId": "cn-hangzhou",
                "Ipv6CidrBlock": ""
            },
            {
                "VpcName": "kttest",
                "Description": "",
                "IsDefault": false,
                "ResourceGroupId": "rg-acfmxazb4ph****",
                "UserCidrs": {
                    "UserCidr": []
                },
                "NatGatewayIds": {
                    "NatGatewayIds": []
                },
                "RouterTableIds": {
                    "RouterTableIds": [
                        "vtb-bp1blq1oh0ybfnpm1****"
                    ]
                },
                "VpcId": "vpc-bp1aevy8sofi8mh1q****",
                "VRouterId": "vrt-bp149ve7yeyvio4nc****",
                "CreationTime": "2018-11-08T08:54:03Z",
                "Status": "Available",
                "CidrBlock": "192.168.0.0/16",
                "VSwitchIds": {
                    "VSwitchId": [
                        "vsw-bp12mw1f8k3jgygk9****"
                    ]
                },
                "RegionId": "cn-hangzhou",
                "Ipv6CidrBlock": ""
            }
        ]
    },
    "TotalCount": 2,
    "PageSize": 10,
    "RequestId": "C6532AA8-D0F7-497F-A8EE-094126D441F5"
}

Errors

HTTP status code Error code Error message Description
500 InternalError The request processing has failed due to some unknown error. The request failed to be processed due to unknown errors.

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