Skip to content
v2.273.0

SubnetType Enum ​

The type of Subnet.

Example ​

ts
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.MEMORY5, ec2.InstanceSize.LARGE),
  vpcSubnets: {
    subnetType: ec2.SubnetType.PUBLIC,
  },
  vpc,
  copyTagsToSnapshot: true  // whether to save the cluster tags when creating the snapshot.
});

Members ​

MemberDescription
PRIVATE_ISOLATEDIsolated Subnets do not route traffic to the Internet (in this VPC), and as such, do not require NAT gateways.
PRIVATE_WITH_EGRESSSubnet that routes to the internet, but not vice versa.
PRIVATE_WITH_NATSubnet that routes to the internet (via a NAT gateway), but not vice versa.
PUBLICSubnet connected to the Internet.

Referenced by ​