# SubnetNetworkAclAssociationProps

Properties to create a SubnetNetworkAclAssociation.

Used as props by: [SubnetNetworkAclAssociation](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.SubnetNetworkAclAssociation.html)

- Source: [`aws-ec2/lib/network-acl.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-ec2/lib/network-acl.ts#L341)
- Type last changed: v2.224.0 · 13 Nov 2025

## Example

TypeScript:

```ts
// 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';
import { aws_ec2 as interfaces_ec2 } from 'aws-cdk-lib/interfaces';

declare const networkAclRef: interfaces_ec2.INetworkAclRef;
declare const subnet: ec2.Subnet;
const subnetNetworkAclAssociationProps: ec2.SubnetNetworkAclAssociationProps = {
  networkAcl: networkAclRef,
  subnet: subnet,

  // the properties below are optional
  subnetNetworkAclAssociationName: 'subnetNetworkAclAssociationName',
};
```

Python:

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

# network_acl_ref: interfaces_ec2.INetworkAclRef
# subnet: ec2.Subnet

subnet_network_acl_association_props = ec2.SubnetNetworkAclAssociationProps(
    network_acl=network_acl_ref,
    subnet=subnet,

    # the properties below are optional
    subnet_network_acl_association_name="subnetNetworkAclAssociationName"
)
```

Java:

```java
// 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.*;
import software.amazon.awscdk.interfaces.ec2.*;

INetworkAclRef networkAclRef;
Subnet subnet;

SubnetNetworkAclAssociationProps subnetNetworkAclAssociationProps = SubnetNetworkAclAssociationProps.builder()
        .networkAcl(networkAclRef)
        .subnet(subnet)

        // the properties below are optional
        .subnetNetworkAclAssociationName("subnetNetworkAclAssociationName")
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EC2;
using Amazon.CDK.Interfaces.EC2;

INetworkAclRef networkAclRef;
Subnet subnet;

var subnetNetworkAclAssociationProps = new SubnetNetworkAclAssociationProps {
    NetworkAcl = networkAclRef,
    Subnet = subnet,

    // the properties below are optional
    SubnetNetworkAclAssociationName = "subnetNetworkAclAssociationName"
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var networkAclRef INetworkAclRef
var subnet Subnet

subnetNetworkAclAssociationProps := &SubnetNetworkAclAssociationProps{
	NetworkAcl: networkAclRef,
	Subnet: subnet,

	// the properties below are optional
	SubnetNetworkAclAssociationName: jsii.String("subnetNetworkAclAssociationName"),
}
```

## Properties

- `networkAcl`: [INetworkAclRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_ec2.INetworkAclRef.html) (required) — The Network ACL this association is defined for.

- `subnet`: [ISubnet](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.ISubnet.html) (required) — ID of the Subnet.

- `subnetNetworkAclAssociationName`: string — The name of the SubnetNetworkAclAssociation.

  **Default:** If you don't specify a SubnetNetworkAclAssociationName, AWS CloudFormation generates a unique physical ID and uses that ID for the group name.

  It is not recommended to use an explicit name.
