SubnetSelection Struct
Customize subnets that are selected for placement of ENIs.
Constructs that allow customization of VPC placement use parameters of this type to provide placement settings.
By default, the instances are placed in the private subnets.
Example
declare const vpc: ec2.Vpc;
const cluster = new docdb.DatabaseCluster(this, 'Database', {
masterUser: {
username: 'myuser',
},
instanceType: ec2.InstanceType.of(ec2.InstanceClass.MEMORY5, ec2.InstanceSize.LARGE),
vpcSubnets: {
subnetType: ec2.SubnetType.PUBLIC,
},
vpc,
removalPolicy: RemovalPolicy.SNAPSHOT,
instanceRemovalPolicy: RemovalPolicy.RETAIN,
});
Properties
availabilityZonesoptionalstring[]availability_zonesoptionaltyping.List[str]availabilityZonesoptionalList<String>AvailabilityZonesoptionalstring[]AvailabilityZonesoptional*[]*string#Default: no filtering on AZs is done
notes
Filtering happens at synthesis time. Literal AZ names do not match subnets whose availability zones are unresolved tokens (for example, from Fn.getAzs() in an environment-agnostic stack). To filter by literal names, the subnet AZs must also be known at synthesis time. For a new VPC, you can specify explicit AZ names in VpcProps.availabilityZones.
onePerAzoptionalbooleanone_per_azoptionalboolonePerAzoptionalBooleanOnePerAzoptionalboolOnePerAzoptional*bool= false#subnetFiltersoptionalSubnetFilter[]subnet_filtersoptionaltyping.List[SubnetFilter]subnetFiltersoptionalList<SubnetFilter>SubnetFiltersoptionalSubnetFilter[]SubnetFiltersoptional*[]SubnetFilter= none#subnetGroupNameoptionalstringsubnet_group_nameoptionalstrsubnetGroupNameoptionalStringSubnetGroupNameoptionalstringSubnetGroupNameoptional*string#Default: Selection by type instead of by name
notes
Select the subnet group with the given name. This only needs to be used if you have multiple subnet groups of the same type and you need to distinguish between them. Otherwise, prefer subnetType.
This field does not select individual subnets, it selects all subnets that share the given subnet group name. This is the name supplied in subnetConfiguration.
At most one of subnetType and subnetGroupName can be supplied.
subnetsoptionalISubnet[]subnetsoptionaltyping.List[ISubnet]subnetsoptionalList<ISubnet>SubnetsoptionalISubnet[]Subnetsoptional*[]ISubnet#Default: Use all subnets in a selected group (all private subnets by default)
Use this if you don't want to automatically use all subnets in a group, but have a need to control selection down to individual subnets.
Cannot be specified together with subnetType or subnetGroupName.
subnetTypeoptionalSubnetTypesubnet_typeoptionalSubnetTypesubnetTypeoptionalSubnetTypeSubnetTypeoptionalSubnetTypeSubnetTypeoptionalSubnetType#Default: SubnetType.PRIVATE_WITH_EGRESS (or ISOLATED or PUBLIC if there are no PRIVATE_WITH_EGRESS subnets)
At most one of subnetType and subnetGroupName can be supplied.