Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
Use CreateNetworkAcl
with a CLI
The following code examples show how to use CreateNetworkAcl
.
- CLI
-
- Amazon CLI
-
To create a network ACL
This example creates a network ACL for the specified VPC.
Command:
aws ec2 create-network-acl --vpc-id vpc-a01106c2
Output:
{
"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
}
}
- PowerShell
-
- Tools for PowerShell
-
Example 1: This example creates a network ACL for the specified VPC.
New-EC2NetworkAcl -VpcId vpc-12345678
Output:
Associations : {}
Entries : {Amazon.EC2.Model.NetworkAclEntry, Amazon.EC2.Model.NetworkAclEntry}
IsDefault : False
NetworkAclId : acl-12345678
Tags : {}
VpcId : vpc-12345678
For a complete list of Amazon SDK developer guides and code examples, see
Create Amazon EC2 resources using an Amazon SDK.
This topic also includes information about getting started and details about previous SDK versions.