Class NetworkAcl

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.ec2.NetworkAcl
All Implemented Interfaces:
IResource, INetworkAcl, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-08T21:35:06.228Z") @Stability(Stable) public class NetworkAcl extends Resource implements INetworkAcl
Define a new custom network ACL.

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

Example:

 // 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;
 NetworkAcl networkAcl = NetworkAcl.Builder.create(this, "MyNetworkAcl")
         .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();
 
  • Constructor Details

    • NetworkAcl

      protected NetworkAcl(software.amazon.jsii.JsiiObjectRef objRef)
    • NetworkAcl

      protected NetworkAcl(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • NetworkAcl

      @Stability(Stable) public NetworkAcl(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull NetworkAclProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • fromNetworkAclId

      @Stability(Stable) @NotNull public static INetworkAcl fromNetworkAclId(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String networkAclId)
      Import an existing NetworkAcl into this app.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      networkAclId - This parameter is required.
    • addEntry

      @Stability(Stable) @NotNull public NetworkAclEntry addEntry(@NotNull String id, @NotNull CommonNetworkAclEntryOptions options)
      Add a new entry to the ACL.

      Specified by:
      addEntry in interface INetworkAcl
      Parameters:
      id - This parameter is required.
      options - This parameter is required.
    • associateWithSubnet

      @Stability(Stable) public void associateWithSubnet(@NotNull String id, @NotNull SubnetSelection selection)
      Associate the ACL with a given set of subnets.

      Parameters:
      id - This parameter is required.
      selection - This parameter is required.
    • getNetworkAclId

      @Stability(Stable) @NotNull public String getNetworkAclId()
      The ID of the NetworkACL.
      Specified by:
      getNetworkAclId in interface INetworkAcl
    • getNetworkAclVpcId

      @Stability(Stable) @NotNull public String getNetworkAclVpcId()
      The VPC ID for this NetworkACL.