Appelle l'opération AssociateHaVip pour attacher une HaVip à une instance ECS ou à un contrôleur d'interface réseau (NIC) dans un cloud privé virtuel (VPC).
Description de l'opération
Lorsque vous appelez cette opération pour associer une HaVip, prenez note des éléments suivants :
-
La HaVip prend effet immédiatement après son association, sans qu'il soit nécessaire de redémarrer l'instance ECS. Cependant, vous devez configurer la HaVip sur les interfaces réseau élastiques (ENI) de l'instance ECS.
-
La HaVip et l'instance ECS à associer doivent appartenir au même vSwitch.
-
Une HaVip peut être associée à jusqu'à 10 instances ECS ou à jusqu'à 10 interfaces réseau (NIC) en même temps. Cependant, une HaVip ne peut pas être associée simultanément à des instances ECS et à des interfaces réseau (NIC).
-
L'instance ECS à associer doit être dans l'état Running ou Stopped.
-
La HaVip doit être dans l'état Available ou InUse.
-
L'opération AssociateHaVip est asynchrone. Après l'envoi d'une requête, le système renvoie un identifiant de requête, mais l'association de la HaVip n'est pas encore terminée. La tâche d'association continue de s'exécuter en arrière-plan. Vous pouvez appeler DescribeHaVips pour interroger l'état d'association de la HaVip :
Si la HaVip est dans l'état Associating, la HaVip est en cours d'association.
Si la HaVip est dans l'état InUse, la HaVip est associée.
-
L'opération AssociateHaVip ne prend pas en charge l'association simultanée de la même HaVip.
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
|
vpc:AssociateHaVip |
create |
*Instance
*HaVip
|
Aucune | Aucune |
Paramètres de requête
|
Paramètre |
Type |
Requis |
Description |
Exemple |
| ClientToken |
string |
Non |
Le jeton client utilisé pour garantir l'idempotence de la requête. Vous pouvez utiliser le client pour générer le jeton, mais vous devez vous assurer que le jeton est unique pour chaque requête. La valeur de ClientToken ne peut contenir que des caractères ASCII. Remarque
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 de chaque requête API peut être différent. |
0c593ea1-3bea-11e9-b96b-88e9fe63**** |
| RegionId |
string |
Oui |
L'identifiant de la région de la HaVip. Vous pouvez appeler l'opération DescribeRegions pour obtenir la liste des régions la plus récente. |
cn-shanghai |
| HaVipId |
string |
Oui |
L'identifiant de la HaVip à associer. |
havip-2zeo05qre24nhrqpy**** |
| InstanceId |
string |
Oui |
L'identifiant de l'instance ECS à associer à la HaVip. |
i-faf344422ffsfad**** |
| InstanceType |
string |
Non |
Le type de l'instance à attacher à la HaVip. Valeurs valides :
|
EcsInstance |
Éléments de réponse
|
Élément |
Type |
Description |
Exemple |
|
object |
|||
| RequestId |
string |
L'identifiant de la requête. |
C44F62BE-9CE7-4277-B117-69243F3988BF |
Exemples
JSON format
{
"RequestId": "C44F62BE-9CE7-4277-B117-69243F3988BF"
}
Codes d'erreur
|
Code de statut HTTP |
Code d'erreur |
Message d'erreur |
Description |
|---|---|---|---|
| 400 | OperationUnsupported.BindOnFreeNetworkInterface | The network interface must be attached to an ECS instance. | The ENI must be associated with an ECS instance. |
| 400 | OperationUnsupported.BindMultipleType | You cannot bind HaVip to multiple instance types. | You cannot associate the ECS instance and the ENI at the same time. |
| 400 | OperationUnsupported.BindOnMultipleVswitch | The bound instance and HaVip must be on the same vSwitch. | The instance to be associated and the HAVIP must belong to the same vSwitch. |
| 400 | InvalidVip.Status | vip invalid status | |
| 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 | IncorrectInstanceStatus | ECS instance can be operated by this action only when it?s status is Running or Stopped. | |
| 400 | CountLimitExceed.HaVipOnInstance | The amount of HaVip associated with the specified Instance reach its limits. | The number of HAVIPs has reached the upper limit. |
| 400 | CountLimitExceeded.HaVipOnECSInstance | The amount of Instance associated with the specified HaVip reach its limits. | The number of HAVIPs has reached the upper limit. |
| 400 | OperationFailed.DistibuteLock | Distibute lock fail. | The operation is locked by another request; |
| 400 | InvalidNetworkInterfaceId.NotFound | The network interface is not found. | The ENI does not exist. |
| 400 | OperationFailed.QueryNetworkInterfaceInfo | Failed to query network interface information. | The system failed to query ENI information. |
| 400 | IllegalParam.InstanceType | The specified instance type is invalid. Only ECS instances and network interface are allowed. | The type of the associated instance does not support this operation. |
| 400 | OperationUnsupported.BindOnSameEcs | You cannot bind two network interfaces on the same ECS instance. | You are not allowed to associate two ENIs of the same ECS instance. |
| 400 | OperationUnsupported.HavipBindType | You cannot bind HAVIP to network interface in the specified region. | You are not allowed to associate ENIs in the specified region. |
| 400 | InvalidInstance.NotExist | InvalidInstance.NotExist : The specified Instance does not exist in the specified region. i-bp136w25mhx503ptilrh\r\nRequestId : A961CC27-D797-4E16-B1B3-19B9ECBA1495 | |
| 400 | OperationDenied.BindOnSameEcs | The operation is not allowed because networkinterface bind on same instance. | |
| 400 | Forbidden.HaVip | No permissions to perform operations on HAVIPs. Please apply for privilege--vpc_privilege_allow_buy_havip_instance. | The error message returned because you do not have the permissions to manage the HAVIP. Go to the Quota Center page to acquire the permissions. |
| 400 | InvalidInstanceId.NotFound | The specified Instance does not exist in the specified region. | |
| 400 | ResourceNotFound.EcsInstance | The specified resource of ECS instance is not found. | The specified ECS instance does not exist. |
| 400 | InvalidStatus.NotAllow | Bind instance status invalid | The status of the associated instance is invalid. |
| 400 | InvalidHaVip.Exist | haVip already bind exist. | |
| 400 | InvalidRegionId.NotFound | The RegionId provided does not exist in our records. | |
| 400 | QuotaExceeded.HaVipBindInstance | The amount of instance associated with the specified haVip reach its limits. | |
| 404 | InvalidHaVipId.NotFound | The specified HaVip does not exist in the specified region. | The specified HAVIP does not exist in the specified region. Check whether the specified region is correct. |
| 404 | InvalidInstanceId.NotFound | The specified Instance does not exist in the specified region. |
Consultez Codes d'erreur pour la liste complète.
Notes de version
Consultez Notes de version pour la liste complète.