Class PublicSubnet

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IConstruct, IDependable, IResource, IPublicSubnet, ISubnet, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:39.495Z") @Stability(Stable) public class PublicSubnet extends Subnet implements IPublicSubnet
Represents a public VPC subnet resource.

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.ec2.*;
 PublicSubnet publicSubnet = PublicSubnet.Builder.create(this, "MyPublicSubnet")
         .availabilityZone("availabilityZone")
         .cidrBlock("cidrBlock")
         .vpcId("vpcId")
         // the properties below are optional
         .mapPublicIpOnLaunch(false)
         .build();
 
  • Constructor Details

    • PublicSubnet

      protected PublicSubnet(software.amazon.jsii.JsiiObjectRef objRef)
    • PublicSubnet

      protected PublicSubnet(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • PublicSubnet

      @Stability(Stable) public PublicSubnet(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull PublicSubnetProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • fromPublicSubnetAttributes

      @Stability(Stable) @NotNull public static IPublicSubnet fromPublicSubnetAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull PublicSubnetAttributes attrs)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      attrs - This parameter is required.
    • addNatGateway

      @Stability(Stable) @NotNull public CfnNatGateway addNatGateway(@Nullable String eipAllocationId)
      Creates a new managed NAT gateway attached to this public subnet.

      Also adds the EIP for the managed NAT.

      Parameters:
      eipAllocationId -
      Returns:
      A ref to the the NAT Gateway ID
    • addNatGateway

      @Stability(Stable) @NotNull public CfnNatGateway addNatGateway()
      Creates a new managed NAT gateway attached to this public subnet.

      Also adds the EIP for the managed NAT.

      Returns:
      A ref to the the NAT Gateway ID