DescribeNetworkAclsÚselo con un AWS SDK o CLI - Ejemplos de código de AWS SDK

Hay más AWS SDK ejemplos disponibles en el GitHub repositorio de AWS Doc SDK Examples.

Las traducciones son generadas a través de traducción automática. En caso de conflicto entre la traducción y la version original de inglés, prevalecerá la version en inglés.

DescribeNetworkAclsÚselo con un AWS SDK o CLI

En los siguientes ejemplos de código, se muestra cómo utilizar DescribeNetworkAcls.

CLI
AWS CLI

Para describir su red ACLs

En el siguiente describe-network-acls ejemplo, se recuperan los detalles de la redACLs.

aws ec2 describe-network-acls

Salida:

{ "NetworkAcls": [ { "Associations": [ { "NetworkAclAssociationId": "aclassoc-0c1679dc41EXAMPLE", "NetworkAclId": "acl-0ea1f54ca7EXAMPLE", "SubnetId": "subnet-0931fc2fa5EXAMPLE" } ], "Entries": [ { "CidrBlock": "0.0.0.0/0", "Egress": true, "Protocol": "-1", "RuleAction": "allow", "RuleNumber": 100 }, { "CidrBlock": "0.0.0.0/0", "Egress": true, "Protocol": "-1", "RuleAction": "deny", "RuleNumber": 32767 }, { "CidrBlock": "0.0.0.0/0", "Egress": false, "Protocol": "-1", "RuleAction": "allow", "RuleNumber": 100 }, { "CidrBlock": "0.0.0.0/0", "Egress": false, "Protocol": "-1", "RuleAction": "deny", "RuleNumber": 32767 } ], "IsDefault": true, "NetworkAclId": "acl-0ea1f54ca7EXAMPLE", "Tags": [], "VpcId": "vpc-06e4ab6c6cEXAMPLE", "OwnerId": "111122223333" }, { "Associations": [], "Entries": [ { "CidrBlock": "0.0.0.0/0", "Egress": true, "Protocol": "-1", "RuleAction": "allow", "RuleNumber": 100 }, { "Egress": true, "Ipv6CidrBlock": "::/0", "Protocol": "-1", "RuleAction": "allow", "RuleNumber": 101 }, { "CidrBlock": "0.0.0.0/0", "Egress": true, "Protocol": "-1", "RuleAction": "deny", "RuleNumber": 32767 }, { "Egress": true, "Ipv6CidrBlock": "::/0", "Protocol": "-1", "RuleAction": "deny", "RuleNumber": 32768 }, { "CidrBlock": "0.0.0.0/0", "Egress": false, "Protocol": "-1", "RuleAction": "allow", "RuleNumber": 100 }, { "Egress": false, "Ipv6CidrBlock": "::/0", "Protocol": "-1", "RuleAction": "allow", "RuleNumber": 101 }, { "CidrBlock": "0.0.0.0/0", "Egress": false, "Protocol": "-1", "RuleAction": "deny", "RuleNumber": 32767 }, { "Egress": false, "Ipv6CidrBlock": "::/0", "Protocol": "-1", "RuleAction": "deny", "RuleNumber": 32768 } ], "IsDefault": true, "NetworkAclId": "acl-0e2a78e4e2EXAMPLE", "Tags": [], "VpcId": "vpc-03914afb3eEXAMPLE", "OwnerId": "111122223333" } ] }

Para obtener más información, consulte Red ACLs en la Guía del AWS VPC usuario.

  • Para API obtener más información, consulte DescribeNetworkAclsla Referencia de AWS CLI comandos.

PowerShell
Herramientas para PowerShell

Ejemplo 1: en este ejemplo se describe la red especificadaACL.

Get-EC2NetworkAcl -NetworkAclId acl-12345678

Salida:

Associations : {aclassoc-1a2b3c4d} Entries : {Amazon.EC2.Model.NetworkAclEntry, Amazon.EC2.Model.NetworkAclEntry} IsDefault : False NetworkAclId : acl-12345678 Tags : {Name} VpcId : vpc-12345678

Ejemplo 2: en este ejemplo se describen las reglas de la red especificadaACL.

(Get-EC2NetworkAcl -NetworkAclId acl-12345678).Entries

Salida:

CidrBlock : 0.0.0.0/0 Egress : True IcmpTypeCode : PortRange : Protocol : -1 RuleAction : deny RuleNumber : 32767 CidrBlock : 0.0.0.0/0 Egress : False IcmpTypeCode : PortRange : Protocol : -1 RuleAction : deny RuleNumber : 32767

Ejemplo 3: En este ejemplo se describe toda la redACLs.

Get-EC2NetworkAcl
  • Para API obtener más información, consulte DescribeNetworkAclsla referencia de AWS Tools for PowerShell cmdlets.