# CfnRouteProps

Properties for defining a `CfnRoute`.

Used as props by: [CfnRoute](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.CfnRoute.html)

- Source: Generated at build time
- Type last changed: v2.260.0 · 16 Jun 2026

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
const cfnRouteProps: ec2.CfnRouteProps = {
  routeTableId: 'routeTableId',

  // the properties below are optional
  carrierGatewayId: 'carrierGatewayId',
  coreNetworkArn: 'coreNetworkArn',
  destinationCidrBlock: 'destinationCidrBlock',
  destinationIpv6CidrBlock: 'destinationIpv6CidrBlock',
  destinationPrefixListId: 'destinationPrefixListId',
  egressOnlyInternetGatewayId: 'egressOnlyInternetGatewayId',
  gatewayId: 'gatewayId',
  instanceId: 'instanceId',
  localGatewayId: 'localGatewayId',
  natGatewayId: 'natGatewayId',
  networkInterfaceId: 'networkInterfaceId',
  odbNetworkArn: 'odbNetworkArn',
  transitGatewayId: 'transitGatewayId',
  vpcEndpointId: 'vpcEndpointId',
  vpcPeeringConnectionId: 'vpcPeeringConnectionId',
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ec2 as ec2

cfn_route_props = ec2.CfnRouteProps(
    route_table_id="routeTableId",

    # the properties below are optional
    carrier_gateway_id="carrierGatewayId",
    core_network_arn="coreNetworkArn",
    destination_cidr_block="destinationCidrBlock",
    destination_ipv6_cidr_block="destinationIpv6CidrBlock",
    destination_prefix_list_id="destinationPrefixListId",
    egress_only_internet_gateway_id="egressOnlyInternetGatewayId",
    gateway_id="gatewayId",
    instance_id="instanceId",
    local_gateway_id="localGatewayId",
    nat_gateway_id="natGatewayId",
    network_interface_id="networkInterfaceId",
    odb_network_arn="odbNetworkArn",
    transit_gateway_id="transitGatewayId",
    vpc_endpoint_id="vpcEndpointId",
    vpc_peering_connection_id="vpcPeeringConnectionId"
)
```

Java:

```java
// 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.*;

CfnRouteProps cfnRouteProps = CfnRouteProps.builder()
        .routeTableId("routeTableId")

        // the properties below are optional
        .carrierGatewayId("carrierGatewayId")
        .coreNetworkArn("coreNetworkArn")
        .destinationCidrBlock("destinationCidrBlock")
        .destinationIpv6CidrBlock("destinationIpv6CidrBlock")
        .destinationPrefixListId("destinationPrefixListId")
        .egressOnlyInternetGatewayId("egressOnlyInternetGatewayId")
        .gatewayId("gatewayId")
        .instanceId("instanceId")
        .localGatewayId("localGatewayId")
        .natGatewayId("natGatewayId")
        .networkInterfaceId("networkInterfaceId")
        .odbNetworkArn("odbNetworkArn")
        .transitGatewayId("transitGatewayId")
        .vpcEndpointId("vpcEndpointId")
        .vpcPeeringConnectionId("vpcPeeringConnectionId")
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EC2;

var cfnRouteProps = new CfnRouteProps {
    RouteTableId = "routeTableId",

    // the properties below are optional
    CarrierGatewayId = "carrierGatewayId",
    CoreNetworkArn = "coreNetworkArn",
    DestinationCidrBlock = "destinationCidrBlock",
    DestinationIpv6CidrBlock = "destinationIpv6CidrBlock",
    DestinationPrefixListId = "destinationPrefixListId",
    EgressOnlyInternetGatewayId = "egressOnlyInternetGatewayId",
    GatewayId = "gatewayId",
    InstanceId = "instanceId",
    LocalGatewayId = "localGatewayId",
    NatGatewayId = "natGatewayId",
    NetworkInterfaceId = "networkInterfaceId",
    OdbNetworkArn = "odbNetworkArn",
    TransitGatewayId = "transitGatewayId",
    VpcEndpointId = "vpcEndpointId",
    VpcPeeringConnectionId = "vpcPeeringConnectionId"
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnRouteProps := &CfnRouteProps{
	RouteTableId: jsii.String("routeTableId"),

	// the properties below are optional
	CarrierGatewayId: jsii.String("carrierGatewayId"),
	CoreNetworkArn: jsii.String("coreNetworkArn"),
	DestinationCidrBlock: jsii.String("destinationCidrBlock"),
	DestinationIpv6CidrBlock: jsii.String("destinationIpv6CidrBlock"),
	DestinationPrefixListId: jsii.String("destinationPrefixListId"),
	EgressOnlyInternetGatewayId: jsii.String("egressOnlyInternetGatewayId"),
	GatewayId: jsii.String("gatewayId"),
	InstanceId: jsii.String("instanceId"),
	LocalGatewayId: jsii.String("localGatewayId"),
	NatGatewayId: jsii.String("natGatewayId"),
	NetworkInterfaceId: jsii.String("networkInterfaceId"),
	OdbNetworkArn: jsii.String("odbNetworkArn"),
	TransitGatewayId: jsii.String("transitGatewayId"),
	VpcEndpointId: jsii.String("vpcEndpointId"),
	VpcPeeringConnectionId: jsii.String("vpcPeeringConnectionId"),
}
```

## Properties

- `carrierGatewayId`: string | [ICarrierGatewayRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_ec2.ICarrierGatewayRef.html) — The ID of the carrier gateway.

  You can only use this option when the VPC contains a subnet which is associated with a Wavelength Zone.

- `coreNetworkArn`: string — The Amazon Resource Name (ARN) of the core network.

- `destinationCidrBlock`: string — The IPv4 CIDR address block used for the destination match.

  Routing decisions are based on the most specific match. We modify the specified CIDR block to its canonical form; for example, if you specify `100.68.0.18/18` , we modify it to `100.68.0.0/18` .

- `destinationIpv6CidrBlock`: string — The IPv6 CIDR block used for the destination match.

  Routing decisions are based on the most specific match.

- `destinationPrefixListId`: string — The ID of a prefix list used for the destination match.

- `egressOnlyInternetGatewayId`: string | [IEgressOnlyInternetGatewayRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_ec2.IEgressOnlyInternetGatewayRef.html) — [IPv6 traffic only] The ID of an egress-only internet gateway.

- `gatewayId`: string | [IInternetGatewayRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_ec2.IInternetGatewayRef.html) | [IVPNGatewayRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_ec2.IVPNGatewayRef.html) — The ID of an internet gateway or virtual private gateway attached to your VPC.

- `instanceId`: string | [IInstanceRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_ec2.IInstanceRef.html) — The ID of a NAT instance in your VPC.

  The operation fails if you specify an instance ID unless exactly one network interface is attached.

- `localGatewayId`: string — The ID of the local gateway.

- `natGatewayId`: string | [INatGatewayRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_ec2.INatGatewayRef.html) — [IPv4 traffic only] The ID of a NAT gateway.

- `networkInterfaceId`: string — The ID of a network interface.

- `odbNetworkArn`: string — The Amazon Resource Name (ARN) of the ODB network.

- `routeTableId`: string | [IRouteTableRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_ec2.IRouteTableRef.html) (required) — The ID of the route table for the route.

- `transitGatewayId`: string | [ITransitGatewayRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_ec2.ITransitGatewayRef.html) — The ID of a transit gateway.

- `vpcEndpointId`: string — The ID of a VPC endpoint.

  Supported for Gateway Load Balancer endpoints only.

- `vpcPeeringConnectionId`: string | [IVPCPeeringConnectionRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_ec2.IVPCPeeringConnectionRef.html) — The ID of a VPC peering connection.
