Use CreateNetworkAcl with a CLI
The following code examples show how to use CreateNetworkAcl.
- CLI
-
- AWS CLI
-
To create a network ACL
The following
create-network-aclexample creates a network ACL for the specified VPC.aws ec2 create-network-acl \ --vpc-idvpc-a01106c2Output:
{ "NetworkAcl": { "Associations": [], "NetworkAclId": "acl-5fb85d36", "VpcId": "vpc-a01106c2", "Tags": [], "Entries": [ { "CidrBlock": "0.0.0.0/0", "RuleNumber": 32767, "Protocol": "-1", "Egress": true, "RuleAction": "deny" }, { "CidrBlock": "0.0.0.0/0", "RuleNumber": 32767, "Protocol": "-1", "Egress": false, "RuleAction": "deny" } ], "IsDefault": false } }For more information, see Create a network ACL for your VPC
in the Amazon VPC User Guide. -
For API details, see CreateNetworkAcl
in AWS CLI Command Reference.
-
- PowerShell
-
- Tools for PowerShell V4
-
Example 1: This example creates a network ACL for the specified VPC.
New-EC2NetworkAcl -VpcId vpc-12345678Output:
Associations : {} Entries : {Amazon.EC2.Model.NetworkAclEntry, Amazon.EC2.Model.NetworkAclEntry} IsDefault : False NetworkAclId : acl-12345678 Tags : {} VpcId : vpc-12345678-
For API details, see CreateNetworkAcl
in AWS Tools for PowerShell Cmdlet Reference (V4).
-
- Tools for PowerShell V5
-
Example 1: This example creates a network ACL for the specified VPC.
New-EC2NetworkAcl -VpcId vpc-12345678Output:
Associations : {} Entries : {Amazon.EC2.Model.NetworkAclEntry, Amazon.EC2.Model.NetworkAclEntry} IsDefault : False NetworkAclId : acl-12345678 Tags : {} VpcId : vpc-12345678-
For API details, see CreateNetworkAcl
in AWS Tools for PowerShell Cmdlet Reference (V5).
-
For a complete list of AWS SDK developer guides and code examples, see Create Amazon EC2 resources using an AWS SDK. This topic also includes information about getting started and details about previous SDK versions.