Queries the configurations of a VPC.

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 DescribeVpcAttribute

The name of this action. Valid value: DescribeVpcAttribute.

RegionId String Yes cn-hangzhou

The ID of the region to which the VPC belongs.

VpcId String Yes vpc-bp18sth14qii3pnv****

The ID of the VPC to be queried.

DryRun Boolean No false

Indicates whether to check this request only.

  • true: Sends 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, corresponding errors are returned. If the check succeeds, the system returns the error code DryRunOperation.
  • false (default): Sends a normal request, returns the 2XX HTTP status code after the check, and queries the resource status directly.
IsDefault Boolean No false

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

  • false: The VPC is not the default VPC.
  • true: The VPC is the default VPC.

Response parameters

Parameter Type Example value Description
AssociatedCens Array

The list of Cloud Enterprise Network (CEN) instances to which the VPC is attached.

No value is returned if the VPC is not attached to any CEN instance.

AssociatedCen

The list of Cloud Enterprise Network (CEN) instances to which the VPC is attached.

No value is returned if the VPC is not attached to any CEN instance.

CenId String cen-7qthudw0ll6jmc****

The ID of the CEN instance to which the VPC is attached.

CenOwnerId Long 111111111111

The ID of the account to which the CEN instance belongs.

CenStatus String Attached

Indicates whether the VPC is attached to any CEN instance.

If the VPC is attached to one or more CEN instances, Attached is returned.

CidrBlock String 192.168.0.0/16

The IPv4 CIDR block of the VPC.

ClassicLinkEnabled Boolean false

Indicates whether the ClassicLink function is enabled. Valid values:

  • true: Enable ClassicLink.
  • false: Disable ClassicLink.
CloudResources Array

The list of resources in the VPC.

CloudResourceSetType

The list of resources in the VPC.

ResourceCount Integer 1

The number of resources in the VPC.

ResourceType String VSwitch

The type of resources in the VPC. Valid values:

  • VSwitch: VSwitch.
  • VRouter: VRouter.
  • RouteTable: Route table.
CreationTime String 2018-10-16T07:31:09Z

The creation time of the VPC.

Description String VPC

The description of the VPC.

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

The IPv6 CIDR block of the VPC.

IsDefault Boolean false

Indicates whether the VPC is the default VPC.

  • true: The VPC is the default VPC.
  • false: The VPC is not the default VPC.
RegionId String cn-hangzhou

The ID of the region to which the VPC belongs.

RequestId String 7486AE4A-129D-43DB-A714-2432C074BA04

The ID of the request.

ResourceGroupId String rg-acfmxazbvgb4ph****

The ID of the resource group.

Status String Available

The status of the VPC.

  • Available: The VPC is available.
  • Pending: The VPC is being configured.
UserCidrs List 172.16.0.1/24

The user CIDR. Separate multiple CIDR blocks by using commas (,). Up to three CIDR blocks are supported.

UserCidr

The user CIDR. Separate multiple CIDR blocks by using commas (,). Up to three CIDR blocks are supported.

VRouterId String vrt-bp1jso6ng1at0ajsc****

The ID of the VRouter.

VSwitchIds List {"VSwitchId": [ "vsw-bp14cagpfysr29feg****" ]}

A list of VSwitches in the VPC.

VSwitchId

A list of VSwitches in the VPC.

VpcId String vpc-bp18sth14qii3pnvo****

The ID of the VPC.

VpcName String doctest2

The name of the VPC.

Examples

Request example


http(s)://vpc.aliyuncs.com/? Action=DescribeVpcAttribute
&RegionId=cn-hangzhou
&VpcId=vpc-bp18sth14qii3pnv****
&<CommonParameters>

Response example:

XML format

<DescribeVpcAttributeResponse>
	  <VpcName>doctest2</VpcName>
	  <Description></Description>
	  <IsDefault>false</IsDefault>
	  <ResourceGroupId>rg-acfmxazb4ph****</ResourceGroupId>
	  <UserCidrs></UserCidrs>
	  <ClassicLinkEnabled>false</ClassicLinkEnabled>
	  <AssociatedCens>
		    <AssociatedCen>
			      <CenStatus>Attached</CenStatus>
			      <CenOwnerId>12315790855****</CenOwnerId>
			      <CenId>cen-7qthudw0ll6jmc****</CenId>
		    </AssociatedCen>
	  </AssociatedCens>
	  <VRouterId>vrt-bp1jso6ng1at0ajs****</VRouterId>
	  <VpcId>vpc-bp18sth14qii3pnvo****</VpcId>
	  <CreationTime>2018-10-16T07:31:09Z</CreationTime>
	  <CidrBlock>192.168.0.0/16</CidrBlock>
	  <Status>Available</Status>
	  <VSwitchIds>
		    <VSwitchId>vsw-bp14cagpfysr29fe****</VSwitchId>
	  </VSwitchIds>
	  <RequestId>7486AE4A-129D-43DB-A714-2432C074BA04</RequestId>
	  <RegionId>cn-hangzhou</RegionId>
	  <CloudResources>
		    <CloudResourceSetType>
			      <ResourceType>VSwitch</ResourceType>
			      <ResourceCount>1</ResourceCount>
		    </CloudResourceSetType>
		    <CloudResourceSetType>
			      <ResourceType>VRouter</ResourceType>
			      <ResourceCount>1</ResourceCount>
		    </CloudResourceSetType>
		    <CloudResourceSetType>
			      <ResourceType>RouteTable</ResourceType>
			      <ResourceCount>1</ResourceCount>
		    </CloudResourceSetType>
	  </CloudResources>
</DescribeVpcAttributeResponse>

JSON format

{
	"VpcName":"doctest2",
	"Description":"",
	"IsDefault":false,
	"ResourceGroupId":"rg-acfmxazb4ph****",
	"UserCidrs":{
		"UserCidr":[]
	},
	"ClassicLinkEnabled":false,
	"AssociatedCens":{
		"AssociatedCen":[
			{
				"CenStatus":"Attached",
				"CenOwnerId":"123157908552****",
				"CenId":"cen-7qthudw0ll6jmc****"
			}
		]
	},
	"VRouterId":"vrt-bp1jso6ng1at0ajs****",
	"VpcId":"vpc-bp18sth14qii3pnvo****",
	"CreationTime":"2018-10-16T07:31:09Z",
	"CidrBlock":"192.168.0.0/16",
	"Status":"Available",
	"VSwitchIds":{
		"VSwitchId":[
			"vsw-bp14cagpfysr29feg****"
		]
	},
	"RegionId":"cn-hangzhou",
	"RequestId":"7486AE4A-129D-43DB-A714-2432C074BA04",
	"CloudResources":{
		"CloudResourceSetType":[
			{
				"ResourceType":"VSwitch",
				"ResourceCount":1
			},
			{
				"ResourceType":"VRouter",
				"ResourceCount":1
			},
			{
				"ResourceType":"RouteTable",
				"ResourceCount":1
			}
		]
	}
}

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.
400 IncorrectVpcStatus Current VPC status does not support this operation. The current status of the VPC does not support the action.
404 InvalidVpcId.NotFound Specified VPC does not exist. The specified VPC does not exist.

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