Adiciona uma instância ECS ou uma interface de rede elástica a um grupo de segurança.
Descrição da operação
Esta API foi descontinuada. Recomendamos chamar a operação ModifyInstanceAttribute para adicionar ou remover uma instância ECS de um grupo de segurança, ou chamar a operação ModifyNetworkInterfaceAttribute para adicionar ou remover uma interface de rede elástica (ENI) de um grupo de segurança.
-
Você não pode adicionar uma instância e uma interface de rede elástica a um grupo de segurança na mesma chamada. Os parâmetros
InstanceIdeNetworkInterfaceIdsão mutuamente exclusivos. -
O grupo de segurança e a instância devem estar na mesma região da Alibaba Cloud.
-
O grupo de segurança e a instância devem ter o mesmo tipo de rede. Se o tipo de rede for VPC, eles também devem pertencer à mesma VPC.
-
Você pode adicionar uma instância a um grupo de segurança somente se a instância estiver no estado Stopped ou Running.
-
Uma instância ou uma interface de rede elástica pode pertencer a no máximo cinco grupos de segurança. Para mais informações, consulte Limitações de grupos de segurança.
Experimente agora
Testar
Autorização RAM
|
Ação |
Nível de acesso |
Tipo de recurso |
Chave de condição |
Ação dependente |
|
ecs:JoinSecurityGroup |
update |
*Instance
*SecurityGroup
|
Nenhuma | Nenhuma |
Parâmetros da solicitação
|
Parâmetro |
Tipo |
Obrigatório |
Descrição |
Exemplo |
| SecurityGroupId |
string |
Sim |
O ID do grupo de segurança. Chame DescribeSecurityGroups para visualizar seus grupos de segurança disponíveis. |
sg-bp67acfmxazb4p**** |
| InstanceId |
string |
Não |
O ID da instância. Nota
Se você especificar este parâmetro, deverá deixar |
i-bp67acfmxazb4p**** |
| NetworkInterfaceId |
string |
Não |
O ID da interface de rede elástica. Nota
Se você especificar este parâmetro, deverá deixar |
eni-bp13kd656hxambfe**** |
| RegionId |
string |
Não |
O ID da região. Chame DescribeRegions para visualizar a lista mais recente de regiões da Alibaba Cloud.
|
cn-hangzhou |
Elementos de resposta
|
Elemento |
Tipo |
Descrição |
Exemplo |
|
object |
|||
| RequestId |
string |
O ID da solicitação. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
Exemplos
Resposta de sucesso
JSON formato
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
Códigos de erro
|
Código de status HTTP |
Código de erro |
Mensagem de erro |
Descrição |
|---|---|---|---|
| 400 | InstanceSecurityGroupLimitExceeded | Exceeding the allowed amount of security groups that an instance can be in. | |
| 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 | |
| 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. | |
| 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 | |
| 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 | |
| 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. |
Consulte Códigos de Erro para uma lista completa.
Notas de versão
Consulte Notas de Versão para uma lista completa.