Class InternetGateway

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.ec2.alpha.InternetGateway
All Implemented Interfaces:
IResource, IRouteTarget, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)", date="2024-10-05T03:43:53.164Z") @Stability(Experimental) public class InternetGateway extends Resource implements IRouteTarget
(experimental) Creates an internet gateway.

Example:

 Stack stack = new Stack();
 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();
 InternetGateway igw = InternetGateway.Builder.create(this, "IGW")
         .vpc(myVpc)
         .build();
 Route.Builder.create(this, "IgwRoute")
         .routeTable(routeTable)
         .destination("0.0.0.0/0")
         .target(Map.of("gateway", igw))
         .build();
 
  • Constructor Details

    • InternetGateway

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

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

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

    • getResource

      @Stability(Experimental) @NotNull public CfnInternetGateway getResource()
      (experimental) The internet gateway CFN resource.
    • getRouterTargetId

      @Stability(Experimental) @NotNull public String getRouterTargetId()
      (experimental) The ID of the route target.
      Specified by:
      getRouterTargetId in interface IRouteTarget
    • getRouterType

      @Stability(Experimental) @NotNull public RouterType getRouterType()
      (experimental) The type of router used in the route.
      Specified by:
      getRouterType in interface IRouteTarget
    • getVpcId

      @Stability(Experimental) @NotNull public String getVpcId()
      (experimental) The ID of the VPC for which to create the internet gateway.