Todos os produtos
Search
Central de documentação

Virtual Private Cloud:CreateNetworkAcl

Última atualização: Jul 07, 2026

Cria uma ACL de rede.

Experimente agora

Experimente esta API no OpenAPI Explorer, sem necessidade de assinatura manual. Chamadas bem-sucedidas geram automaticamente código SDK correspondente aos seus parâmetros. Faça o download com segurança de credenciais integrada para uso local.

Testar

Autorização RAM

Nenhuma autorização necessária para esta operação. Se você encontrar problemas com esta operação, entre em contato com o suporte técnico.

Parâmetros da solicitação

Parâmetro

Tipo

Obrigatório

Descrição

Exemplo

VpcId

string

Sim

O ID da nuvem privada virtual (VPC) à qual a ACL de rede pertence.

Se a VPC contiver instâncias do Elastic Compute Service (ECS) das seguintes famílias de instâncias, você deverá atualizar ou liberar as instâncias do ECS. Caso contrário, não será possível criar uma ACL de rede para a VPC.

ecs.c1, ecs.c2, ecs.c4, ecs.c5, ecs.ce4, ecs.cm4, ecs.d1, ecs.e3, ecs.e4, ecs.ga1, ecs.gn4, ecs.gn5, ecs.i1, ecs.m1, ecs.m2, ecs.mn4, ecs.n1, ecs.n2, ecs.n4, ecs.s1, ecs.s2, ecs.s3, ecs.se1, ecs.sn1, ecs.sn2, ecs.t1 e ecs.xn4.

Nota

Se a VPC contiver uma instância do ECS que não oferece suporte a ACLs de rede, atualize a instância do ECS.

vpc-dsfd34356vdf****

NetworkAclName

string

Não

O nome da ACL de rede.

O nome deve ter de 1 a 128 caracteres e não pode começar com http:// ou https://.

acl-1

Description

string

Não

A descrição da ACL de rede.

A descrição deve ter de 1 a 256 caracteres e não pode começar com http:// ou https://.

This is my NetworkAcl.

ClientToken

string

Não

O token de cliente usado para garantir a idempotência da solicitação.

Você pode usar o cliente para gerar o token, mas deve garantir que o token seja único entre diferentes solicitações. O token pode conter apenas caracteres ASCII.

Nota

Se você não especificar este parâmetro, o sistema usará automaticamente o ID da solicitação como o token de cliente. O ID da solicitação pode ser diferente para cada solicitação.

0c593ea1-3bea-11e9-b96b-88e9fe637760

DryRun

boolean

Não

Especifica se deve ser realizado apenas um dry run, sem executar a solicitação real. Valores válidos:

  • true: realiza apenas um dry run. O sistema verifica a solicitação quanto a possíveis problemas, incluindo valores de parâmetros ausentes, sintaxe de solicitação incorreta e limites de serviço. Se a solicitação falhar no dry run, uma mensagem de erro será retornada. Se a solicitação passar no dry run, o código de erro DryRunOperation será retornado.

  • false (padrão): realiza um dry run e executa a solicitação real. Se a solicitação passar no dry run, um código de status HTTP 2xx será retornado e a operação será executada.

false

Tag

array<object>

Não

As tags do recurso.

object

Não

Key

string

Não

A chave da tag N a ser adicionada ao recurso. Você pode especificar até 20 chaves de tag. A chave da tag não pode ser uma string vazia.

A chave da tag pode ter até 128 caracteres. Não pode começar com aliyun ou acs: e não pode conter http:// ou https://.

FinanceDept

Value

string

Não

O valor da tag N a ser adicionado ao recurso. Você pode especificar no máximo 20 valores de tag. O valor da tag pode ser uma string vazia.

O valor da tag pode ter até 128 caracteres e não pode conter http:// ou https://. O valor da tag não pode começar com aliyun ou acs:.

FinanceJoshua

RegionId

string

Sim

O ID da região da ACL de rede.

Você pode chamar a operação DescribeRegions para consultar a lista de regiões mais recente.

cn-hangzhou

Elementos de resposta

Elemento

Tipo

Descrição

Exemplo

object

NetworkAclId

string

O ID da ACL de rede.

nacl-a2do9e413e0spzasx****

RequestId

string

O ID da solicitação.

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

NetworkAclAttribute

object

Os atributos da ACL de rede.

Status

string

O status da ACL de rede. Valores válidos:

  • Available

  • Modifying

Modifying

VpcId

string

O ID da VPC à qual a ACL de rede pertence.

vpc-a2d33rfpl72k5xsscd****

CreationTime

string

A hora em que a ACL de rede foi criada.

2021-12-25 11:33:27

Description

string

A descrição da ACL de rede.

This is my NetworkAcl.

NetworkAclName

string

O nome da ACL de rede.

acl-1

NetworkAclId

string

O ID da ACL de rede.

nacl-a2do9e413e0spdefr****

RegionId

string

O ID da região da ACL de rede.

cn-hangzhou

IngressAclEntries

object

IngressAclEntry

array<object>

The inbound rules.

object

NetworkAclEntryId

string

The ID of the inbound rule.

nae-a2dk86arlydmexscd****

NetworkAclEntryName

