All Products
Search
Document Center

Virtual Private Cloud:CreateDefaultVpc

Last Updated:Nov 13, 2024

Creates a default VPC.

Operation description

Usage notes

When you call this operation, take note of the following items:

  • After you create a default VPC, you cannot change its CIDR block. However, you can add secondary IPv4 CIDR blocks to it.

  • In each default VPC, cloud services can use a maximum of 60,000 private IP addresses. You cannot increase the quota.

  • After you create a default VPC, a vRouter and a route table are automatically created for the VPC.

  • At most three user CIDR blocks can be added to a VPC. If a user CIDR block includes another user CIDR block, the one with the shorter subnet mask takes effect. For example, if 10.0.0.0/8 and 10.1.0.0/16 are specified, only 10.0.0.0/8 takes effect.

  • CreateDefaultVpc is an asynchronous operation. After a request is sent, the system returns a request ID and runs the task in the background. You can call the DescribeVpcAttribute operation to query the status of the task:

    • If the default VPC is in the Pending state, the VPC is being configured.
    • If the default VPC is in the Available state, the VPC is available.
  • You cannot repeatedly call the CreateDefaultVpc operation within a specific time period.

  • You can create only one default VPC in each 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.

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:CreateDefaultVpc
  • VPC
    acs:vpc:{#regionId}:{#accountId}:vpc/*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The ID of the region to which the default VPC belongs.

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

cn-hangzhou
Ipv6CidrBlockstringNo

The IPv6 CIDR block of the default VPC.

Note When EnableIpv6 is set to true, this parameter is required.
2408:XXXX:346:b600::/56
EnableIpv6booleanNo

Specifies whether to enable IPv6. Valid values:

  • false (default)
  • true
false
ResourceGroupIdstringNo

The ID of the resource group.

rg-acfmystnjq4****
ClientTokenstringNo

The client token that is used to ensure the idempotence of the request.

You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters.

Note If you do not specify this parameter, the system automatically uses the request ID as the client token. The request ID may be different for each request.
123e4567-e89b-12d3-a456-426655440000

Response parameters

ParameterTypeDescriptionExample
object

The ID of the default VPC.

VpcIdstring

The ID of the default VPC.

vpc-bp15zckdt37pq72zv****
VRouterIdstring

The vRouter ID that is automatically created by the system after you create a default VPC.

vrt-bp1lhl0taikrteen8****
RequestIdstring

The request ID.

0ED8D006-F706-4D23-88ED-E11ED28DCAC0
RouteTableIdstring

The route table ID that is automatically created by the system after you create a default VPC.

vtb-bp1q1uirugzb1x32m****

Examples

Sample success responses

JSONformat

{
  "VpcId": "vpc-bp15zckdt37pq72zv****",
  "VRouterId": "vrt-bp1lhl0taikrteen8****",
  "RequestId": "0ED8D006-F706-4D23-88ED-E11ED28DCAC0",
  "RouteTableId": "vtb-bp1q1uirugzb1x32m****"
}

Error codes

HTTP status codeError codeError messageDescription
400TOKEN_PROCESSINGAction is processing.-
400InvokeErrorinstance quota rule invoke error.Failed to get rule data, please wait zai shi
400InvalidParameterSpecified CIDR block is not validThe specified CIDR block is invalid.
400ResourceNotAvailableResource you requested is not available in this region or zone.You cannot create a vSwitch in the current region or zone.
400InvalidVpcName.MalformedSpecified VPC name is not valid.The format of the VPC name is invalid. Enter a valid VPC name and try again.
400InvalidVpcDiscription.MalformedSpecified VPC description is not valid.The format of the VPC description is invalid.
400QuotaExceeded.VpcVPC quota exceeded.The number of VPCs in this account has reached the upper limit.
400ResourceNotAvailable.VpcResource you requested is not available in this region or zone.The resource you requested is not available in this region or zone.
400InvalidParameterSpecified UserCidr invalid format.The format of the user CIDR block is invalid.
400InvalidParameterSpecified UserCidr Subnet mask is not valid .The subnet mask of the user CIDR block is invalid.
400InvalidUserCidr.QuotaSpecified UserCidr number is greater than 3.The number of user CIDR blocks that you specify has reached the upper limit.
400InvalidUserCidr.MalformedSpecified UserCidr overlapping in of 100.64.0.0/10.The user CIDR block that you specify overlaps with 100.64.0.0/10.
400InvalidResourceGroupIdThe specified ResourceGroupId does not exist.The specified resource group ID does not exist.
400IllegalParam.Ipv6CidrBlock%s-
400OperationFailed.IPv6CidrNotReserved%s-
400MissingParam.EnableIpv6%s-
400OperationUnsupported.Ipv6Feature%s-
400IllegalParam.ZoneId%s-
400OperationFailed.DefaultVpcExist%s-
400OperationFailed.DefaultVpcExistA default VPC already exists in the region.-
403ForbbidenUser not authorized to operate on the specified resource.User not authorized to operate on the specified resource.
404InvalidRegionId.NotFoundSpecified value of "regionId" is not supported.RegionId is set to an invalid value. Check whether the service is available in the specified region and try again.
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.