AddRouteOptions Struct
Options for adding a new route to a subnet.
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",
})
Properties
destinationCidrBlockoptionalstringdestination_cidr_blockoptionalstrdestinationCidrBlockoptionalStringDestinationCidrBlockoptionalstringDestinationCidrBlockoptional*string= '0.0.0.0/0'#IPv4 range this route applies to.
destinationIpv6CidrBlockoptionalstringdestination_ipv6_cidr_blockoptionalstrdestinationIpv6CidrBlockoptionalStringDestinationIpv6CidrBlockoptionalstringDestinationIpv6CidrBlockoptional*string#IPv6 range this route applies to.
Default: Uses IPv6
enablesInternetConnectivityoptionalbooleanenables_internet_connectivityoptionalboolenablesInternetConnectivityoptionalBooleanEnablesInternetConnectivityoptionalboolEnablesInternetConnectivityoptional*bool= false#Whether this route will enable internet connectivity.
If true, this route will be added before any AWS resources that depend on internet connectivity in the VPC will be created.
The ID of the router.
Can be an instance ID, gateway ID, etc, depending on the router type.
routerTypeRouterTyperouter_typeRouterTyperouterTypeRouterTypeRouterTypeRouterTypeRouterTypeRouterTyperequired#What type of router to route this traffic to.