Interface SubnetV2Props

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
SubnetV2Props.Jsii$Proxy

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-22T02:24:11.444Z") @Stability(Experimental) public interface SubnetV2Props extends software.amazon.jsii.JsiiSerializable
(experimental) Properties to define subnet for VPC.

Example:

 VpcV2 myVpc = new VpcV2(this, "Vpc");
 RouteTable routeTable = RouteTable.Builder.create(this, "RouteTable")
         .vpc(myVpc)
         .build();
 SubnetV2 subnet = SubnetV2.Builder.create(this, "Subnet")
         .vpc(myVpc)
         .availabilityZone("eu-west-2a")
         .ipv4CidrBlock(new IpCidr("10.0.0.0/24"))
         .subnetType(SubnetType.PRIVATE_ISOLATED)
         .build();
 NatGateway natgw = NatGateway.Builder.create(this, "NatGW")
         .subnet(subnet)
         .vpc(myVpc)
         .connectivityType(NatConnectivityType.PRIVATE)
         .privateIpAddress("10.0.0.42")
         .build();
 Route.Builder.create(this, "NatGwRoute")
         .routeTable(routeTable)
         .destination("0.0.0.0/0")
         .target(Map.of("gateway", natgw))
         .build();
 
  • Method Details

    • getAvailabilityZone

      @Stability(Experimental) @NotNull String getAvailabilityZone()
      (experimental) Custom AZ for the subnet.
    • getIpv4CidrBlock

      @Stability(Experimental) @NotNull IpCidr getIpv4CidrBlock()
      (experimental) ipv4 cidr to assign to this subnet.

      See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-cidrblock

    • getSubnetType

      @Stability(Experimental) @NotNull SubnetType getSubnetType()
      (experimental) The type of Subnet to configure.

      The Subnet type will control the ability to route and connect to the Internet.

      TODO: Add validation check subnetType when adding resources (e.g. cannot add NatGateway to private)

    • getVpc

      @Stability(Experimental) @NotNull IVpcV2 getVpc()
      (experimental) VPC Prop.
    • getAssignIpv6AddressOnCreation

      @Stability(Experimental) @Nullable default Boolean getAssignIpv6AddressOnCreation()
      (experimental) Indicates whether a network interface created in this subnet receives an IPv6 address.

      If you specify AssignIpv6AddressOnCreation, you must also specify Ipv6CidrBlock.

      Default: - undefined in case not provided as an input

    • getIpv6CidrBlock

      @Stability(Experimental) @Nullable default IpCidr getIpv6CidrBlock()
      (experimental) Ipv6 CIDR Range for subnet.

      Default: - No Ipv6 address

    • getRouteTable

      @Stability(Experimental) @Nullable default IRouteTable getRouteTable()
      (experimental) Custom Route for subnet.

      Default: - a default route table created

    • getSubnetName

      @Stability(Experimental) @Nullable default String getSubnetName()
      (experimental) Subnet name.

      Default: - provisioned with an autogenerated name by CDK

    • builder

      @Stability(Experimental) static SubnetV2Props.Builder builder()
      Returns:
      a SubnetV2Props.Builder of SubnetV2Props