# SubnetMappingProperty

Specifies a subnet for a load balancer.

- Source: Generated at build time
- Type last changed: v2.168.0 · 20 Nov 2024

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_elasticloadbalancingv2 as elbv2 } from 'aws-cdk-lib';
const subnetMappingProperty: elbv2.CfnLoadBalancer.SubnetMappingProperty = {
  subnetId: 'subnetId',

  // the properties below are optional
  allocationId: 'allocationId',
  iPv6Address: 'iPv6Address',
  privateIPv4Address: 'privateIPv4Address',
  sourceNatIpv6Prefix: 'sourceNatIpv6Prefix',
};
```

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_elasticloadbalancingv2 as elbv2

subnet_mapping_property = elbv2.CfnLoadBalancer.SubnetMappingProperty(
    subnet_id="subnetId",

    # the properties below are optional
    allocation_id="allocationId",
    i_pv6_address="iPv6Address",
    private_i_pv4_address="privateIPv4Address",
    source_nat_ipv6_prefix="sourceNatIpv6Prefix"
)
```

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.elasticloadbalancingv2.*;

SubnetMappingProperty subnetMappingProperty = SubnetMappingProperty.builder()
        .subnetId("subnetId")

        // the properties below are optional
        .allocationId("allocationId")
        .iPv6Address("iPv6Address")
        .privateIPv4Address("privateIPv4Address")
        .sourceNatIpv6Prefix("sourceNatIpv6Prefix")
        .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.ElasticLoadBalancingV2;

var subnetMappingProperty = new SubnetMappingProperty {
    SubnetId = "subnetId",

    // the properties below are optional
    AllocationId = "allocationId",
    IPv6Address = "iPv6Address",
    PrivateIPv4Address = "privateIPv4Address",
    SourceNatIpv6Prefix = "sourceNatIpv6Prefix"
};
```

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"

subnetMappingProperty := &SubnetMappingProperty{
	SubnetId: jsii.String("subnetId"),

	// the properties below are optional
	AllocationId: jsii.String("allocationId"),
	IPv6Address: jsii.String("iPv6Address"),
	PrivateIPv4Address: jsii.String("privateIPv4Address"),
	SourceNatIpv6Prefix: jsii.String("sourceNatIpv6Prefix"),
}
```

## Properties

- `allocationId`: string — [Network Load Balancers] The allocation ID of the Elastic IP address for an internet-facing load balancer.

- `iPv6Address`: string — [Network Load Balancers] The IPv6 address.

- `privateIPv4Address`: string — [Network Load Balancers] The private IPv4 address for an internal load balancer.

- `sourceNatIpv6Prefix`: string — [Network Load Balancers with UDP listeners] The IPv6 prefix to use for source NAT.

  Specify an IPv6 prefix (/80 netmask) from the subnet CIDR block or `auto_assigned` to use an IPv6 prefix selected at random from the subnet CIDR block.

- `subnetId`: string (required) — The ID of the subnet.
