Enum SubnetType

java.lang.Object
java.lang.Enum<SubnetType>
software.amazon.awscdk.services.ec2.SubnetType
All Implemented Interfaces:
Serializable, Comparable<SubnetType>, java.lang.constant.Constable

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:39.545Z") @Stability(Stable) public enum SubnetType extends Enum<SubnetType>
The type of Subnet.

Example:

 Vpc vpc;
 DatabaseCluster cluster = DatabaseCluster.Builder.create(this, "Database")
         .masterUser(Login.builder()
                 .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")
                 .build())
         .instanceType(InstanceType.of(InstanceClass.R5, InstanceSize.LARGE))
         .vpcSubnets(SubnetSelection.builder()
                 .subnetType(SubnetType.PUBLIC)
                 .build())
         .vpc(vpc)
         .build();
 
  • Enum Constant Details

    • ISOLATED

      @Stability(Deprecated) @Deprecated public static final SubnetType ISOLATED
      Deprecated.
      use SubnetType.PRIVATE_ISOLATED
      (deprecated) Isolated Subnets do not route traffic to the Internet (in this VPC), and as such, do not require NAT gateways.

      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_ISOLATED

      @Stability(Stable) public static final SubnetType PRIVATE_ISOLATED
      Isolated Subnets do not route traffic to the Internet (in this VPC), and as such, do not require NAT gateways.

      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

      @Stability(Deprecated) @Deprecated public static final SubnetType PRIVATE
      Deprecated.
      use PRIVATE_WITH_NAT
      (deprecated) Subnet that routes to the internet, but not vice versa.

      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.

    • PRIVATE_WITH_NAT

      @Stability(Stable) public static final SubnetType PRIVATE_WITH_NAT
      Subnet that routes to the internet (via a NAT gateway), but not vice versa.

      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

      @Stability(Stable) public static final SubnetType PUBLIC
      Subnet connected to the Internet.

      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.

  • Method Details

    • values

      public static SubnetType[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static SubnetType valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null