Show / Hide Table of Contents

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.

SubnetType

Select all subnets of the given type.

Subnets

Explicitly select individual subnets.

Properties

AvailabilityZones

Select subnets only in the given AZs.

string[]? AvailabilityZones { get; }
Property Value

string[]

Remarks

Default: no filtering on AZs is done

OnePerAz

If true, return at most one subnet per AZ.

bool? OnePerAz { get; }
Property Value

bool?

Remarks

Default: false

SubnetFilters

List of provided subnet filters.

SubnetFilter[]? SubnetFilters { get; }
Property Value

SubnetFilter[]

Remarks

Default: - none

SubnetGroupName

Select the subnet group with the given name.

string? SubnetGroupName { get; }
Property Value

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

SubnetType

Select all subnets of the given type.

SubnetType? SubnetType { get; }
Property Value

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)

Subnets

Explicitly select individual subnets.

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)

Back to top Generated by DocFX