NetworkAcl

class aws_cdk.aws_ec2.NetworkAcl(scope, id, *, vpc, network_acl_name=None, subnet_selection=None)

Bases: aws_cdk.core.Resource

Define a new custom network ACL.

By default, will deny all inbound and outbound traffic unless entries are added explicitly allowing it.

stability :stability: experimental

__init__(scope, id, *, vpc, network_acl_name=None, subnet_selection=None)
Parameters
  • scope (Construct) –

  • id (str) –

  • props

  • vpc (IVpc) – The VPC in which to create the NetworkACL.

  • network_acl_name (Optional[str]) – The name of the NetworkAcl. It is not recommended to use an explicit name. Default: If you don’t specify a networkAclName, AWS CloudFormation generates a unique physical ID and uses that ID for the group name.

  • subnet_selection (Optional[SubnetSelection]) – Subnets in the given VPC to associate the ACL with. More subnets can always be added later by calling associateWithSubnets(). Default: - No subnets associated

stability :stability: experimental

Return type

None

Methods

add_entry(id, *, cidr, rule_number, traffic, direction=None, network_acl_entry_name=None, rule_action=None)

Add a new entry to the ACL.

Parameters
  • id (str) –

  • options

  • cidr (AclCidr) – The CIDR range to allow or deny.

  • rule_number (Union[int, float]) – Rule number to assign to the entry, such as 100. ACL entries are processed in ascending order by rule number. Entries can’t use the same rule number unless one is an egress rule and the other is an ingress rule.

  • traffic (AclTraffic) – What kind of traffic this ACL rule applies to.

  • direction (Optional[TrafficDirection]) – Traffic direction, with respect to the subnet, this rule applies to. Default: TrafficDirection.INGRESS

  • network_acl_entry_name (Optional[str]) – The name of the NetworkAclEntry. It is not recommended to use an explicit group name. Default: If you don’t specify a NetworkAclName, AWS CloudFormation generates a unique physical ID and uses that ID for the group name.

  • rule_action (Optional[Action]) – Whether to allow or deny traffic that matches the rule; valid values are “allow” or “deny”. Any traffic that is not explicitly allowed is automatically denied in a custom ACL, all traffic is automatically allowed in a default ACL. Default: ALLOW

stability :stability: experimental

Return type

NetworkAclEntry

associate_with_subnet(id, *, one_per_az=None, subnet_group_name=None, subnet_name=None, subnets=None, subnet_type=None)

Associate the ACL with a given set of subnets.

Parameters
  • id (str) –

  • selection

  • one_per_az (Optional[bool]) – If true, return at most one subnet per AZ. Default: false

  • subnet_group_name (Optional[str]) – Select the subnet group with the given name. Select the subnet group with the given name. This only needs to be used if you have multiple subnet groups of the same type and you need to distinguish between them. Otherwise, prefer subnetType. This field does not select individual subnets, it selects all subnets that share the given subnet group name. This is the name supplied in subnetConfiguration. At most one of subnetType and subnetGroupName can be supplied. Default: - Selection by type instead of by name

  • subnet_name (Optional[str]) – Alias for subnetGroupName. Select the subnet group with the given name. This only needs to be used if you have multiple subnet groups of the same type and you need to distinguish between them.

  • subnets (Optional[List[ISubnet]]) – Explicitly select individual subnets. Use this if you don’t want to automatically use all subnets in a group, but have a need to control selection down to individual subnets. Cannot be specified together with subnetType or subnetGroupName. Default: - Use all subnets in a selected group (all private subnets by default)

  • subnet_type (Optional[SubnetType]) – Select all subnets of the given type. At most one of subnetType and subnetGroupName can be supplied. Default: SubnetType.PRIVATE (or ISOLATED or PUBLIC if there are no PRIVATE subnets)

stability :stability: experimental

Return type

None

to_string()

Returns a string representation of this construct.

Return type

str

Attributes

network_acl_id

The ID of the NetworkACL.

stability :stability: experimental attribute: :attribute:: true

Return type

str

network_acl_vpc_id

The VPC ID for this NetworkACL.

stability :stability: experimental attribute: :attribute:: true

Return type

str

node

Construct tree node which offers APIs for interacting with the construct tree.

Return type

ConstructNode

stack

The stack in which this resource is defined.

Return type

Stack

Static Methods

classmethod from_network_acl_id(scope, id, network_acl_id)

Import an existing NetworkAcl into this app.

Parameters
  • scope (Construct) –

  • id (str) –

  • network_acl_id (str) –

stability :stability: experimental

Return type

INetworkAcl

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool