Class PublicSubnet

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.ec2.Subnet
software.amazon.awscdk.services.ec2.PublicSubnet
All Implemented Interfaces:
IResource, IPublicSubnet, ISubnet, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.95.0 (build f1ff514)", date="2024-03-26T18:09:22.865Z") @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
         .assignIpv6AddressOnCreation(false)
         .ipv6CidrBlock("ipv6CidrBlock")
         .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