Tüm Ürünler
Search
Belge Merkezi

:ModifyInstanceVpcAttribute

Son Güncelleme:Oct 02, 2026

VPC türü bir ECS örneğinin VPC'sini, özel IP adresini, güvenlik grubunu veya vSwitch'ini değiştirir.

Operation description

Bu işlemi çağırdığınızda, ECS örneğinin Durduruldu (Stopped) durumunda olması gerekir.

  • Bir örneğin özel IP adresini veya vSwitch'ini değiştirirken aşağıdaki hususlara dikkat edin:

    • Yeni oluşturulan bir ECS örneği için bu işlemi çağırmadan önce örneğin yeniden başlatılması gerekir.

    • Başarılı bir değişiklikten sonra, bu işlemi tekrar çağırmadan önce ECS örneğinin yeniden başlatılması gerekir.

  • Bir örneğin VPC'sini değiştirirken aşağıdaki hususlara dikkat edin:

    • Örnek:

      • Örnek durumu: Örnek kilitli, serbest bırakılmayı bekleyen, süresi dolmuş, süre sonu geri dönüşümünde veya ödenmemiş borç geri dönüşümünde olamaz. Daha fazla bilgi için bkz. Örnek yaşam döngüsü.

      • Yük dengeleyici örnekleriyle ilişkilendirilmiş ECS örnekleri desteklenmez.

      • Örnek diğer bulut hizmetleri tarafından kullanılıyor olamaz. Örneğin, örnek geçiş aşamasında olamaz, VPC değişikliği sürecinde olamaz ve örnek üzerinde dağıtılan veritabanları Veri İletim Hizmeti (DTS) tarafından yönetiliyor olamaz.

    • Ağ:

      • Ağ arabirimi denetleyicisi (NIC) görünür modunda EIP veya çoklu EIP'den NIC görünür modu ile yapılandırılmış örnekler desteklenmez.

      • Yüksek kullanılabilirlik (HA) sanal IP adreslarına (HaVips) ekli örnekler desteklenmez.

      • vSwitch'leri özel yönlendirme tablolarıyla ilişkilendirilmiş örnekler desteklenmez.

      • Global Accelerator (GA) etkinleştirilmiş örnekler desteklenmez.

      • İkincil Esnek Ağ Arabirimlerine (ENI) ekli örnekler desteklenmez.

      • IPv6 adresleri ayrılmış örnekler desteklenmez.

      • Birincil NIC'sinde birden fazla IP adresi bulunan örnekler desteklenmez.

      • Belirtilen vSwitch, hedef VPC'ye ait olmalıdır.

      • vSwitch'in bölgesi değişiklikten önce ve sonra aynı kalmalıdır.

      • Birincil NIC için özel bir IP belirtirseniz, IP adresi vSwitch'in CIDR bloğu içinde ve kullanılabilir olmalıdır. Belirtmezseniz, rastgele bir IP adresi ayrılır. Hedef vSwitch'in yeterli sayıda kullanılabilir IP adresine sahip olduğundan emin olun.

      • Başka bir hesap tarafından paylaşılan bir VPC kullanıyorsanız, hedef güvenlik grubunun paylaşılan VPC'de VPC sahibinin hesabı tarafından değil, sizin hesabınız tarafından oluşturulduğundan emin olun.

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

ecs:ModifyInstanceVpcAttribute

update

*Instance

