# RouterType

Type of router used in route.

- Source: [`aws-ec2/lib/vpc.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-ec2/lib/vpc.ts#L2449)
- Type last changed: v2.223.0 · 10 Nov 2025

## Example

```ts
const vpc = new ec2.Vpc(this, "VPC", {
  subnetConfiguration: [{
      subnetType: ec2.SubnetType.PUBLIC,
      name: 'Public',
    },{
      subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
      name: 'Isolated',
    }]
});

(vpc.isolatedSubnets[0] as ec2.Subnet).addRoute("StaticRoute", {
    routerId: vpc.internetGatewayId!,
    routerType: ec2.RouterType.GATEWAY,
    destinationCidrBlock: "8.8.8.8/32",
})
```

## Members

| Member | Description |
| --- | --- |
| `CARRIER_GATEWAY` | Carrier gateway. |
| `EGRESS_ONLY_INTERNET_GATEWAY` | Egress-only Internet Gateway. |
| `GATEWAY` | Internet Gateway or Virtual Private Gateway. |
| `INSTANCE` | Instance. |
| `LOCAL_GATEWAY` | Local Gateway. |
| `NAT_GATEWAY` | NAT Gateway. |
| `NETWORK_INTERFACE` | Network Interface. |
| `TRANSIT_GATEWAY` | Transit Gateway. |
| `VPC_PEERING_CONNECTION` | VPC peering connection. |
| `VPC_ENDPOINT` | VPC Endpoint for gateway load balancers. |
| `CORE_NETWORK` | AWS Network Manager Core Network. |

## Referenced by

- [`AddRouteOptions`](/v2/docs/aws-cdk-lib.aws_ec2.AddRouteOptions).routerType
- [`EgressOnlyInternetGateway`](/v2/docs/@aws-cdk_aws-ec2-alpha.EgressOnlyInternetGateway).routerType
- [`InternetGateway`](/v2/docs/@aws-cdk_aws-ec2-alpha.InternetGateway).routerType
- [`IRouteTarget`](/v2/docs/@aws-cdk_aws-ec2-alpha.IRouteTarget).routerType
- [`NatGateway`](/v2/docs/@aws-cdk_aws-ec2-alpha.NatGateway).routerType
- [`Route`](/v2/docs/@aws-cdk_aws-ec2-alpha.Route).targetRouterType
- [`TransitGateway`](/v2/docs/@aws-cdk_aws-ec2-alpha.TransitGateway).routerType
- [`VPCPeeringConnection`](/v2/docs/@aws-cdk_aws-ec2-alpha.VPCPeeringConnection).routerType
- [`VPNGatewayV2`](/v2/docs/@aws-cdk_aws-ec2-alpha.VPNGatewayV2).routerType
