| Did this page help you? Yes No Tell us about it... |
Creates an entry (i.e., rule) in a network ACL with a rule number you specify. Each network ACL has a set of numbered ingress rules and a separate set of numbered egress rules. When determining whether a packet should be allowed in or out of a subnet, Amazon VPC processes the entries in the ACL according to the rule numbers, in ascending order. Each network ACL has a set of ingress rules and a separate set of egress rules.
![]() | Important |
|---|---|
We recommend that you leave room between the rule numbers (e.g., 100, 110, 120, etc.), and not number them one right after the other (e.g., 101, 102, 103, etc.). This allows you to easily add a new rule between existing ones without having to renumber the rules. |
After you add an entry, you can't modify it; you must either replace it or create a new entry and delete the old one.
For more information about network ACLs, go to Network ACLs in the Amazon Virtual Private Cloud User Guide.
The short version of this command is ec2addnae.
ec2-create-network-acl-entry
acl_id -n rule_number [--egress] -P protocol -r
cidr [-p port_range] [-t icmp_type_code] {
--allow | --deny }
| Name | Description | Required |
|---|---|---|
|
|
ID of the ACL where the entry will be created. Type: String Default: None Example: acl-5fb85d36 |
Yes |
|
|
Rule number to assign to the entry (e.g., 100). ACL entries are processed in ascending order by rule number. Type: Number Default: None Constraints: Positive integer from 1 to 32766 Example: -n 100 |
Yes |
--egress
|
Optional flag to designate the rule be applied to traffic leaving the subnet. Default: If not specified, rule applies to ingress traffic into the subnet. | No |
|
|
IP protocol. You can specify Type: String Valid Values: Example: -P 6 |
Yes |
-r, --cidr
cidr
|
The CIDR range to allow or deny, in CIDR notation. Type: String Default: None Example: -r 172.16.0.0/24 | Yes |
|
|
For the TCP or UDP protocols, this specifies the range of ports to allow. Type: String Default: None Valid Values: A single integer or a range (min-max). You can specify -1 to mean all ports (i.e. port range 0-65535). Condition: Required if specifying Example: -p 80-84 |
Conditional |
|
|
For the ICMP protocol, this specifies the ICMP type and code using format Type: String Default: None Condition: Required if specifying Example: -t -1:-1 |
Conditional |
|
|
Specifies that any traffic matching the rule is allowed. Condition: Either --allow or --deny must be specified, but not both. |
Conditional |
|
|
Specifies that any traffic matching the rule is denied. Condition: Either --allow or --deny must be specified, but not both. |
Conditional |
| Option | Description |
|---|---|
|
|
Overrides the Region specified in the Default: The Example: |
|
|
Default: The Example: |
|
|
The private key to use when constructing requests to Amazon EC2. Default: The value of the Example: |
|
|
The X.509 certificate to use when constructing requests to Amazon EC2. Default: The value of the Example: |
|
|
Specifies a connection timeout (in seconds). Example: --connection-timeout 30 |
|
|
Specifies a request timeout (in seconds). Example: --request-timeout 45 |
|
|
Displays verbose output by showing the SOAP request and response on the command line. This is particularly useful if you are building tools to talk directly to our SOAP API. |
|
|
Displays column headers in the output. |
|
|
Shows empty columns as |
|
|
Do not display tags for tagged resources. |
|
|
Prints internal debugging information. This is useful to assist us when troubleshooting problems. |
|
|
Displays Help. |
|
|
If Example: |
The command returns a table that contains the following information:
Boolean true or false
Amazon EC2 command line tools display errors on stderr.
This example creates an entry with rule number 100 in the network ACL with ID acl-2cb85d45. The rule allows ingress traffic from anywhere (0.0.0.0/0) on UDP port 53 into the subnet.
PROMPT> ec2-create-network-acl-entry acl-2cb85d45 -n 100 -r 0.0.0.0/0 -P udp -p 53 --allow
ENTRY ingress 100 allow 0.0.0.0/0 udp 53 53