Tous les produits
Search
Centre de documentation

Elastic IP Address:AssociateEipAddress

Dernière mise à jour :Aug 18, 2026

Associe une adresse IP élastique (EIP) à une instance de ressource cloud dans la même région.

Description de l'opération

  • Une EIP peut être associée à une instance ECS de type VPC (Virtual Private Cloud), une instance CLB de type VPC, une interface réseau élastique (ENI) secondaire, une passerelle NAT Internet ou une adresse IP virtuelle à haute disponibilité (HAVIP) dans la même région.

  • L'opération AssociateEipAddress est asynchrone. Après l'envoi d'une requête, le système renvoie un identifiant de requête, mais l'association entre l'EIP et l'instance de ressource cloud n'est pas encore terminée. La tâche d'association continue de s'exécuter en arrière-plan. Vous pouvez appeler DescribeEipAddresses pour interroger l'état de l'EIP :

    • Si l'EIP est dans l'état Associating, l'EIP est en cours d'association. Dans cet état, vous pouvez uniquement exécuter des opérations de requête.

    • Si l'EIP est dans l'état InUse, l'EIP est associée.

  • L'opération AssociateEipAddress ne prend pas en charge les requêtes simultanées pour associer la même EIP à des instances de ressources cloud.

Testez maintenant

Testez cette API dans OpenAPI Explorer, sans signature manuelle. Les appels réussis génèrent automatiquement du code SDK correspondant à vos paramètres. Téléchargez-le avec une sécurité intégrée des identifiants pour une utilisation locale. Testez cette API dans OpenAPI Explorer, sans signature manuelle. Les appels réussis génèrent automatiquement du code SDK correspondant à vos paramètres. Téléchargez-le avec une sécurité intégrée des identifiants pour une utilisation locale.

Test

Autorisation RAM

Le tableau ci-dessous décrit les autorisations nécessaires pour appeler cette API. Vous pouvez les définir dans une politique Resource Access Management (RAM). Les colonnes du tableau sont détaillées ci-dessous :

  • Action : les actions peuvent être utilisées dans l'élément Action des instructions de politique de permissions RAM pour accorder les autorisations nécessaires à l'exécution de l'opération.

  • API : l'API que vous pouvez appeler pour exécuter l'action.

  • Niveau d'accès : le niveau d'accès prédéfini accordé pour chaque API. Valeurs valides : create, list, get, update et delete.

  • Type de ressource : le type de ressource qui prend en charge l'autorisation pour exécuter l'action. Il indique si l'action prend en charge les permissions au niveau de la ressource. La ressource spécifiée doit être compatible avec l'action. Sinon, la politique sera inefficace.

    • Pour les API avec permissions au niveau de la ressource, les types de ressource requis sont marqués d'un astérisque (*). Spécifiez l'Alibaba Cloud Resource Name (ARN) correspondant dans l'élément Resource de la politique.

    • Pour les API sans permissions au niveau de la ressource, la valeur All Resources est affichée. Utilisez un astérisque (*) dans l'élément Resource de la politique.

  • Clé de condition : les clés de condition définies par le service. La clé permet un contrôle granulaire, applicable aux actions seules ou aux actions associées à des ressources spécifiques. En plus des clés de condition propres au service, Alibaba Cloud fournit un ensemble de clés de condition communes applicables à tous les services pris en charge par RAM.

  • Action dépendante : les actions dépendantes requises pour exécuter l'action. Pour mener à bien l'opération, l'utilisateur RAM ou le rôle RAM doit disposer des permissions pour toutes les actions dépendantes.

vpc:AssociateEipAddress

update

*Address

