Ajoute une instance ECS ou une interface réseau élastique à un groupe de sécurité.
Description de l'opération
Cette API est obsolète. Nous vous recommandons d'appeler l'opération ModifyInstanceAttribute pour ajouter ou supprimer une instance ECS d'un groupe de sécurité, ou d'appeler l'opération ModifyNetworkInterfaceAttribute pour ajouter ou supprimer une interface réseau élastique (ENI) d'un groupe de sécurité.
-
Vous ne pouvez pas ajouter une instance et une interface réseau élastique à un groupe de sécurité dans le même appel. Les paramètres
InstanceIdetNetworkInterfaceIdsont mutuellement exclusifs. -
Le groupe de sécurité et l'instance doivent se trouver dans la même région Alibaba Cloud.
-
Le groupe de sécurité et l'instance doivent avoir le même type de réseau. Si le type de réseau est VPC, ils doivent également appartenir au même VPC.
-
Vous ne pouvez ajouter une instance à un groupe de sécurité que si l'instance est dans l'état Stopped ou Running.
-
Une instance ou une interface réseau élastique peut appartenir à un maximum de cinq groupes de sécurité. Pour plus d'informations, consultez Limites des groupes de sécurité.
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
|
ecs:JoinSecurityGroup |
update |
*Instance
*SecurityGroup
|
Aucune | Aucune |
Paramètres de requête
|
Paramètre |
Type |
Requis |
Description |
Exemple |
| SecurityGroupId |
string |
Oui |
L'identifiant du groupe de sécurité. Appelez DescribeSecurityGroups pour consulter vos groupes de sécurité disponibles. |
sg-bp67acfmxazb4p**** |
| InstanceId |
string |
Non |
L'identifiant de l'instance. Remarque
Si vous spécifiez ce paramètre, vous devez laisser |
i-bp67acfmxazb4p**** |
| NetworkInterfaceId |
string |
Non |
L'identifiant de l'interface réseau élastique. Remarque
Si vous spécifiez ce paramètre, vous devez laisser |
eni-bp13kd656hxambfe**** |
| RegionId |
string |
Non |
L'identifiant de la région. Appelez DescribeRegions pour consulter la liste la plus récente des régions Alibaba Cloud.
|
cn-hangzhou |
Éléments de réponse
|
Élément |
Type |
Description |
Exemple |
|
object |
|||
| RequestId |
string |
L'identifiant de la requête. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
Exemples
JSON format
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
Codes d'erreur
|
Code de statut HTTP |
Code d'erreur |
Message d'erreur |
Description |
|---|---|---|---|
| 400 | InstanceSecurityGroupLimitExceeded | Exceeding the allowed amount of security groups that an instance can be in. | The number of security groups bound to the instance has reached the maximum limit. |
| 400 | InvalidInstanceId.Mismatch | Specified instance and security group are not in the same VPC. | The specified instance and security group do not belong to the same VPC, or one of the following cases has occurred: 1. The security group is of the VPC network type but the instance is not. 2. The instance is of the VPC network type but the security group is not. |
| 400 | InvalidInstanceId.Malformed | The specified parameter "InstanceId" is not valid. | |
| 400 | InvalidOperation.NotSupportEnterpriseGroup | The specified instance type doesn't support enterprise level security group. | |
| 400 | InvalidOperation.MultiGroupType | The specified instance can't join different types of security group. | |
| 400 | InvalidOperation.InvalidEniState | %s | The current status of the ENI does not allow modifying ENI attributes. |
| 400 | InvalidOperation.EniAndGroupNotBelongSameUser | %s | |
| 400 | NotBelongUser | %s | You are not authorized to manage the specified resource. |
| 400 | MissingParameter.RegionId | The specified RegionId should not be null. | The RegionId parameter is required. |
| 400 | InvalidStatus.EniOrInstanceIsBeingCreated | %s. | The specified ECS instance or ENI is currently being created. Please wait for the creation process to complete and try again. |
| 500 | InternalError | The request processing has failed due to some unknown error. | |
| 403 | IncorrectInstanceStatus | The current status of the resource does not support this operation. | |
| 403 | InstanceLockedForSecurity | The specified operation is denied as your instance is locked for security reasons. | The instance is locked for security reasons. Contact security technical support. |
| 403 | SecurityGroupInstanceLimitExceeded | The maximum number of instances in a security group is exceeded. | The maximum number of instances in the specified security group has been reached. |
| 403 | InvalidInstanceId.AlreadyExists | The specified instance already exists in the specified security group. | The specified instance is already present in the specified security group. |
| 403 | AclLimitExceed | %s | The number of ACL rules for an ENI or instance exceeds the upper limit. |
| 403 | InstanceSecurityGroupLimitExceeded | %s | The number of security groups bound to the instance has reached the maximum limit. |
| 403 | InvalidOperation.NetworkInterfaceCountExceeded | The maximum number of NetworkInterface in a enterprise level security group is exceeded. | The number of NICs in the specified enterprise security group exceeds the limit. |
| 403 | InvalidOperation.ResourceManagedByCloudProduct | %s | You cannot modify security groups managed by cloud services. |
| 403 | InvalidOperation.InvalidEniType | %s | The current type of the Elastic Network Interface (ENI) does not support this operation. |
| 403 | InvalidOperation.VpcMismatch | %s | The operation is invalid. Check whether the VPC in the operation corresponds to other parameters. |
| 403 | InvalidOperation.EniServiceManaged | %s | The operation is invalid. |
| 403 | InvalidParam.Malformed | %s | Invalid parameter |
| 403 | InvalidParam.EniIdAndInstanceId.Conflict | %s | The InstanceId and NetworkInterfaceId parameters are mutually exclusive and cannot be both specified. |
| 403 | Forbidden.InstanceIsBeingCreated | The specified instance is being created. | The specified instance is being created. |
| 404 | InvalidSecurityGroupId.NotFound | The specified SecurityGroupId does not exist. | The specified security group does not exist in this account. Check whether the security group ID is correct. |
| 404 | InvalidInstanceId.NotFound | The specified InstanceId does not exist. | The specified instanceId is invalid. |
| 404 | InvalidEniId.NotFound | %s | |
| 409 | InvalidOperation.Conflict | Request was denied due to conflict with a previous request, please try again later. | A conflicting task exists in the port list. |
Consultez Codes d'erreur pour la liste complète.
Notes de version
Consultez Notes de version pour la liste complète.