Skip to content
v2.278.0

NetworkAclProps Struct ​

Properties to create NetworkAcl.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';

declare const subnet: ec2.Subnet;
declare const subnetFilter: ec2.SubnetFilter;
declare const vpc: ec2.Vpc;
const networkAclProps: ec2.NetworkAclProps = {
  vpc: vpc,

  // the properties below are optional
  networkAclName: 'networkAclName',
  subnetSelection: {
    availabilityZones: ['availabilityZones'],
    onePerAz: false,
    subnetFilters: [subnetFilter],
    subnetGroupName: 'subnetGroupName',
    subnets: [subnet],
    subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
  },
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ec2 as ec2

# subnet: ec2.Subnet
# subnet_filter: ec2.SubnetFilter
# vpc: ec2.Vpc

network_acl_props = ec2.NetworkAclProps(
    vpc=vpc,

    # the properties below are optional
    network_acl_name="networkAclName",
    subnet_selection=ec2.SubnetSelection(
        availability_zones=["availabilityZones"],
        one_per_az=False,
        subnet_filters=[subnet_filter],
        subnet_group_name="subnetGroupName",
        subnets=[subnet],
        subnet_type=ec2.SubnetType.PRIVATE_ISOLATED
    )
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ec2.*;

Subnet subnet;
SubnetFilter subnetFilter;
Vpc vpc;

NetworkAclProps networkAclProps = NetworkAclProps.builder()
        .vpc(vpc)

        // the properties below are optional
        .networkAclName("networkAclName")
        .subnetSelection(SubnetSelection.builder()
                .availabilityZones(List.of("availabilityZones"))
                .onePerAz(false)
                .subnetFilters(List.of(subnetFilter))
                .subnetGroupName("subnetGroupName")
                .subnets(List.of(subnet))
                .subnetType(SubnetType.PRIVATE_ISOLATED)
                .build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EC2;

Subnet subnet;
SubnetFilter subnetFilter;
Vpc vpc;

var networkAclProps = new NetworkAclProps {
    Vpc = vpc,

    // the properties below are optional
    NetworkAclName = "networkAclName",
    SubnetSelection = new SubnetSelection {
        AvailabilityZones = new [] { "availabilityZones" },
        OnePerAz = false,
        SubnetFilters = new [] { subnetFilter },
        SubnetGroupName = "subnetGroupName",
        Subnets = new [] { subnet },
        SubnetType = SubnetType.PRIVATE_ISOLATED
    }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var subnet Subnet
var subnetFilter SubnetFilter
var vpc Vpc

networkAclProps := &NetworkAclProps{
	Vpc: vpc,

	// the properties below are optional
	NetworkAclName: jsii.String("networkAclName"),
	SubnetSelection: &SubnetSelection{
		AvailabilityZones: []*string{
			jsii.String("availabilityZones"),
		},
		OnePerAz: jsii.Boolean(false),
		SubnetFilters: []SubnetFilter{
			subnetFilter,
		},
		SubnetGroupName: jsii.String("subnetGroupName"),
		Subnets: []ISubnet{
			subnet,
		},
		SubnetType: awscdk.Aws_ec2.SubnetType_PRIVATE_ISOLATED,
	},
}

Properties ​

networkAclNameoptionalstringnetwork_acl_nameoptionalstrnetworkAclNameoptionalStringNetworkAclNameoptionalstringNetworkAclNameoptional*string #
The name of the NetworkAcl.

Default: CDK generated name

Since the NetworkAcl resource doesn't support providing a physical name, the value provided here will be recorded in the Name tag.

subnetSelectionoptionalSubnetSelectionsubnet_selectionoptionalSubnetSelectionsubnetSelectionoptionalSubnetSelectionSubnetSelectionoptionalSubnetSelectionSubnetSelectionoptionalSubnetSelection #
Subnets in the given VPC to associate the ACL with.

Default: No subnets associated

More subnets can always be added later by calling associateWithSubnets().

vpcIVpcvpcIVpcvpcIVpcVpcIVpcVpcIVpc required #
The VPC in which to create the NetworkACL.