string

The name of the inbound rule.

acl-3

Policy

string

The action to be performed on network traffic that matches the rule. Valid values:

  • accept

  • drop

accept

Description

string

The description of the inbound rule.

This is IngressAclEntries.

SourceCidrIp

string

The source CIDR block.

10.0.0.0/24

Protocol

string

The protocol. Valid values:

  • icmp

  • gre

  • tcp

  • udp

  • all

all

Port

string

The destination port range of the inbound traffic.

  • If the protocol of the inbound rule is set to all, icmp, or gre, the port range is -1/-1, which specifies all ports.

  • If the protocol of the inbound rule is set to tcp or udp, set the port range in the following format: 1/200 or 80/80, which specifies port 1 to port 200 or port 80. Valid ports: 1 to 65535.

-1/-1

EgressAclEntries

object

EgressAclEntry

array<object>

The outbound rules.

object

NetworkAclEntryId

string

The ID of the outbound rule.

nae-a2d447uw4tillxsdc****

NetworkAclEntryName

string

The name of the outbound rule.

acl-2

Policy

string

The action to be performed on network traffic that matches the rule. Valid values:

  • accept

  • drop

accept

Description

string

The description of the outbound rule.

This is EgressAclEntries.

Protocol

string

The protocol. Valid values:

  • icmp

  • gre

  • tcp

  • udp

  • all

all

DestinationCidrIp

string

The destination CIDR block.

10.0.0.0/24

Port

string

The destination port range of the outbound traffic.

  • If the protocol of the outbound rule is set to all, icmp, or gre, the port range is -1/-1, which specified all ports.

  • If the protocol of the outbound rule is set to tcp or udp, set the port range in the following format: 1/200 or 80/80, which specifies port 1 to port 200 or port 80. Valid values for a port: 1 to 65535.

-1/-1

Resources

object

Resource

array<object>

The information about the associated resources.

object

Status

string

The association status of the resource. Valid values:

  • BINDED

  • BINDING

  • UNBINDING

BINDED

ResourceType

string

The type of resource with which you want to associate the network ACL.

VSwitch

ResourceId

string

The ID of the associated resource.

vsw-bp1de348lntdwgthy****

Exemplos

Resposta de sucesso

JSON formato

{
  "NetworkAclId": "nacl-a2do9e413e0spzasx****",
  "RequestId": "0ED8D006-F706-4D23-88ED-E11ED28DCAC0",
  "NetworkAclAttribute": {
    "Status": "Modifying",
    "VpcId": "vpc-a2d33rfpl72k5xsscd****",
    "CreationTime": "2021-12-25 11:33:27",
    "Description": "This is my NetworkAcl.",
    "NetworkAclName": "acl-1\t",
    "NetworkAclId": "nacl-a2do9e413e0spdefr****",
    "RegionId": "cn-hangzhou\t",
    "IngressAclEntries": {
      "IngressAclEntry": [
        {
          "NetworkAclEntryId": "nae-a2dk86arlydmexscd****",
          "NetworkAclEntryName": "acl-3\t",
          "Policy": "accept",
          "Description": "This is IngressAclEntries.\t",
          "SourceCidrIp": "10.0.0.0/24\t",
          "Protocol": "all",
          "Port": "-1/-1"
        }
      ]
    },
    "EgressAclEntries": {
      "EgressAclEntry": [
        {
          "NetworkAclEntryId": "nae-a2d447uw4tillxsdc****",
          "NetworkAclEntryName": "acl-2",
          "Policy": "accept",
          "Description": "This is EgressAclEntries.",
          "Protocol": "all",
          "DestinationCidrIp": "10.0.0.0/24",
          "Port": "-1/-1\t"
        }
      ]
    },
    "Resources": {
      "Resource": [
        {
          "Status": "BINDED",
          "ResourceType": "VSwitch",
          "ResourceId": "vsw-bp1de348lntdwgthy****"
        }
      ]
    }
  }
}

Códigos de erro

Código de status HTTP

Código de erro

Mensagem de erro

Descrição

400 ParameterMissing.AliUid ParameterMissing.AliUid
400 ParameterMissing.Bid ParameterMissing.Bid
400 ParameterMissing.RegionId ParameterMissing.RegionId
400 ParameterEmpty.RegionId ParameterEmpty.RegionId
400 ParameterMissing.VpcId ParameterMissing.VpcId
400 ParameterLengthIllegal.Name ParameterLengthIllegal.Name The length of the rule name is invalid.
400 ParameterIllegal.Name ParameterIllegal.Name The name of the entry is invalid.
400 ParameterLengthIllegal.Description ParameterLengthIllegal.Description
400 ParameterIllegal.Description ParameterIllegal.Description
400 ParameterEmpty.VpcId ParameterEmpty.VpcId
400 InvalidVpcId.NotFound The vpc is not exist.
400 QuotaExceed.NetworkAcl Network acl is over limit.
400 NotSupport.NetworkAcl Network acl is not support now.
400 IllegalParamFormat.%s The param format of %s is illegal. The parameter mode is invalid.

Consulte Códigos de Erro para uma lista completa.

Notas de versão

Consulte Notas de Versão para uma lista completa.