Crea una red privada virtual (VPC).
Descripción de la operación
Al llamar a esta operación para crear una VPC, tenga en cuenta los siguientes puntos:
-
Una VPC solo puede tener un bloque CIDR IPv4 principal. Puede agregar bloques CIDR IPv4 secundarios para ampliar el espacio de direcciones.
-
Después de crear una VPC, puede ampliar o reducir el bloque CIDR IPv4 original. Si las direcciones IP dentro del bloque CIDR actual ya están en uso y quedan fuera del bloque CIDR de destino, la modificación falla.
-
Cada VPC admite hasta 300,000 direcciones de red privada para recursos en la nube. Esta cuota no se puede aumentar.
-
Después de crear una VPC, se crean automáticamente un vRouter y una tabla de rutas.
-
Cada VPC admite hasta tres bloques CIDR de usuario. Si varios bloques CIDR de usuario se superponen, el bloque CIDR con la máscara más corta surte efecto. Por ejemplo, entre 10.0.0.0/16 y 10.0.0.0/24, 10.0.0.0/16 surte efecto.
-
CreateVpc es una operación asíncrona. Después de invocar esta operación, el sistema devuelve un ID de instancia, pero la VPC aún no está completamente creada. La tarea de creación en segundo plano sigue en curso. Puede invocar DescribeVpcAttribute para consultar el estado de creación de la VPC:
Si la VPC está en estado Creating, la VPC se está creando.
Si la VPC está en estado Created, la VPC está creada.
-
CreateVpc admite la creación concurrente de VPC no predeterminadas dentro de la misma región, sujeto a los límites de cuota.
Pruébelo ahora
Test
Autorización de RAM
|
Action |
Nivel de acceso |
Tipo de recurso |
Clave de condición |
Acción dependiente |
|
vpc:CreateVpc |
create |
*VPC
|
Ninguna | Ninguna |
Parámetros de la solicitud
|
Parámetro |
Tipo |
Obligatorio |
Descripción |
Ejemplo |
| RegionId |
string |
Sí |
El ID de la región de la VPC. Puede llamar a DescribeRegions para consultar la lista de regiones más reciente. |
cn-hangzhou |
| CidrBlock |
string |
No |
El bloque CIDR de la VPC.
|
172.16.0.0/12 |
| Ipv6CidrBlock |
string |
No |
El bloque CIDR IPv6 de la VPC. Cuando habilita IPv6 para la VPC, el sistema asigna un bloque CIDR IPv6. Para asignar un bloque CIDR IPv6, primero debe invocar AllocateVpcIpv6Cidr para reservar el bloque CIDR IPv6 y luego pasarlo como parámetro. |
2408:XXXX:0:6a::/56 |
| VpcName |
string |
No |
El nombre de la VPC. El nombre debe tener de 1 a 128 caracteres de longitud y no puede comenzar con |
abc |
| EnableIpv6 |
boolean |
No |
Especifica si se debe habilitar IPv6. Valores válidos:
|
false |
| Description |
string |
No |
La descripción de la VPC. La descripción debe tener de 1 a 256 caracteres de longitud y no puede comenzar con |
Esta es mi primera VPC |
| ResourceGroupId |
string |
No |
El ID del grupo de recursos. Para obtener más información sobre los grupos de recursos, consulte ¿Qué es un grupo de recursos?. |
rg-acfmxazb4ph6aiy**** |
| Tag |
array<object> |
No |
Las etiquetas del recurso. |
|
|
object |
No |
La etiqueta. |
||
| Key |
string |
No |
La clave de etiqueta del recurso. Puede especificar hasta 20 claves de etiqueta. La clave de etiqueta no puede ser una cadena vacía. La clave de etiqueta puede tener hasta 128 caracteres de longitud y no puede comenzar con |
FinanceDept |
| Value |
string |
No |
El valor de etiqueta del recurso. Puede especificar hasta 20 valores de etiqueta. El valor de etiqueta puede ser una cadena vacía. El valor de etiqueta puede tener hasta 128 caracteres de longitud y no puede comenzar con |
FinanceJoshua |
| DryRun |
boolean |
No |
Especifica si se debe realizar una ejecución de prueba (dry run). Valores válidos:
|
false |
| UserCidr |
string |
No |
El bloque CIDR de usuario. Separe varios bloques CIDR con comas (,). Puede especificar hasta tres bloques CIDR. Para obtener más información sobre los bloques CIDR de usuario, consulte la sección |
192.168.0.0/12 |
| ClientToken |
string |
No |
El token de cliente que se utiliza para garantizar la idempotencia de la solicitud. Puede utilizar el cliente para generar el token, pero debe asegurarse de que el token sea único entre diferentes solicitudes. El token solo puede contener caracteres ASCII. Nota
Si no especifica este parámetro, el sistema utiliza automáticamente el RequestId de la solicitud de API como ClientToken. El RequestId puede ser diferente para cada solicitud de API. |
123e4567-e89b-12d3-a456-426655440000 |
| Ipv6Isp |
string |
No |
El tipo de bloque CIDR IPv6 de la VPC. Valores válidos:
Nota
Si su cuenta está incluida en la lista blanca de ancho de banda de ISP único, puede establecer este parámetro en ChinaTelecom (China Telecom), ChinaUnicom (China Unicom) o ChinaMobile (China Mobile). |
BGP |
| Ipv4IpamPoolId |
string |
No |
El ID de instancia del pool de IPAM IPv4. |
ipam-pool-sycmt3p2a9v63i**** |
| Ipv4CidrMask |
integer |
No |
La máscara utilizada para asignar un bloque CIDR desde el pool de IPAM a la VPC. Nota
Al crear una VPC mediante la especificación de un pool de IPAM, debe especificar al menos uno de CidrBlock o Ipv4CidrMask. |
12 |
| EnableDnsHostname |
boolean |
No |
Especifica si se debe habilitar la función de nombre de host DNS. Valores válidos:
|
false |
| Ipv6IpamPoolId |
string |
No |
El ID de instancia del pool de IPAM IPv6. |
ipam-pool-bp1aq51kkfh477z03**** |
| Ipv6CidrMask |
integer |
No |
La máscara utilizada para agregar un bloque CIDR IPv6 a la VPC desde el pool de IPAM. |
56 |
Elementos de la respuesta
|
Elemento |
Tipo |
Descripción |
Ejemplo |
|
object |
El ID de la VPC creada. |
||
| VpcId |
string |
El ID de la VPC creada. |
vpc-bp15zckdt37pq72zv**** |
| VRouterId |
string |
El ID del vRouter que se crea automáticamente cuando se crea la VPC. |
vrt-bp1lhl0taikrteen8**** |
| RequestId |
string |
El ID de la solicitud. |
0ED8D006-F706-4D23-88ED-E11ED28DCAC0 |
| RouteTableId |
string |
El ID de la tabla de rutas que se crea automáticamente cuando se crea la VPC. |
vtb-bp145q7glnuzdv**** |
| ResourceGroupId |
string |
El ID del grupo de recursos. |
rg-acfmxazb4ph6aiy**** |
Ejemplos
Respuesta exitosa
JSON Formato
{
"VpcId": "vpc-bp15zckdt37pq72zv****",
"VRouterId": "vrt-bp1lhl0taikrteen8****",
"RequestId": "0ED8D006-F706-4D23-88ED-E11ED28DCAC0",
"RouteTableId": "vtb-bp145q7glnuzdv****",
"ResourceGroupId": "rg-acfmxazb4ph6aiy****"
}
Códigos de error
|
Código de estado HTTP |
Código de error |
Mensaje de error |
Descripción |
|---|---|---|---|
| 400 | TOKEN_PROCESSING | Action is processing. | |
| 400 | InvokeError | instance quota rule invoke error. | Failed to get rule data, please wait zai shi |
| 400 | InvalidParameter | Specified CIDR block is not valid | |
| 400 | ResourceNotAvailable | Resource you requested is not available in this region or zone. | |
| 400 | InvalidVpcName.Malformed | Specified VPC name is not valid. | |
| 400 | InvalidVpcDiscription.Malformed | Specified VPC description is not valid. | |
| 400 | QuotaExceeded.Vpc | VPC quota exceeded. | The number of VPCs in this account has reached the upper limit. |
| 400 | ResourceNotAvailable.Vpc | Resource you requested is not available in this region or zone. | |
| 400 | InvalidUserCidr.Quota | Specified UserCidr number is greater than 3. | |
| 400 | InvalidUserCidr.Malformed | Specified UserCidr overlapping in of 100.64.0.0/10. | The user CIDR block that you specify overlaps with 100.64.0.0/10. |
| 400 | InvalidResourceGroupId | The specified ResourceGroupId does not exist. | The specified resource group ID does not exist. |
| 400 | IllegalParam.Ipv6CidrBlock | %s | |
| 400 | OperationFailed.IPv6CidrNotReserved | %s | |
| 400 | MissingParam.EnableIpv6 | %s | |
| 400 | OperationUnsupported.Ipv6Feature | %s | |
| 400 | System.ServiceBusy | System is busy, please try later. | |
| 400 | IllegalParam.UserCidr | UserCidr is not a valid or strict address. | UserCidr is illegal. |
| 400 | OperationUnsupported.ResourceGroupId | ResourceGroup is not supported in this region. | The operation is not supported. Resource group IDs are not supported in Finance Cloud. |
| 400 | IllegalParam.EnableIpv6 | %s | |
| 400 | InvalidIpv6CidrBlock.Malformed | Specified Ipv6CidrBlock is not valid. | |
| 400 | UnsupportedFeature.Ipv6Isp | The Ipv6Isp feature is not supported. | The specified IPv6 ISP is not supported. |
| 400 | ResourceNotEnough.Ipv6Cidr | The specified resource of Ipv6Cidr is not enough. | IPv6 addresses are insufficient. |
| 400 | UnsupportedFeature.IPAM | VPCs cannot be created by using IPAM. | You cannot use IPAM to create a VPC. |
| 400 | IllegalParam.Ipv4CidrMask | The specified Ipv4CidrMask is illegal. | Invalid Ipv4CidrMask. |
| 400 | IllegalParam.IpamPool | The specified IPAM pool cannot be empty. | The IPAM pool cannot be empty. |
| 400 | OperationDenied.RequestRegionInvalid | The operation is not allowed because the request is not invoked in the region of the IPAM pool. | The operation is not allowed because the request is not invoked in the region of the IPAM pool. |
| 400 | OperationDenied.IpamPoolNotInRegion | The operation is not allowed because the IPAM pool not in specific region does not support creating VPC or associating CIDR for VPC. | The operation is not allowed because the IPAM pool not in specific region does not support creating VPC or associating CIDR for VPC. |
| 400 | MissingParam.CidrOrCidrMask | The CIDR or CIDR Mask must be input. | The CIDR or CIDR Mask must be input. |
| 400 | OperationDenied.CidrInExcludeCidrs | The operation is not allowed because the input CIDR is within the illegal CIDRs. | The operation is not allowed because the input CIDR is within the illegal CIDRs. |
| 400 | OperationDenied.AvailableCidrInsufficient | The operation is not allowed because available CIDR is insufficient. | The operation is not allowed because available CIDR is insufficient. |
| 400 | UnsupportedFeature.Ipam | IPAM is not supported in this region. | The IPAM feature is not supported in this region. |
| 400 | OperationDenied.CidrUnavailableInPool | The operation is not allowed because the CIDR is unavailable in the IPAM pool. | The operation is not allowed because the CIDR is unavailable in the IPAM pool. |
| 400 | IllegalParam.CidrBlockMask | The param of CidrBlock Mask [%s] is illegal. | The subnet mask of the CIDR block is invalid. |
| 400 | UnsupportedFeature.VpcDnsHostname | The feature of vpc dns hostname is unsupported. | The VPC private domain name function does not take effect in the current region. |
| 400 | OperationDenied.MaskOfCidrIsNotAllowed | The input mask or mask of the input CIDR is not allowed. | The input mask or mask of the input CIDR is not allowed. |
| 400 | IllegalParam.Ipv6Isp | The specified Ipv6Isp is illegal. | The specified Ipv6Isp is illegal. |
| 400 | IllegalParam.CidrMask | The input CIDR mask is illegal. | The input CIDR mask is illegal. |
| 400 | InvalidRegionId.NotFound | Specified value of "regionId" is not supported. | |
| 400 | UnsupportedFeature.DhcpOptionsSet | The feature of dhcp options set is unsupported. | The DHCP Options Set function does not take effect in the current region. |
| 400 | OperationDenied.CidrMaskTooLarge | The operation is denied because the CIDR mask %s is larger than the allocationMaxNetmask %s of the pool. | The operation is denied because the CIDR mask %s is larger than the allocationMaxNetmask %s of the pool. |
| 400 | OperationDenied.CidrMaskTooSmall | The operation is denied because the CIDR mask %s is less than the allocationMinNetmask %s of the pool. | The operation is denied because the CIDR mask %s is less than the allocationMinNetmask %s of the pool. |
| 400 | Mismatch.ParamIpv6IspAndIpamPoolIpv6Isp | The specified IPv6 ISP %s does not match the IPAM pool's IPv6 ISP %s. | The specified IPv6 ISP does not match the IPv6 ISP configured in the IPAM pool. |
| 400 | IllegalParam.CidrBlock | The param of CidrBlock [%s] is illegal. | The CidrBlock parameter is set to an invalid value. |
| 500 | InternalError | The request processing has failed due to some unknown error. | |
| 403 | Forbidden | User not authorized to operate on the specified resource. | You do not have the permissions to manage the specified resource. Apply for the permissions and try again. |
| 404 | ResourceNotFound.IpamPool | The dependent IPAM pool is not found. | The dependent IPAM pool is not found. |
Consulte Códigos de error para ver la lista completa.
Notas de la versión
Consulte Notas de la versión para ver la lista completa.