NetworkAclEntry

class aws_cdk.aws_ec2.NetworkAclEntry(scope, id, *, network_acl, cidr, rule_number, traffic, direction=None, network_acl_entry_name=None, rule_action=None)

Bases: Resource

Define an entry in a Network ACL table.

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ec2 as ec2

# acl_cidr: ec2.AclCidr
# acl_traffic: ec2.AclTraffic
# network_acl: ec2.NetworkAcl

network_acl_entry = ec2.NetworkAclEntry(self, "MyNetworkAclEntry",
    cidr=acl_cidr,
    network_acl=network_acl,
    rule_number=123,
    traffic=acl_traffic,

    # the properties below are optional
    direction=ec2.TrafficDirection.EGRESS,
    network_acl_entry_name="networkAclEntryName",
    rule_action=ec2.Action.ALLOW
)
Parameters:
  • scope (Construct) –

  • id (str) –

  • network_acl (INetworkAcl) – The network ACL this entry applies to.

  • 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

Methods

apply_removal_policy(policy)

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:

policy (RemovalPolicy) –

Return type:

None

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

env

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.

network_acl

The network ACL.

node

The construct tree node associated with this construct.

stack

The stack in which this resource is defined.

Static Methods

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters:

x (Any) –

Return type:

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters:

construct (IConstruct) –

Return type:

bool