PublicSubnetProps Struct
| Source | aws-ec2/lib/vpc.ts |
|---|
Example
// 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 iPAMPoolRef: interfaces_ec2.IIPAMPoolRef;
const publicSubnetProps: ec2.PublicSubnetProps = {
availabilityZone: 'availabilityZone',
vpcId: 'vpcId',
// the properties below are optional
assignIpv6AddressOnCreation: false,
cidrBlock: 'cidrBlock',
ipv4IpamAllocation: {
ipamPool: iPAMPoolRef,
netmaskLength: 123,
},
ipv6CidrBlock: 'ipv6CidrBlock',
mapPublicIpOnLaunch: false,
};
# 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
# i_pam_pool_ref: interfaces_ec2.IIPAMPoolRef
public_subnet_props = ec2.PublicSubnetProps(
availability_zone="availabilityZone",
vpc_id="vpcId",
# the properties below are optional
assign_ipv6_address_on_creation=False,
cidr_block="cidrBlock",
ipv4_ipam_allocation=ec2.SubnetIpv4IpamAllocation(
ipam_pool=i_pam_pool_ref,
netmask_length=123
),
ipv6_cidr_block="ipv6CidrBlock",
map_public_ip_on_launch=False
)
// 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.*;
IIPAMPoolRef iPAMPoolRef;
PublicSubnetProps publicSubnetProps = PublicSubnetProps.builder()
.availabilityZone("availabilityZone")
.vpcId("vpcId")
// the properties below are optional
.assignIpv6AddressOnCreation(false)
.cidrBlock("cidrBlock")
.ipv4IpamAllocation(SubnetIpv4IpamAllocation.builder()
.ipamPool(iPAMPoolRef)
.netmaskLength(123)
.build())
.ipv6CidrBlock("ipv6CidrBlock")
.mapPublicIpOnLaunch(false)
.build();
// 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;
IIPAMPoolRef iPAMPoolRef;
var publicSubnetProps = new PublicSubnetProps {
AvailabilityZone = "availabilityZone",
VpcId = "vpcId",
// the properties below are optional
AssignIpv6AddressOnCreation = false,
CidrBlock = "cidrBlock",
Ipv4IpamAllocation = new SubnetIpv4IpamAllocation {
IpamPool = iPAMPoolRef,
NetmaskLength = 123
},
Ipv6CidrBlock = "ipv6CidrBlock",
MapPublicIpOnLaunch = false
};
// 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 iPAMPoolRef IIPAMPoolRef
publicSubnetProps := &PublicSubnetProps{
AvailabilityZone: jsii.String("availabilityZone"),
VpcId: jsii.String("vpcId"),
// the properties below are optional
AssignIpv6AddressOnCreation: jsii.Boolean(false),
CidrBlock: jsii.String("cidrBlock"),
Ipv4IpamAllocation: &SubnetIpv4IpamAllocation{
IpamPool: iPAMPoolRef,
NetmaskLength: jsii.Number(123),
},
Ipv6CidrBlock: jsii.String("ipv6CidrBlock"),
MapPublicIpOnLaunch: jsii.Boolean(false),
}
Properties
assignIpv6AddressOnCreationoptionalbooleanassign_ipv6_address_on_creationoptionalboolassignIpv6AddressOnCreationoptionalBooleanAssignIpv6AddressOnCreationoptionalboolAssignIpv6AddressOnCreationoptional*bool = false #If you specify AssignIpv6AddressOnCreation, you must also specify Ipv6CidrBlock.
availabilityZonestringavailability_zonestravailabilityZoneStringAvailabilityZonestringAvailabilityZone*string required #cidrBlockoptionalstringcidr_blockoptionalstrcidrBlockoptionalStringCidrBlockoptionalstringCidrBlockoptional*string #Default: the CIDR block is allocated from the IPAM pool given in ipv4IpamAllocation
Exactly one of cidrBlock and ipv4IpamAllocation must be specified.
ipv4IpamAllocationoptionalSubnetIpv4IpamAllocationipv4_ipam_allocationoptionalSubnetIpv4IpamAllocationipv4IpamAllocationoptionalSubnetIpv4IpamAllocationIpv4IpamAllocationoptionalSubnetIpv4IpamAllocationIpv4IpamAllocationoptionalSubnetIpv4IpamAllocation #Default: the subnet uses the concrete cidrBlock
notes
When set, ipv4CidrBlock resolves to a deploy-time attribute of the subnet instead of a concrete string, so SubnetFilter.byCidrMask(), SubnetFilter.byCidrRanges() and SubnetFilter.containsIpAddresses() cannot be used with this subnet.
Exactly one of cidrBlock and ipv4IpamAllocation must be specified.
ipv6CidrBlockoptionalstringipv6_cidr_blockoptionalstripv6CidrBlockoptionalStringIpv6CidrBlockoptionalstringIpv6CidrBlockoptional*string #Default: no IPv6 CIDR block.
If you specify AssignIpv6AddressOnCreation, you must also specify Ipv6CidrBlock.
mapPublicIpOnLaunchoptionalbooleanmap_public_ip_on_launchoptionalboolmapPublicIpOnLaunchoptionalBooleanMapPublicIpOnLaunchoptionalboolMapPublicIpOnLaunchoptional*bool #Default: true in Subnet.Public, false in Subnet.Private or Subnet.Isolated.