Class NetworkAcl

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

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:39.479Z") @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")
                 .subnetName("subnetName")
                 .subnets(List.of(subnet))
                 .subnetType(SubnetType.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.