Crea un security group.
Descripción de la operación
La política de conectividad interna predeterminada para un security group básico creado mediante esta operación es conectividad dentro del grupo. Puede modificar esta política llamando a ModifySecurityGroupPolicy.
La política de conectividad interna predeterminada para un security group avanzado creado mediante esta operación es aislamiento interno, y esta política no se puede modificar.
El número de security groups en una sola región es limitado. Puede crear un mínimo de 100 security groups. Para obtener más información, consulte Límites de security groups.
Para crear un security group de tipo VPC, debe especificar el parámetro VpcId.
Pruébelo ahora
Test
Autorización de RAM
|
Action |
Nivel de acceso |
Tipo de recurso |
Clave de condición |
Acción dependiente |
|
ecs:CreateSecurityGroup |
create |
*SecurityGroup
*VPC
|
Ninguna | Ninguna |
Parámetros de la solicitud
|
Parámetro |
Tipo |
Obligatorio |
Descripción |
Ejemplo |
| RegionId |
string |
Sí |
El ID de la región del security group. Puede llamar a DescribeRegions para consultar la lista de regiones más reciente. |
cn-hangzhou |
| Description |
string |
No |
La descripción del security group. La descripción debe tener entre 2 y 256 caracteres de longitud y no puede comenzar con Valor predeterminado: vacío. |
testDescription |
| ClientToken |
string |
No |
El token de cliente que se utiliza para garantizar la idempotencia de la solicitud. Puede utilizar el cliente para generar el token, pero asegúrese de que el token sea único entre diferentes solicitudes. El valor de ClientToken solo puede contener caracteres ASCII y no puede exceder los 64 caracteres de longitud. Para obtener más información, consulte Cómo garantizar la idempotencia. |
123e4567-e89b-12d3-a456-426655440000 |
| SecurityGroupName |
string |
No |
El nombre del security group. El nombre debe tener entre 2 y 128 caracteres de longitud y debe comenzar con una letra o un carácter chino. No puede comenzar con |
testSecurityGroupName |
| VpcId |
string |
No |
El ID de la VPC a la que pertenece el security group. |
vpc-bp1opxu1zkhn00gzv**** |
| SecurityGroupType |
string |
No |
El tipo de security group. Valores válidos:
Valor predeterminado: normal. |
enterprise |
| ServiceManaged |
boolean |
No |
Este parámetro no está disponible públicamente. |
false |
| ResourceGroupId |
string |
No |
El ID del grupo de recursos al que pertenece el security group. |
rg-bp67acfmxazb4p**** |
| Tag |
array<object> |
No |
Las etiquetas que se vincularán al security group. Longitud de la matriz: 0 a 20. |
|
|
object |
No |
La etiqueta que se vinculará al security group. |
||
| key |
string |
No |
La clave de etiqueta del security group. Nota
Para mejorar la compatibilidad, utilice el parámetro Tag.N.Key. |
null |
| Key |
string |
No |
La clave de etiqueta del security group. La clave de etiqueta no puede ser una cadena vacía. La clave de etiqueta puede tener hasta 128 caracteres de longitud y no puede comenzar con |
TestKey |
| Value |
string |
No |
El valor de etiqueta del security group. El valor de etiqueta puede ser una cadena vacía. El valor de etiqueta puede tener hasta 128 caracteres de longitud y no puede contener |
TestValue |
| value |
string |
No |
El valor de etiqueta del security group. Nota
Para mejorar la compatibilidad, utilice el parámetro Tag.N.Value. |
null |
Elementos de la respuesta
|
Elemento |
Tipo |
Descripción |
Ejemplo |
|
object |
|||
| SecurityGroupId |
string |
El ID del security group. |
sg-bp1fg655nh68xyz9**** |
| RequestId |
string |
El ID de la solicitud. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
Ejemplos
Respuesta exitosa
JSON Formato
{
"SecurityGroupId": "sg-bp1fg655nh68xyz9****",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
Códigos de error
|
Código de estado HTTP |
Código de error |
Mensaje de error |
Descripción |
|---|---|---|---|
| 400 | InvalidDescription.Malformed | The specified parameter "Description" is not valid. | The source description can be 2 to 256 characters in length. It cannot start with http:// and https://. |
| 400 | InvalidSecurityGroupDiscription.Malformed | Specified security group description is not valid. | The specified security group description is invalid. |
| 400 | IncorrectVpcStatus | Current VPC status does not support this operation. | The VPC is in a state that does not support the current operation. |
| 400 | InvalidTagKey.Malformed | Specified tag key is not valid. | The specified tag key is invalid. |
| 400 | InvalidTagValue.Malformed | Specified tag value is not valid. | The specified tag value is invalid. |
| 400 | Duplicate.TagKey | The Tag.N.Key contain duplicate key. | The specified tag key already exists. Tag keys must be unique. |
| 400 | InvalidParams.GroupType | The specified security group type is not valid. | The specified SecurityGroupType parameter is invalid. |
| 400 | InvalidParams.VpcIdGroupType | Only VPC instance supports enterprise level security group. | Only ECS instances that reside in VPCs support advanced security groups. |
| 400 | InvalidSecurityGroupName.Malformed | The specified parameter SecurityGroupName is not valid. | The specified SecurityGroupName parameter is not valid. This parameter is empty by default. If you specify a security group name, the name must be 2 to 128 characters in length and start with a letter. It can contain letters, digits, periods (.), underscores (_), and hyphens (-) and cannot start with http:// or https. The security group name is displayed in the ECS console. |
| 500 | InternalError | The request processing has failed due to some unknown error. | |
| 500 | ServiceUnavailable | The service is unavailable, please try again later. | The request timed out. Try again. |
| 403 | QuotaExceed.SecurityGroup | The maximum number of security groups is reached. | The maximum number of security groups has been reached. |
| 403 | InvalidVpcId.NotFound | The VpcId must not empty when only support vpc vm. | A VPC ID must be specified. |
| 403 | IncorrectVpcStatus | Current VPC status does not support this operation. | |
| 403 | IdempotentProcessing | The previous idempotent request(s) is still processing. | A previous idempotent request is being processed. Try again later. |
| 403 | QuotaExceed.Tags | %s | The number of specified tags exceeds the upper limit. %s is a variable. An error message is dynamically returned based on call conditions. |
| 403 | InvalidOperation.ResourceManagedByCloudProduct | %s | You cannot modify security groups managed by cloud services. |
| 404 | InvalidRegionId.NotFound | The specified region does not exist. | The specified RegionId parameter does not exist. Check whether the service is available in the specified region. |
| 404 | InvalidVpcId.NotFound | Specified VPC does not exist. | The specified VPC ID does not exist. |
| 404 | InvalidResourceGroup.NotFound | The ResourceGroup provided does not exist in our records. | The specified resource group does not exist. |
Consulte Códigos de error para ver la lista completa.
Notas de la versión
Consulte Notas de la versión para ver la lista completa.