interface SubnetSelection
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.EC2.SubnetSelection |
Java | software.amazon.awscdk.services.ec2.SubnetSelection |
Python | aws_cdk.aws_ec2.SubnetSelection |
TypeScript (source) | @aws-cdk/aws-ec2 » SubnetSelection |
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', // NOTE: 'admin' is reserved by DocumentDB
excludeCharacters: '\"@/:', // optional, defaults to the set "\"@/" and is also used for eventually created rotations
secretName: '/myapp/mydocdb/masteruser', // optional, if you prefer to specify the secret name
},
instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.LARGE),
vpcSubnets: {
subnetType: ec2.SubnetType.PUBLIC,
},
vpc,
});
Properties
Name | Type | Description |
---|---|---|
availability | string[] | Select subnets only in the given AZs. |
one | boolean | If true, return at most one subnet per AZ. |
subnet | Subnet [] | List of provided subnet filters. |
subnet | string | Select the subnet group with the given name. |
subnet | string | Alias for subnetGroupName . |
subnet | Subnet | Select all subnets of the given type. |
subnets? | ISubnet [] | Explicitly select individual subnets. |
availabilityZones?
Type:
string[]
(optional, default: no filtering on AZs is done)
Select subnets only in the given AZs.
onePerAz?
Type:
boolean
(optional, default: false)
If true, return at most one subnet per AZ.
subnetFilters?
Type:
Subnet
[]
(optional, default: none)
List of provided subnet filters.
subnetGroupName?
Type:
string
(optional, default: Selection by type instead of by name)
Select the subnet group with the given name.
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.
subnetName?
⚠️ Deprecated: Use subnetGroupName
instead
Type:
string
(optional)
Alias for subnetGroupName
.
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.
subnetType?
Type:
Subnet
(optional, default: SubnetType.PRIVATE_WITH_NAT (or ISOLATED or PUBLIC if there are no PRIVATE_WITH_NAT subnets))
Select all subnets of the given type.
At most one of subnetType
and subnetGroupName
can be supplied.
subnets?
Type:
ISubnet
[]
(optional, default: Use all subnets in a selected group (all private subnets by default))
Explicitly select individual subnets.
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
.