All Products
Search
Document Center

Virtual Private Cloud:ModifyVpcAttribute

Last Updated:Aug 28, 2026

Modifies the configuration of a specified VPC.

Operation description

  • The ModifyVpcAttribute operation does not support concurrent modifications to the configuration of the same VPC.

  • The ModifyVpcAttribute operation can enable IPv6 for a VPC, but cannot modify the IPv6 CIDR block or IPv6 address type for a VPC that already has IPv6 enabled.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

vpc:ModifyVpcAttribute

update

*VPC

acs:vpc:{#regionId}:{#accountId}:vpc/{#VpcId}

  • vpc:tag
None

Request parameters

Parameter

Type

Required

Description

Example

VpcId

string

Yes

The ID of the VPC whose configuration you want to modify.

vpc-bp1qtbach57ywecf****

Description

string

No

The new description of the VPC.

The description must be 1 to 256 characters in length and cannot start with http:// or https://.

This is my VPC.

VpcName

string

No

The new name of the VPC.

The name must be 1 to 128 characters in length and cannot start with http:// or https://.

Vpc-1

CidrBlock

string

No

The new IPv4 CIDR block of the VPC.

You can expand or shrink the CIDR block within the original IPv4 CIDR block of the VPC. The recommended subnet mask is 16 to 28 bits. If you shrink the IPv4 CIDR block of the VPC, the modification fails if any IP addresses already in use fall outside the target CIDR block.

Note

Modifying the IPv4 CIDR block of a VPC does not affect existing services.

192.168.0.0/24

RegionId

string

No

The region ID of the VPC.

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

cn-hangzhou

EnableIPv6

boolean

No

Specifies whether to enable IPv6. Valid values:

  • false (default): Disabled.

  • true: Enabled.

false

Ipv6CidrBlock

string

No

The IPv6 CIDR block of the VPC. When you enable IPv6 for a VPC, the system will assign an IPv6 CIDR block. To specify an IPv6 CIDR block, you need to first invoke the AllocateVpcIpv6Cidr operation to reserve a specific IPv6 CIDR block, and then pass it in.

Note

For a VPC that already has IPv6 enabled, you cannot modify the IPv6 CIDR block by passing in this parameter.

2408:XXXX:0:6a::/56

Ipv6Isp

string

No

The type of the IPv6 CIDR block of the VPC. Valid values:

  • BGP (default): Alibaba Cloud BGP IPv6.

  • ChinaMobile: China Mobile (single-ISP).

  • ChinaUnicom: China Unicom (single-ISP).

  • ChinaTelecom: China Telecom (single-ISP).

Note

If you are a user who has activated the single-ISP bandwidth whitelist, you can set this parameter to ChinaTelecom (China Telecom), ChinaUnicom (China Unicom), or ChinaMobile (China Mobile).

BGP

EnableDnsHostname

boolean

No

Specifies whether to enable the DNS hostname feature. Valid values:

  • false (default): Disabled.

  • true: Enabled.

false

Response elements

Element

Type

Description

Example

object

The request ID.

RequestId

string

The request ID.

43B72D30-25E1-4FA3-96A8-89374A521D1A

Examples

Success response

JSON format

{
  "RequestId": "43B72D30-25E1-4FA3-96A8-89374A521D1A"
}

Error codes

HTTP status code

Error code

Error message

Description

400 Forbidden.VpcNotFound Specified VPC does not exist.
400 InvalidDescription.Malformed description not valid..
400 InvalidVpcName.Malformed Specified VPC name is not valid.
400 InvalidVpcDiscription.Malformed Specified VPC description is not valid.
400 InvalidParameter Specified UserCidr invalid format.
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 InvalidVpcId.NotFound Specified VPC name is not valid.
400 IncorrectVpcStatus Current VPC status does not support this operation.
400 IllegalCidrBlock Some subnet cidrBlock is not in the cidrBlock.
400 InvalidRegion.Malformed Specified RegionId is not vaild.
400 InvalidCidrBlock.Malformed Specified CIDR block is not valid.
400 OperationUnsupported.DisableIpv6 %s
400 OperationUnsupported.Ipv6Feature %s
400 ParamExclusive.EnableIpv6AndCidrBlock EnableIpv6 and CidrBlock is mutually exclusive.
400 OperationFailed.ClassicLinkEnabled Operation failed because classicLink is enabled.
400 OperationFailed.IpV6VSwitchInuse %s
400 OperationFailed.Ipv6GatewayInUse The IPv6 gateway is in use. You cannot modify the VPC attributes because the IPv6 gateway is in use.
400 OperationFailed.QueryCenIpv6Status Failed to query the IPv6 status of the specified VPC in CEN. The operation failed because the system failed to query the IPv6 status of the VPC that is attached to the CEN instance.
400 OperationUnsupported.CenIpv6Enabled The IPv6 feature is enabled in CEN. The IPv6 feature is already enabled for CEN.
400 UnsupportedFeature.Ipv6Isp The Ipv6Isp feature is not supported. The specified IPv6 ISP is not supported.
400 ResourceNotEnough.Ipv6Cidr The specified resource ipv6 cidr is not enough. Insufficient IPv6 CIDR block resources.
400 OperationFailed.IPv6CidrNotReserved The IPv6 CIDR block is not reserved. The operation failed. The specified IPv6 CIDR block is not reserved.
400 IllegalParam.Ipv6Cidr The specified Ipv6CidrBlock is invalid. Ipv6CidrBlock is set to an invalid value.
400 InvalidIpv6Instance.NotFound The specified resource of InvalidIpv6Instance is not found. The error message returned because the IPv6 resource is not found.
400 ExclusiveParam.EnableIpv6AndCidrBlock The param of EnableIpv6 and CidrBlock are mutually exclusive. The param of EnableIpv6 and CidrBlock are mutually exclusive.
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 OperationFailed.Ipv6RouteEntryUsing VPC exist IPv6 Route Entry, cannot disable IPv6. The VPC has an IPv6 route, and IPv6 must not be disabled.
400 OperationFailed.ModifyVpcDnsHostname Operation failed because DnsHostName resource is in transient state, please try again later. dns domain name resource is unstable, please try again later.
400 IncorrectStatus.VpcDnsHostnameStatus The DnsHostname status of vpc does not support this operation. The private domain name status of the current VPC does not support this operation.
400 OperationFailed.ConflictWithSecondaryCidr The modified cidr is conflict with the secondary cidr. The operation failed because the modified CidrBlock conflicts with a secondary CIDR block.
400 IllegalParam.CidrBlock The param of CidrBlock [%s] is illegal. The CidrBlock parameter is set to an invalid value.
400 IncorrectStatus.Vpc The status of %s [%s] is incorrect. The instance is in an invalid state.
404 InvalidVpcId.NotFound Specified VPC does not exist.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.