Skip to content
v2.274.0

SubnetMapping Struct ​

Specifies a subnet for a load balancer.

Example ​

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_elasticloadbalancingv2 as elbv2 } from 'aws-cdk-lib';

declare const sourceNatIpv6Prefix: elbv2.SourceNatIpv6Prefix;
declare const subnet: ec2.Subnet;
const subnetMapping: elbv2.SubnetMapping = {
  subnet: subnet,

  // the properties below are optional
  allocationId: 'allocationId',
  ipv6Address: 'ipv6Address',
  privateIpv4Address: 'privateIpv4Address',
  sourceNatIpv6Prefix: sourceNatIpv6Prefix,
};

Properties ​

allocationIdoptionalstringallocation_idoptionalstrallocationIdoptionalStringAllocationIdoptionalstringAllocationIdoptional*string#
The allocation ID of the Elastic IP address for an internet-facing load balancer.

Default: undefined - AWS default is to allocate a new IP address for internet-facing load balancers

ipv6Addressoptionalstringipv6_addressoptionalstripv6AddressoptionalStringIpv6AddressoptionalstringIpv6Addressoptional*string#
The IPv6 address.

Default: undefined - AWS default is to allocate an IPv6 address from the subnet's pool

privateIpv4Addressoptionalstringprivate_ipv4_addressoptionalstrprivateIpv4AddressoptionalStringPrivateIpv4AddressoptionalstringPrivateIpv4Addressoptional*string#
The private IPv4 address for an internal load balancer.

Default: undefined - AWS default is to allocate a private IPv4 address from the subnet's pool

sourceNatIpv6PrefixoptionalSourceNatIpv6Prefixsource_nat_ipv6_prefixoptionalSourceNatIpv6PrefixsourceNatIpv6PrefixoptionalSourceNatIpv6PrefixSourceNatIpv6PrefixoptionalSourceNatIpv6PrefixSourceNatIpv6PrefixoptionalSourceNatIpv6Prefix#
The IPv6 prefix to use for source NAT for a dual-stack network load balancer with UDP listeners.

Default: undefined - AWS default is SourceNatIpv6Prefix.autoAssigned() for IPv6 load balancers

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

subnetISubnetsubnetISubnetsubnetISubnetSubnetISubnetSubnetISubnetrequired#
The subnet.