acs:ecs:{#regionId}:{#accountId}:instance/{#instanceId}

*VSwitch

acs:vpc:{#regionId}:{#accountId}:vswitch/{#vswitchId}

  • vpc:tag
  • vpc:VPC
None

Request parameters

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

Örnek kimliği.

Not

Bu işlemi çağırdığınızda, ECS örneğinin Durduruldu (Stopped) durumunda olması gerekir. Örnekle ilgili diğer kısıtlamalar için işlem açıklaması bölümünü dikkatlice okuyun.

i-bp1iudwa5b1tqag1****

VSwitchId

string

Yes

vSwitch kimliği.

  • Belirtilen kimlik örneğin mevcut vSwitch'i ise, vSwitch değişmeden kalır.

  • Belirtilen kimlik yeni bir vSwitch ise ve VpcId parametresi boşsa, yeni ve orijinal vSwitch'lerin aynı bölgeye ve aynı VPC'ye ait olması gerekir.

  • VpcId parametresi boş değilse, bu parametreyle belirtilen vSwitch'in belirtilen VPC'ye ait olması ve orijinal vSwitch ile aynı bölgede olması gerekir.

vsw-bp1s5fnvk4gn3tw12****

PrivateIpAddress

string

No

Yeni özel IP adresi.

Not

PrivateIpAddress parametresi VSwitchId parametresine bağlıdır. Belirtilen IP adresi, vSwitch'in CIDR bloğu içinde olmalıdır.

Varsayılan değer: Bu parametre belirtilmezse, vSwitch'in CIDR bloğundan rastgele bir özel IP adresi atanır.

172.17.**.**

VpcId

string

No

Hedef VPC kimliği.

vpc-bp1vwnn14rqpyiczj****

SecurityGroupId

array

No

VPC değiştirildikten sonra örneğin eklendiği güvenlik gruplarının kimlikleri. Bu parametre yalnızca VpcId parametresi belirtildiğinde gereklidir.

  • Güvenlik grupları, hedef VPC ile aynı VPC'ye ait olmalıdır.

  • Örnek için bir veya daha fazla güvenlik grubu belirtebilirsiniz. Güvenlik grubu sayısı, bir örneğin ait olabileceği güvenlik grubu sayısı sınırlarına tabidir. Daha fazla bilgi için bkz. Sınırlar.

  • Listedeki tüm güvenlik grupları aynı türde olmalıdır.

  • Güvenlik grubu türleri arasında geçiş desteklenir. Bir ECS örneği için güvenlik grubu türleri arasında geçiş yaparken, örnek ağı üzerindeki etkileri önlemek amacıyla iki tür arasındaki güvenlik grubu kuralı yapılandırmaları farklılıklarını anladığınızdan emin olun. Daha fazla bilgi için bkz. Güvenlik grubuna genel bakış.

sg-o6w9l8bc8dgmkw87****

string

No

Güvenlik grubu kimliği.

sg-o6w9l8bc8dgmkw87****

Response elements

Element

Type

Description

Example

object

RequestId

string

İstek kimliği.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

Examples

Success response

JSON format

{
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidTarget.TrafficMirrorSession Instance is target of traffic mirror session.
400 InvalidSource.TrafficMirrorSession Instance is source of traffic mirror session.
400 InvalidPrivateIpAddress.Malformed Specified private IP address is malformed.
400 InvalidPrivateIpAddress.Duplicated Specified private IP address is duplicated.
400 IncorrectVSwitchStatus The current status of virtual switch does not support this operation.
400 IncorrectInstanceStatus The current status of instance does not support this operation.
400 OperationDenied Specified operation is denied as your instance is not in VPC.
400 InvalidVSwitchId.Mismatch Specified instance and virtual switch are not in the same zone.
400 InvalidPrivateIpAddress.Mismatch Specified private IP address is not in the CIDR block of virtual switch.
400 InvalidPrivateIp.Changing Previous action is not finished yet.
400 PrimaryEniHasSubIp Primary network interface of the specified instance has more than one private ip.
400 VSwitchIdNotMatch The subnet of private ip is different to the instance, please unbind ha vip.
400 InvalidOperation.EniCountExceeded The number of ENIs in an enterprise security group has reached the maximum limit.
400 InvalidParameter.SecurityGroupId Security group ids are invalid.
400 InvalidVSwitch.IllegalStatus The operation is not allowed in the current VSwitch state. Expecting state includes "Created", but current state is "%s".
400 QuotaExceeded.PrivateIpAddress There are not enough private IPs in the specified VSwitch.
401 InvalidOperation.SecurityGroupNotAuthorized The specified security group is not authorized to operate.
500 InternalError The request processing has failed due to some unknown error.
403 OperationDenied The Specified operation is denied as your instance is locked for security reasons.
403 InvalidIp.Ipv6Assigned The specified instance has been assigned IPv6 address.
403 SecurityGroupInstanceLimitExceed %s
403 InvalidInstance.HasTransitionRecord The operation is denied because the specified instance has a migration plan.
403 InvalidInstanceStatus.NotNormal The Specified operation is denied due to instance status.
403 InvalidVpcId.SharedVpc The Specified operation is denied as your targe vpc is SharedVpc.
403 InvalidOperation.NotAllowed The operation is denied because the specified VPC has advanced features enabled.
403 InvalidParameter.ToSecurityGroupId %s
403 InvalidOperation.ResourceManagedByCloudProduct %s
403 InvalidOperation.VswAndEcsAvailabilityZoneMismatch Specified instance and virtual switch are not in the same zone.
403 InvalidOperation.CloudBoxEcsNotSupport Cloud box ecs instance does not support modifying VPC.
403 AclLimitExceed %s
404 InvalidInstanceId.NotFound The specified InstanceId does not exist.
404 InvalidVSwitchId.NotFound Specified virtual switch does not exist.
404 NoSuchResource The specified resource is not found.
404 InvalidParameter.InvalidInstanceId The specified InstanceId does not exist.
404 InvalidParameter.VSwitchId The specified virtual vswitch does not exist.
404 InvalidRegion.ValueNotSupported The specified Region does not exist.
404 InvalidInstance.AttachedEni The Specified operation is denied due to elastic network interface.
404 InvalidIp.MultiPrimaryIp The Specified operation is denied due to multi private ip.
404 InvalidIp.Ipv6 The Specified operation is denied due to ipv6.
404 InvalidVSwitch.NotBelongToVpc %s
404 InvalidParameter.EniNo %s
404 InvalidSecurityGroupId.NotFound %s
404 InvalidParameter.SecurityGroupIdRepeated %s
404 InvalidSecurityGroupType.NotSupportClassic The specified SecurityGroupIds have classic group type.
404 InvalidSecurityGroupVpc.NotBelongToOneVpc The specified SecurityGroupIds are belong to different vpc.
404 EnterpriseGroupLimited.MutliGroupType The specified instance can not join multi SecurityGroup types.
404 InvalidParameter.AlreadyInTargetVpc The specified instance is already in the destination VPC.
404 InvalidParameter.SecurityGroupId The specified SecurityGroupId.N is invalid or does not exist.
404 JoinedGroupLimitExceed The specified instance has exceed quota of SecurityGroup.
404 InvalidParameter.MustBeEmpty The specified parameter SecurityGroupId.N and VpcId need be empty.
404 InvalidParameter.NotEnoughIpInVSwitch The specified virtual switch has not enough available ip.
404 InvalidDependence.MutliDirectlyEip The Specified operation is denied due to multi directly Eips.
404 InvalidDependence.HaVip The Specified operation is denied due to HaVip.
404 InvalidDependence.NextHopOfCustomRouter The Specified operation is denied due to next hop of Custom Router.
404 InvalidDependence.BeenUsedAsAppServer The Specified operation is denied due to AppServer.
404 InvalidDependence.GrantAccess The Specified operation is denied due to grant access.
404 InvalidDependence.BindGA The Specified operation is denied due to GA.
404 InvalidDependence.SLB The Specified operation is denied as your instance with alb or clb.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.