Skip to content
v2.274.0

Experimental

@aws-cdk/aws-ec2-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

RouteProps Struct ​

Properties to define a route.

Example ​

ts
const myVpc = new VpcV2(this, 'Vpc');
const routeTable = new RouteTable(this, 'RouteTable', {
  vpc: myVpc,
});
const subnet = new SubnetV2(this, 'Subnet', {
  vpc: myVpc,
  availabilityZone: 'eu-west-2a',
  ipv4CidrBlock: new IpCidr('10.0.0.0/24'),
  subnetType: SubnetType.PRIVATE_ISOLATED });

const natgw = new NatGateway(this, 'NatGW', {
  subnet: subnet,
  vpc: myVpc,
  connectivityType: NatConnectivityType.PRIVATE,
  privateIpAddress: '10.0.0.42',
});
new Route(this, 'NatGwRoute', {
  routeTable,
  destination: '0.0.0.0/0',
  target: { gateway: natgw },
});

Properties ​

destinationstringdestinationstrdestinationStringDestinationstringDestination*stringrequired#
The IPv4 or IPv6 CIDR block used for the destination match.

Routing decisions are based on the most specific match.

routeNameoptionalstringroute_nameoptionalstrrouteNameoptionalStringRouteNameoptionalstringRouteNameoptional*string#
The resource name of the route.

Default: provisioned without a route name

routeTableIRouteTableroute_tableIRouteTablerouteTableIRouteTableRouteTableIRouteTableRouteTableIRouteTablerequired#
The ID of the route table for the route.
The gateway or endpoint targeted by the route.