NetworkAcl¶
-
class
aws_cdk.aws_ec2.
NetworkAcl
(scope, id, *, vpc, network_acl_name=None, subnet_selection=None)¶ Bases:
aws_cdk.core.Resource
(experimental) Define a new custom network ACL.
By default, will deny all inbound and outbound traffic unless entries are added explicitly allowing it.
- Stability
experimental
- Parameters
scope (
Construct
) –id (
str
) –vpc (
IVpc
) – (experimental) The VPC in which to create the NetworkACL.network_acl_name (
Optional
[str
]) – (experimental) 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
]) – (experimental) Subnets in the given VPC to associate the ACL with. More subnets can always be added later by callingassociateWithSubnets()
. Default: - No subnets associated
- Stability
experimental
Methods
-
add_entry
(id, *, cidr, rule_number, traffic, direction=None, network_acl_entry_name=None, rule_action=None)¶ (experimental) Add a new entry to the ACL.
- Parameters
id (
str
) –cidr (
AclCidr
) – (experimental) The CIDR range to allow or deny.rule_number (
Union
[int
,float
]) – (experimental) 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
) – (experimental) What kind of traffic this ACL rule applies to.direction (
Optional
[TrafficDirection
]) – (experimental) Traffic direction, with respect to the subnet, this rule applies to. Default: TrafficDirection.INGRESSnetwork_acl_entry_name (
Optional
[str
]) – (experimental) 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
]) – (experimental) 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
experimental
- Return type
-
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.DELETE
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters
policy (
RemovalPolicy
) –- Return type
None
-
associate_with_subnet
(id, *, availability_zones=None, one_per_az=None, subnet_filters=None, subnet_group_name=None, subnet_name=None, subnets=None, subnet_type=None)¶ (experimental) Associate the ACL with a given set of subnets.
- Parameters
id (
str
) –availability_zones (
Optional
[Sequence
[str
]]) – Select subnets only in the given AZs. Default: no filtering on AZs is doneone_per_az (
Optional
[bool
]) – If true, return at most one subnet per AZ. Default: falsesubnet_filters (
Optional
[Sequence
[SubnetFilter
]]) – List of provided subnet filters. Default: - nonesubnet_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, prefersubnetType
. This field does not select individual subnets, it selects all subnets that share the given subnet group name. This is the name supplied insubnetConfiguration
. At most one ofsubnetType
andsubnetGroupName
can be supplied. Default: - Selection by type instead of by namesubnet_name (
Optional
[str
]) – (deprecated) Alias forsubnetGroupName
. 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
[Sequence
[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 withsubnetType
orsubnetGroupName
. 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 ofsubnetType
andsubnetGroupName
can be supplied. Default: SubnetType.PRIVATE (or ISOLATED or PUBLIC if there are no PRIVATE subnets)
- Stability
experimental
- 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.
- Return type
-
network_acl_id
¶ (experimental) The ID of the NetworkACL.
- Stability
experimental
- Attribute
true
- Return type
str
-
network_acl_vpc_id
¶ (experimental) The VPC ID for this NetworkACL.
- Stability
experimental
- Attribute
true
- Return type
str
-
node
¶ The construct tree node associated with this construct.
- Return type
Static Methods
-
classmethod
from_network_acl_id
(scope, id, network_acl_id)¶ (experimental) Import an existing NetworkAcl into this app.
- Parameters
scope (
Construct
) –id (
str
) –network_acl_id (
str
) –
- Stability
experimental
- Return type
-
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