All Products
Search
Document Center

Virtual Private Cloud:DescribeVpcs

Last Updated:Dec 02, 2023

Queries virtual private clouds (VPCs) in a specified region.

debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

debugging

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
vpc:DescribeVpcsRead
  • VPC
    acs:vpc:{#regionId}:{#accountId}:vpc/*
  • VPC
    acs:vpc:{#regionId}:{#accountId}:vpc/{#VPCId}
  • vpc:tag
none

Request parameters

ParameterTypeRequiredDescriptionExample
VpcIdstringNo

The ID of the VPC.

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

vpc-bp1b1xjllp3ve5yze****
RegionIdstringYes

The region ID of the VPC.

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

cn-hangzhou
VpcNamestringNo

The name of the VPC.

Vpc-1
IsDefaultbooleanNo

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

  • true (default): yes
  • false: no
false
DryRunbooleanNo

Specifies whether to check the request without performing the operation. Valid values:

  • true: checks the request but does not query VPCs. The system checks whether your AccessKey pair is valid, whether the Resource Access Management (RAM) user is authorized, and whether the required parameters are set. If the request fails to pass the check, an error message is returned. If the request passes the check, the DryRunOperation error code is returned.
  • false (default): sends the request. If the request passes the check, a 2xx HTTP status code is returned and VPCs are queried.
false
ResourceGroupIdstringNo

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

rg-acfmxvfvazb4p****
PageNumberintegerNo

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

1
PageSizeintegerNo

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

10
VpcOwnerIdlongNo

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

253460731706911258
DhcpOptionsSetIdstringNo

The ID of the DHCP options set.

dopt-o6w0df4epg9zo8isy****

Response parameters

ParameterTypeDescriptionExample
object
PageSizeinteger

The number of entries returned per page.

10
RequestIdstring

The ID of the request.

C6532AA8-D0F7-497F-A8EE-094126D441F5
PageNumberinteger

The number of the returned page.

1
TotalCountinteger

The number of entries returned.

2
Vpcsobject []

The details of the VPCs.

CreationTimestring

The time when the VPC was created.

2021-04-18T15:02:37Z
Statusstring

The status of the VPC. Valid values:

  • Pending: being configured
  • Available: available
Available
VpcIdstring

The ID of the VPC.

vpc-bp1qpo0kug3a20qqe****
IsDefaultboolean

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

  • true: yes
  • false: no
false
OwnerIdlong

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

253460731706911258
RegionIdstring

The ID of the region to which the VPC belongs.

cn-hangzhou
VpcNamestring

The name of the VPC.

vpc1
VRouterIdstring

The ID of the vRouter.

vrt-bp1jcg5cmxjbl9xgc****
DhcpOptionsSetStatusstring

The status of the DHCP options set. Valid values:

  • Available: available
  • InUse: in use
  • Deleted: deleted
  • Pending: being configured
Available
CidrBlockstring

The IPv4 CIDR block of the VPC.

192.168.0.0/16
Descriptionstring

The description of the VPC.

This is my VPC.
ResourceGroupIdstring

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

rg-acfmxazb4ph****
DhcpOptionsSetIdstring

The ID of the DHCP options set.

dopt-o6w0df4epg9zo8isy****
Ipv6CidrBlockstring

The IPv6 CIDR block of the VPC.

2408:XXXX:0:a600::/56
CenStatusstring

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

Attached is returned only if the VPC is attached to a CEN instance.

Attached
Tagsobject []

The tag information about the VPC.

Keystring

The key of the tag that is added to the VPC.

env
Valuestring

The value of the tag that is added to the VPC.

internal
Ipv6CidrBlocksobject []

The IPv6 CIDR blocks of the VPC.

Ipv6Ispstring

The type of IPv6 CIDR block. Valid values:

  • BGP: an IPv6 CIDR block provided by Alibaba Cloud over Border Gateway Protocol (BGP)
  • ChinaMobile: an IPv6 CIDR block provided by China Mobile (single ISP)
  • ChinaUnicom: an IPv6 CIDR block provided by China Unicom (single ISP)
  • ChinaTelecom: an IPv6 CIDR block provided by China Telecom (single ISP)
Note If your Alibaba Cloud account is allowed to activate single-ISP bandwidth, valid values are: ChinaTelecom, ChinaUnicom, and ChinaMobile.
BGP
Ipv6CidrBlockstring

The IPv6 CIDR block of the VPC.

2408:XXXX:0:a600::/56
VSwitchIdsarray

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.

string
vsw-bp1nhbnpv2blyz8dl****
SecondaryCidrBlocksarray

The secondary CIDR blocks of the VPC.

string
192.168.20.0/24
UserCidrsarray

The list of user CIDR blocks.

string
10.0.0.0/8
NatGatewayIdsarray

The IDs of the NAT gateways.

string
nat-245xxxftwt45bg****
RouterTableIdsarray

The IDs of the route tables.

string
vtb-bp1krxxzp0c29fmon****

Examples

Sample success responses

JSONformat

{
  "PageSize": 10,
  "RequestId": "C6532AA8-D0F7-497F-A8EE-094126D441F5",
  "PageNumber": 1,
  "TotalCount": 2,
  "Vpcs": {
    "Vpc": [
      {
        "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": {
          "Tag": [
            {
              "Key": "env",
              "Value": "internal"
            }
          ]
        },
        "Ipv6CidrBlocks": {
          "Ipv6CidrBlock": [
            {
              "Ipv6Isp": "BGP",
              "Ipv6CidrBlock": "2408:XXXX:0:a600::/56"
            }
          ]
        },
        "VSwitchIds": {
          "VSwitchId": [
            "vsw-bp1nhbnpv2blyz8dl****"
          ]
        },
        "SecondaryCidrBlocks": {
          "SecondaryCidrBlock": [
            "192.168.20.0/24"
          ]
        },
        "UserCidrs": {
          "UserCidr": [
            "10.0.0.0/8"
          ]
        },
        "NatGatewayIds": {
          "NatGatewayIds": [
            "nat-245xxxftwt45bg****"
          ]
        },
        "RouterTableIds": {
          "RouterTableIds": [
            "vtb-bp1krxxzp0c29fmon****"
          ]
        }
      }
    ]
  }
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidVpcIdNumber.NotSupportedThe number of vpcIds exceeds the limit.The value of the vpcId parameter has reached the upper limit.
400InvalidAliuidUser Id is not valid.-
400InvalidResourceGroupIdThe specified ResourceGroupId does not exist.The specified resource group ID does not exist.
400InvalidTagKeyThe tag keys are not valid.The tag index is invalid.
400InvalidTagValueThe tag values are not valid.The tag value is invalid.
400InvalidResourceGroupId.NotFoundThe Specified ResourceGroupId not exists.-
400OperationUnsupported.ResourceGroupId%s-
400IellgalParameter.OwnerAccountThe specified parameter OwnerAccount is not valid.-
400IllegalParam.OwnerIdThe specified parameter VpcOwnerId is not valid.-
400InvalidAccount.NotFoundThe account is invalid.The operation failed because an invalid account is used.
500InternalErrorThe request processing has failed due to some unknown error.An unknown error occurred.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-07-26The error codes of the API operation change.see changesets
Change itemChange content
Error CodesThe error codes of the API operation change.
    delete Error Codes: 400
    delete Error Codes: 500
2023-07-26API Description Update,The error codes of the API operation change.,The input parameters of the API operation change.see changesets
Change itemChange content
API DescriptionAPI Description Update
Error CodesThe error codes of the API operation change.
    delete Error Codes: 400
    delete Error Codes: 500
Input ParametersThe input parameters of the API operation change.
    Added Input Parameters: Tag
2023-06-13The error codes of the API operation change.see changesets
Change itemChange content
Error CodesThe error codes of the API operation change.
    Error Codes 400 change
    delete Error Codes: 500