class NetworkAclEntry (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.EC2.NetworkAclEntry |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsec2#NetworkAclEntry |
Java | software.amazon.awscdk.services.ec2.NetworkAclEntry |
Python | aws_cdk.aws_ec2.NetworkAclEntry |
TypeScript (source) | aws-cdk-lib » aws_ec2 » NetworkAclEntry |
Implements
IConstruct
, IDependable
, IResource
, INetwork
Define an entry in a Network ACL table.
Example
// 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 aclCidr: ec2.AclCidr;
declare const aclTraffic: ec2.AclTraffic;
declare const networkAcl: ec2.NetworkAcl;
const networkAclEntry = new ec2.NetworkAclEntry(this, 'MyNetworkAclEntry', {
cidr: aclCidr,
networkAcl: networkAcl,
ruleNumber: 123,
traffic: aclTraffic,
// the properties below are optional
direction: ec2.TrafficDirection.EGRESS,
networkAclEntryName: 'networkAclEntryName',
ruleAction: ec2.Action.ALLOW,
});
Initializer
new NetworkAclEntry(scope: Construct, id: string, props: NetworkAclEntryProps)
Parameters
- scope
Construct
- id
string
- props
Network
Acl Entry Props
Construct Props
Name | Type | Description |
---|---|---|
cidr | Acl | The CIDR range to allow or deny. |
network | INetwork | The network ACL this entry applies to. |
rule | number | Rule number to assign to the entry, such as 100. |
traffic | Acl | What kind of traffic this ACL rule applies to. |
direction? | Traffic | Traffic direction, with respect to the subnet, this rule applies to. |
network | string | The name of the NetworkAclEntry. |
rule | Action | Whether to allow or deny traffic that matches the rule; valid values are "allow" or "deny". |
cidr
Type:
Acl
The CIDR range to allow or deny.
networkAcl
Type:
INetwork
The network ACL this entry applies to.
ruleNumber
Type:
number
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
Type:
Acl
What kind of traffic this ACL rule applies to.
direction?
Type:
Traffic
(optional, default: TrafficDirection.INGRESS)
Traffic direction, with respect to the subnet, this rule applies to.
networkAclEntryName?
Type:
string
(optional, default: If you don't specify a NetworkAclName, AWS CloudFormation generates a
unique physical ID and uses that ID for the group name.)
The name of the NetworkAclEntry.
It is not recommended to use an explicit group name.
ruleAction?
Type:
Action
(optional, default: ALLOW)
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.
Properties
Name | Type | Description |
---|---|---|
env | Resource | The environment this resource belongs to. |
network | INetwork | The network ACL. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
env
Type:
Resource
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.
networkAcl
Type:
INetwork
The network ACL.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
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
).
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.