Class RouteTable

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.ec2.alpha.RouteTable
All Implemented Interfaces:
IResource, IRouteTable, 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.185Z") @Stability(Experimental) public class RouteTable extends Resource implements IRouteTable
(experimental) Creates a route table for the specified VPC.

Example:

 Stack stack = new Stack();
 VpcV2 myVpc = new VpcV2(this, "Vpc");
 VPNGatewayV2 vpnGateway = myVpc.enableVpnGatewayV2(VPNGatewayV2Options.builder()
         .vpnRoutePropagation(List.of(SubnetSelection.builder().subnetType(SubnetType.PUBLIC).build()))
         .type(VpnConnectionType.IPSEC_1)
         .build());
 RouteTable routeTable = RouteTable.Builder.create(stack, "routeTable")
         .vpc(myVpc)
         .build();
 Route.Builder.create(stack, "route")
         .destination("172.31.0.0/24")
         .target(Map.of("gateway", vpnGateway))
         .routeTable(routeTable)
         .build();
 
  • Constructor Details

    • RouteTable

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

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

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

    • addRoute

      @Stability(Experimental) public void addRoute(@NotNull String id, @NotNull String destination, @NotNull RouteTargetType target)
      (experimental) Adds a new custom route to the route table.

      Parameters:
      id - This parameter is required.
      destination - The IPv4 or IPv6 CIDR block used for the destination match. This parameter is required.
      target - The gateway or endpoint targeted by the route. This parameter is required.
    • getResource

      @Stability(Experimental) @NotNull public CfnRouteTable getResource()
      (experimental) The route table CFN resource.
    • getRouteTableId

      @Stability(Experimental) @NotNull public String getRouteTableId()
      (experimental) The ID of the route table.
      Specified by:
      getRouteTableId in interface IRouteTable