Show / Hide Table of Contents

Class SubnetType

The type of Subnet.

Inheritance
System.Object
SubnetType
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.AWS.EC2.dll
Syntax (csharp)
public sealed class SubnetType : Enum
Syntax (vb)
Public NotInheritable Class SubnetType
    Inherits

     Enum
Remarks

ExampleMetadata: infused

Examples
Vpc vpc;

DatabaseCluster cluster = new DatabaseCluster(this, "Database", new DatabaseClusterProps {
    MasterUser = new Login {
        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"
    },
    InstanceType = InstanceType.Of(InstanceClass.R5, InstanceSize.LARGE),
    VpcSubnets = new SubnetSelection {
        SubnetType = SubnetType.PUBLIC
    },
    Vpc = vpc
});

Synopsis

Fields

ISOLATED

(deprecated) Isolated Subnets do not route traffic to the Internet (in this VPC), and as such, do not require NAT gateways.

PRIVATE

(deprecated) Subnet that routes to the internet, but not vice versa.

PRIVATE_ISOLATED

Isolated Subnets do not route traffic to the Internet (in this VPC), and as such, do not require NAT gateways.

PRIVATE_WITH_NAT

Subnet that routes to the internet (via a NAT gateway), but not vice versa.

PUBLIC

Subnet connected to the Internet.

value__

Fields

ISOLATED

(deprecated) Isolated Subnets do not route traffic to the Internet (in this VPC), and as such, do not require NAT gateways.

public const SubnetType ISOLATED
Field Value
Type Description
SubnetType
Remarks

Isolated subnets can only connect to or be connected to from other instances in the same VPC. A default VPC configuration will not include isolated subnets.

This can be good for subnets with RDS or Elasticache instances, or which route Internet traffic through a peer VPC.

Stability: Deprecated

PRIVATE

(deprecated) Subnet that routes to the internet, but not vice versa.

public const SubnetType PRIVATE
Field Value
Type Description
SubnetType
Remarks

Instances in a private subnet can connect to the Internet, but will not allow connections to be initiated from the Internet. NAT Gateway(s) are required with this subnet type to route the Internet traffic through. If a NAT Gateway is not required or desired, use SubnetType.PRIVATE_ISOLATED instead.

By default, a NAT gateway is created in every public subnet for maximum availability. Be aware that you will be charged for NAT gateways.

Normally a Private subnet will use a NAT gateway in the same AZ, but if natGateways is used to reduce the number of NAT gateways, a NAT gateway from another AZ will be used instead.

Stability: Deprecated

PRIVATE_ISOLATED

Isolated Subnets do not route traffic to the Internet (in this VPC), and as such, do not require NAT gateways.

public const SubnetType PRIVATE_ISOLATED
Field Value
Type Description
SubnetType
Remarks

Isolated subnets can only connect to or be connected to from other instances in the same VPC. A default VPC configuration will not include isolated subnets.

This can be good for subnets with RDS or Elasticache instances, or which route Internet traffic through a peer VPC.

PRIVATE_WITH_NAT

Subnet that routes to the internet (via a NAT gateway), but not vice versa.

public const SubnetType PRIVATE_WITH_NAT
Field Value
Type Description
SubnetType
Remarks

Instances in a private subnet can connect to the Internet, but will not allow connections to be initiated from the Internet. NAT Gateway(s) are required with this subnet type to route the Internet traffic through. If a NAT Gateway is not required or desired, use SubnetType.PRIVATE_ISOLATED instead.

By default, a NAT gateway is created in every public subnet for maximum availability. Be aware that you will be charged for NAT gateways.

Normally a Private subnet will use a NAT gateway in the same AZ, but if natGateways is used to reduce the number of NAT gateways, a NAT gateway from another AZ will be used instead.

PUBLIC

Subnet connected to the Internet.

public const SubnetType PUBLIC
Field Value
Type Description
SubnetType
Remarks

Instances in a Public subnet can connect to the Internet and can be connected to from the Internet as long as they are launched with public IPs (controlled on the AutoScalingGroup or other constructs that launch instances).

Public subnets route outbound traffic via an Internet Gateway.

value__

public int value__
Field Value
Type Description
System.Int32
Back to top Generated by DocFX