Interface ISubnetSelection
Customize subnets that are selected for placement of ENIs.
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface ISubnetSelection
Syntax (vb)
Public Interface ISubnetSelection
Remarks
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.
ExampleMetadata: infused
Examples
Vpc vpc;
var cluster = new DatabaseCluster(this, "Database", new DatabaseClusterProps {
MasterUser = new Login {
Username = "myuser"
},
InstanceType = InstanceType.Of(InstanceClass.MEMORY5, InstanceSize.LARGE),
VpcSubnets = new SubnetSelection {
SubnetType = SubnetType.PUBLIC
},
Vpc = vpc,
RemovalPolicy = RemovalPolicy.SNAPSHOT,
InstanceRemovalPolicy = RemovalPolicy.RETAIN
});
Synopsis
Properties
AvailabilityZones | Select subnets only in the given AZs. |
OnePerAz | If true, return at most one subnet per AZ. |
SubnetFilters | List of provided subnet filters. |
SubnetGroupName | Select the subnet group with the given name. |
Subnets | Explicitly select individual subnets. |
SubnetType | Select all subnets of the given type. |
Properties
AvailabilityZones
Select subnets only in the given AZs.
virtual string[] AvailabilityZones { get; }
Property Value
System.String[]
Remarks
Default: no filtering on AZs is done
OnePerAz
If true, return at most one subnet per AZ.
virtual Nullable<bool> OnePerAz { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false
SubnetFilters
List of provided subnet filters.
virtual SubnetFilter[] SubnetFilters { get; }
Property Value
Remarks
Default: - none
SubnetGroupName
Select the subnet group with the given name.
virtual string SubnetGroupName { get; }
Property Value
System.String
Remarks
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.
Default: - Selection by type instead of by name
Subnets
Explicitly select individual subnets.
virtual ISubnet[] Subnets { get; }
Property Value
ISubnet[]
Remarks
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
.
Default: - Use all subnets in a selected group (all private subnets by default)
SubnetType
Select all subnets of the given type.
virtual Nullable<SubnetType> SubnetType { get; }
Property Value
System.Nullable<SubnetType>
Remarks
At most one of subnetType
and subnetGroupName
can be supplied.
Default: SubnetType.PRIVATE_WITH_EGRESS (or ISOLATED or PUBLIC if there are no PRIVATE_WITH_EGRESS subnets)