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

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-06T23:25:18.791Z") @Stability(Experimental) public class Route extends Resource implements IRouteV2
(experimental) Creates a new route with added functionality.

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();
 
  • Constructor Details

    • Route

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

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

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

    • getDestination

      @Stability(Experimental) @NotNull public String getDestination()
      (experimental) The IPv4 or IPv6 CIDR block used for the destination match.

      Routing decisions are based on the most specific match.

      Specified by:
      getDestination in interface IRouteV2
    • getRouteTable

      @Stability(Experimental) @NotNull public IRouteTable getRouteTable()
      (experimental) The route table for the route.
      Specified by:
      getRouteTable in interface IRouteV2
    • getTarget

      @Stability(Experimental) @NotNull public RouteTargetType getTarget()
      (experimental) The gateway or endpoint targeted by the route.
      Specified by:
      getTarget in interface IRouteV2
    • getTargetRouterType

      @Stability(Experimental) @NotNull public RouterType getTargetRouterType()
      (experimental) The type of router the route is targetting.
    • getResource

      @Stability(Experimental) @Nullable public CfnRoute getResource()
      (experimental) The route CFN resource.