acs:vpc:{#regionId}:{#accountId}:eip/{#AllocationId}

NatGateway

acs:vpc:{#regionId}:{#accountId}:natgateway/{#NatGatewayId}

Instance

acs:vpc:{#regionId}:{#accountId}:instance/{#InstanceId}

Association

acs:vpc:{#regionId}:{#accountId}:havip/{#HaVipId}

Aucune Aucune

Paramètres de requête

Paramètre

Type

Requis

Description

Exemple

RegionId

string

Non

L'identifiant de la région de l'EIP à associer à une instance de ressource cloud.\n\nVous pouvez appeler l'opération DescribeRegions pour interroger l'identifiant de la région.

cn-hangzhou

AllocationId

string

Oui

L'identifiant de l'EIP à associer à une instance de ressource cloud.

eip-2zeerraiwb7ujsxdc****

InstanceId

string

Oui

L'identifiant de l'instance à associer à l'EIP.\n\nVous pouvez saisir l'identifiant d'instance d'une passerelle NAT Internet, d'une instance Classic Load Balancer (CLB), d'une instance ECS, d'une interface réseau élastique (ENI) secondaire, d'une adresse IP virtuelle à haute disponibilité (HAVIP) ou d'une adresse IP.

i-2zebb08phyczzawe****

InstanceType

string

Non

Le type de l'instance à associer à l'EIP. Valeurs valides :

  • Nat : passerelle NAT Internet.

  • SlbInstance : Classic Load Balancer (CLB).

  • EcsInstance (par défaut) : Elastic Compute Service (ECS).

  • NetworkInterface : interface réseau élastique secondaire (ENI).

  • HaVip : adresse IP virtuelle haute disponibilité.

  • IpAddress : adresse IP.

Remarque

Le type d'instance par défaut est EcsInstance. Si le type d'instance n'est pas EcsInstance, ce paramètre est requis.

EcsInstance

InstanceRegionId

string

Non

L'identifiant de la région de l'instance à associer à l'EIP.\n\n> Ce paramètre est requis uniquement après l'ajout de l'EIP à une instance Alibaba Cloud Global Accelerator (GA) à bande passante partagée.

cn-hangzhou

PrivateIpAddress

string

Non

Une adresse IP dans le bloc CIDR du vSwitch.\n\nSi vous ne spécifiez pas ce paramètre, le système attribue automatiquement une adresse IP privée en fonction de l'identifiant du VPC et de l'identifiant du vSwitch.\n> Si InstanceType est défini sur NetworkInterface, ce paramètre est requis. Saisissez l'adresse IP privée à associer.

192.168.XX.XX

Mode

string

Non

Le mode d'association. Valeurs valides :

  • NAT (par défaut) : mode NAT (mode standard).

  • MULTI_BINDED : mode multi-EIP vers ENI.

  • BINDED : mode EIP vers ENI.

Remarque

Ce paramètre est requis uniquement lorsque InstanceType est défini sur NetworkInterface.

NAT

VpcId

string

Non

L'identifiant du VPC pour lequel la fonctionnalité de passerelle IPv4 est activée et qui se trouve dans la même région que l'EIP.\n\nLorsque l'EIP est associée à une adresse IP, le système utilise la configuration de routage de ce VPC pour activer l'accès au réseau public pour l'adresse IP associée.\n\n> Ce paramètre est requis lorsque InstanceType est défini sur IpAddress.

vpc-257gqcdfvx6n****

ClientToken

string

Non

Le jeton client utilisé pour garantir l'idempotence de la requête.\n\nVous pouvez utiliser le client pour générer le jeton, mais vous devez vous assurer que le jeton est unique pour chaque requête. Le jeton ne peut contenir que des caractères ASCII.\n\n> Si vous ne spécifiez pas ce paramètre, le système utilise automatiquement le RequestId de la requête API comme ClientToken. Le RequestId peut être différent pour chaque requête API.

0c593ea1-3bea-11e9-b96b-88e9fe63****

Éléments de réponse

Élément

Type

Description

Exemple

object

Les paramètres de réponse.

RequestId

string

L'identifiant de la requête.

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

Exemples

JSON format

{
  "RequestId": "0ED8D006-F706-4D23-88ED-E11ED28DCAC0"
}

Codes d'erreur

Code de statut HTTP

Code d'erreur

Message d'erreur

Description

400 InvalidAssociation.Duplicated Specified instance already is associated.
400 OperationDenied Specified instance is not in VPC.
400 InvalidParameter.Mismatch Specified elastic IP address and ECS instance are not in the same region.
400 IncorrectEipStatus Current elastic IP status does not support this operation
400 IncorrectInstanceStatus Current instance status does not support this operation.
400 InvalidInstanceType.ValueNotSupported The specified value of InstanceType is not supported.
400 IncorrectHaVipStatus HaVip can be operated by this action only when it's status is Available or InUse. The operation supports only HAVIPs in the Available or InUse state.
400 InvalidParameter The specified parameter is not valid.
400 InvalidBindingStatus The eip binding status invalid.
400 BIND_INSTANCE_HAVE_PORTMAP_OR_BIND_EIP The instance may have portMap or already bind eip. The ECS instance already has a port forwarding rule (DNAT). Delete the corresponding port forwarding rule before performing the operation.
400 EIP_CAN_NOT_ASSOCIATE_WITH_PUBLIC_IP instance already bind natpublicip,cannot bind eip.
400 BIND_INSTANCE_OWENER_ERROR Cannot operate the eip.
400 NATGATEWAY_FINANCIALLOCKED The NatGateway has expire, cannot do bind operation.
400 InvalidParameter.InstanceTypeNotSupport The specified instance type is not support.
400 QuotaExceeded.NumberOfTrafficEip The number of traffic eip on natgw exceed limitation.
400 QuotaExceeded.NumberOfEip Binded eip Quota exceed on this NatGw. The number of EIPs associated with the NAT gateway exceeds the upper limit.
400 Forbidden.EipCanNotBindGatgw Eip can not bind on natgw.
400 InvalidAction.Denied Action is denied due to unfinished Eip configuration modification. The EIP configurations are not complete and the operation is denied.
400 InstanceType.NotSupport The instance type is invalid.
400 InvalidParams.NotFound instance not found
400 BindInstance.NotSupported bind instance type %s is not supported.
400 Forbidden.InstanceBandwidthNotZero Eip can not bind with instance when it's bandwidth is not zero.
400 INSTANCE_TYPE_NOT_SUPPORT The instance type is invalid.
400 ServerRegion.Invalid Eip bind remote server region invalid.
400 Eni.Attached The eni should be detached from ecs when associating with direct eip. If the ENI is associated with an EIP in cut-through mode, you must disassociate the ENI from the ECS instance.
400 Eni.HasSubIp Eni has sub ip can not bind direct eip.
400 Invalid.DirectEip.BindType The direct eip can be only associated with eni.
400 InvalidStatus.EcsStatusNotSupport The special instance status is not support operate
400 Invalid.Function.NotSupported Multi-IP function is under test, the region or uid is not supported.
400 InvalidStatus.EniStatusNotSupport %s
400 InvalidParameter.EniInstanceId %s
400 InvalidNexthop.DirectEni The direct Eni cannot be nexthop. An ENI in cut-through mode cannot be specified as a next hop.
400 Mode.Conflict The eni can bind only one mode of eip.
400 Mode.NotSupport The user cannot use multi direct eip.
400 QuotaExceed.MultiBindedEip The number of multi binded eip is over limit. the number of multi-passthrough mode eips that can be bound exceeds the limit.
400 InvalidEIPStatus.BizDisabled The EIP has been locked. The error message returned because the EIP is locked.
400 OperationFailed.EniSubIp Eni has sub ip can not bind direct eip.
400 InvalidEip.EipQuotaExceeded The specified eni assigned eip is more than privateIp.
400 OperationUnsupported.MultiIp Multi ip function is not support.
400 InvalidNicOrVm.NotFound Bind nic or vm not exist. The bound NIC or VM does not exist.
400 OperationUnsupported.EipBindModel The instance type of ecs does not support MULTI_BINDED model Eip.
400 IncorrectStatus.NatGateway %s
400 EipBindRemote.BackendRegionMustBeSingle eip bind remote instance, backend region must be single
400 InvalidParameter.BindingInstanceRegion The specified BindingInstanceRegion is not supported.
400 OperationFailed.HavipBoundPortmap %s
400 IllegalParam.Mode %s
400 InvalidStatus.NotAllow Bind instance status invalid The status of the associated instance is invalid.
400 InvalidInstance.NotExist Bind instance data not exist
400 InvalidBandwidthPackageId.NotFound The specified BandwidthPackageId not exist.
400 InvalidStatus.InstanceHasBandWidth The specified instance bandwidth invalid.
400 OperationDenied.CloudBoxResourceExist The operation is not allowed because there are resources related to the cloud box in VPC. The operation is not allowed because CloudBox-related resources exist in the VPC.
400 OperationDenied.CloudBoxVSwitchExist The operation is not allowed because a cloud box type vSwitch exists in VPC. The operation is not allowed because vSwitches of the CloudBox type exist in the VPC.
400 OperationDenied.NoAvailablePrivateIp The operation is failed because of vSwitch has not availalbe private ip The vSwitch does not have sufficient private IP addresses.
400 ResourceAlreadyAssociated.IpAddress %s
400 OperationFailed.Ipv4GatewayNotOpenedInVpc The operation is failed because Ipv4Gateway is not opened in Vpc. The error message returned because the VPC does not have IPv4 gateways enabled and the IP address failed to be associated with the EIP.
400 OperationFailed.Ipv4GatewayNotActivatedInVpc The operation is failed because Ipv4Gateway is not activated in Vpc.
400 OperationDenied.L2EipBindIpAddress %s
400 Forbidden The eip instance owner error The EIP does not belong to your account. Check whether you are authorized to perform the operation on the EIP.
400 Forbidden.FinancialLocked The ip business status is invalid. The error message returned because the instance has overdue payments.
400 UnsupportedFeature.EipBindIpAddress The feature of EipBindIpAddress is not supported. The error message returned because the EIP does not support the IpAddress parameter.
400 OperationFailed.InstanceNotExist The ECS instance does not exist, or is not a VPC VM. The EIP failed to be associated with the ECS instance because the ECS instance does not exist or is not a VPC virtual machine.
400 OperationDenied.Ipv4GatewayExist The operation is not allowed because of Ipv4GatewayExist.
400 OperationFailed.EipBindModeConflict Eips can not bind Eni with NAT mode and MULTI_BINDED mode at the same time.
400 OperationFailed.EcsMigrating The operation is failed because of ECS is migrating.
400 OperationFailed.IpPrefixConflict The operation failed due to the IP prefix of the ENI. The operation conflicts with the IP address prefix of the ENI.
400 UnsupportedFeature.EipBindPrefixIp The feature of EipBindPrefixIp is not supported. You cannot associate an EIP with a prefix list in the current region.
400 OperationDenied.UnsupportedEipBindMode The operation is not supported for the NAT gateway due to its EIP binding mode. The operation is not supported by the EIP binding mode of the NAT gateway.
400 OperationDenied.Unauthorized The operation is not allowed because the user is not in the whitelist. The operation is not allowed because you are not in the whitelist.
400 OperationFailed.SystemBusy Operation failed because system is busy. The error message returned because the system is busy. Try again later.
400 OperationFailed.PrivateIpAddressNotExist The operation failed because the PrivateIpAddress is not found. The specified private IP address is invalid.
400 IllegalParamFormat.%s The param format of %s is illegal. The parameter mode is invalid.
400 MissingParam.InstanceId The param of InstanceId can't be null or empty. InstanceId cannot be empty
400 InvalidEniType.SlaveEni The eni type cannot be slave eni. The network interface type cannot be a secondary network interface.
400 IllegalParam.PrivateIpAddress The specified PrivateIpAddress is illegal. The specified PrivateIpAddress is invalid. Check the parameter constraints and try again after modification.
400 OperationFailed.Ipv4GatewayNotAssociatedWithGatewayRouteTable The operation failed because the specified IPv4 gateway of the VPC is not associated with any gateway route table. The operation failed because the specified IPv4 gateway of the VPC is not associated with any gateway route table.
404 InvalidAllocationId.NotFound Specified allocation ID is not found.
404 InvalidInstanId.NotFound Specified instance does not exist.
404 Forbidden.RegionNotFound Specified instance is not found during access authentication. The error message returned because the region is not supported.
404 OperationDenied.VpcIpv4GatewayEnabled The operation is not allowed because of the VPC of the NAT gateway has opened IPv4 Gateway. IPv4 gateways are enabled for the VPC where the NAT gateway resides and the operation is denied.

Consultez Codes d'erreur pour la liste complète.

Notes de version

Consultez Notes de version pour la liste complète.