RouteArgs

data class RouteArgs(val carrierGatewayId: Output<String>? = null, val coreNetworkArn: Output<String>? = null, val destinationCidrBlock: Output<String>? = null, val destinationIpv6CidrBlock: Output<String>? = null, val destinationPrefixListId: Output<String>? = null, val egressOnlyGatewayId: Output<String>? = null, val gatewayId: Output<String>? = null, val localGatewayId: Output<String>? = null, val natGatewayId: Output<String>? = null, val networkInterfaceId: Output<String>? = null, val routeTableId: Output<String>? = null, val transitGatewayId: Output<String>? = null, val vpcEndpointId: Output<String>? = null, val vpcPeeringConnectionId: Output<String>? = null) : ConvertibleToJava<RouteArgs>

Provides a resource to create a routing table entry (a route) in a VPC routing table.

NOTE on Route Tables and Routes: This provider currently provides both a standalone Route resource and a Route Table resource with routes defined in-line. At this time you cannot use a Route Table with in-line routes in conjunction with any Route resources. Doing so will cause a conflict of rule settings and will overwrite rules. NOTE on gateway_id attribute: The AWS API is very forgiving with the resource ID passed in the gateway_id attribute. For example an aws.ec2.Route resource can be created with an aws.ec2.NatGateway or aws.ec2.EgressOnlyInternetGateway ID specified for the gateway_id attribute. Specifying anything other than an aws.ec2.InternetGateway or aws.ec2.VpnGateway ID will lead to this provider reporting a permanent diff between your configuration and recorded state, as the AWS API returns the more-specific attribute. If you are experiencing constant diffs with an aws.ec2.Route resource, the first thing to check is that the correct attribute is being specified. NOTE on combining vpc_endpoint_id and destination_prefix_list_id attributes: To associate a Gateway VPC Endpoint (such as S3) with destination prefix list, use the aws.ec2.VpcEndpointRouteTableAssociation resource instead.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const r = new aws.ec2.Route("r", {
routeTableId: testing.id,
destinationCidrBlock: "10.0.1.0/22",
vpcPeeringConnectionId: "pcx-45ff3dc1",
});
import pulumi
import pulumi_aws as aws
r = aws.ec2.Route("r",
route_table_id=testing["id"],
destination_cidr_block="10.0.1.0/22",
vpc_peering_connection_id="pcx-45ff3dc1")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var r = new Aws.Ec2.Route("r", new()
{
RouteTableId = testing.Id,
DestinationCidrBlock = "10.0.1.0/22",
VpcPeeringConnectionId = "pcx-45ff3dc1",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ec2.NewRoute(ctx, "r", &ec2.RouteArgs{
RouteTableId: pulumi.Any(testing.Id),
DestinationCidrBlock: pulumi.String("10.0.1.0/22"),
VpcPeeringConnectionId: pulumi.String("pcx-45ff3dc1"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Route;
import com.pulumi.aws.ec2.RouteArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var r = new Route("r", RouteArgs.builder()
.routeTableId(testing.id())
.destinationCidrBlock("10.0.1.0/22")
.vpcPeeringConnectionId("pcx-45ff3dc1")
.build());
}
}
resources:
r:
type: aws:ec2:Route
properties:
routeTableId: ${testing.id}
destinationCidrBlock: 10.0.1.0/22
vpcPeeringConnectionId: pcx-45ff3dc1

Example IPv6 Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const vpc = new aws.ec2.Vpc("vpc", {
cidrBlock: "10.1.0.0/16",
assignGeneratedIpv6CidrBlock: true,
});
const egress = new aws.ec2.EgressOnlyInternetGateway("egress", {vpcId: vpc.id});
const r = new aws.ec2.Route("r", {
routeTableId: "rtb-4fbb3ac4",
destinationIpv6CidrBlock: "::/0",
egressOnlyGatewayId: egress.id,
});
import pulumi
import pulumi_aws as aws
vpc = aws.ec2.Vpc("vpc",
cidr_block="10.1.0.0/16",
assign_generated_ipv6_cidr_block=True)
egress = aws.ec2.EgressOnlyInternetGateway("egress", vpc_id=vpc.id)
r = aws.ec2.Route("r",
route_table_id="rtb-4fbb3ac4",
destination_ipv6_cidr_block="::/0",
egress_only_gateway_id=egress.id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var vpc = new Aws.Ec2.Vpc("vpc", new()
{
CidrBlock = "10.1.0.0/16",
AssignGeneratedIpv6CidrBlock = true,
});
var egress = new Aws.Ec2.EgressOnlyInternetGateway("egress", new()
{
VpcId = vpc.Id,
});
var r = new Aws.Ec2.Route("r", new()
{
RouteTableId = "rtb-4fbb3ac4",
DestinationIpv6CidrBlock = "::/0",
EgressOnlyGatewayId = egress.Id,
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
vpc, err := ec2.NewVpc(ctx, "vpc", &ec2.VpcArgs{
CidrBlock: pulumi.String("10.1.0.0/16"),
AssignGeneratedIpv6CidrBlock: pulumi.Bool(true),
})
if err != nil {
return err
}
egress, err := ec2.NewEgressOnlyInternetGateway(ctx, "egress", &ec2.EgressOnlyInternetGatewayArgs{
VpcId: vpc.ID(),
})
if err != nil {
return err
}
_, err = ec2.NewRoute(ctx, "r", &ec2.RouteArgs{
RouteTableId: pulumi.String("rtb-4fbb3ac4"),
DestinationIpv6CidrBlock: pulumi.String("::/0"),
EgressOnlyGatewayId: egress.ID(),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Vpc;
import com.pulumi.aws.ec2.VpcArgs;
import com.pulumi.aws.ec2.EgressOnlyInternetGateway;
import com.pulumi.aws.ec2.EgressOnlyInternetGatewayArgs;
import com.pulumi.aws.ec2.Route;
import com.pulumi.aws.ec2.RouteArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var vpc = new Vpc("vpc", VpcArgs.builder()
.cidrBlock("10.1.0.0/16")
.assignGeneratedIpv6CidrBlock(true)
.build());
var egress = new EgressOnlyInternetGateway("egress", EgressOnlyInternetGatewayArgs.builder()
.vpcId(vpc.id())
.build());
var r = new Route("r", RouteArgs.builder()
.routeTableId("rtb-4fbb3ac4")
.destinationIpv6CidrBlock("::/0")
.egressOnlyGatewayId(egress.id())
.build());
}
}
resources:
vpc:
type: aws:ec2:Vpc
properties:
cidrBlock: 10.1.0.0/16
assignGeneratedIpv6CidrBlock: true
egress:
type: aws:ec2:EgressOnlyInternetGateway
properties:
vpcId: ${vpc.id}
r:
type: aws:ec2:Route
properties:
routeTableId: rtb-4fbb3ac4
destinationIpv6CidrBlock: ::/0
egressOnlyGatewayId: ${egress.id}

Import

Import a route in route table rtb-656C65616E6F72 with an IPv6 destination CIDR of 2620:0:2d0:200::8/125: Import a route in route table rtb-656C65616E6F72 with a managed prefix list destination of pl-0570a1d2d725c16be: Using pulumi import to import individual routes using ROUTETABLEID_DESTINATION. Import local routes using the VPC's IPv4 or IPv6 CIDR blocks. For example: Import a route in route table rtb-656C65616E6F72 with an IPv4 destination CIDR of 10.42.0.0/16:

$ pulumi import aws:ec2/route:Route my_route rtb-656C65616E6F72_10.42.0.0/16

Import a route in route table rtb-656C65616E6F72 with an IPv6 destination CIDR of 2620:0:2d0:200::8/125:

$ pulumi import aws:ec2/route:Route my_route rtb-656C65616E6F72_2620:0:2d0:200::8/125

Import a route in route table rtb-656C65616E6F72 with a managed prefix list destination of pl-0570a1d2d725c16be:

$ pulumi import aws:ec2/route:Route my_route rtb-656C65616E6F72_pl-0570a1d2d725c16be

Constructors

Link copied to clipboard
constructor(carrierGatewayId: Output<String>? = null, coreNetworkArn: Output<String>? = null, destinationCidrBlock: Output<String>? = null, destinationIpv6CidrBlock: Output<String>? = null, destinationPrefixListId: Output<String>? = null, egressOnlyGatewayId: Output<String>? = null, gatewayId: Output<String>? = null, localGatewayId: Output<String>? = null, natGatewayId: Output<String>? = null, networkInterfaceId: Output<String>? = null, routeTableId: Output<String>? = null, transitGatewayId: Output<String>? = null, vpcEndpointId: Output<String>? = null, vpcPeeringConnectionId: Output<String>? = null)

Properties

Link copied to clipboard
val carrierGatewayId: Output<String>? = null

Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.

Link copied to clipboard
val coreNetworkArn: Output<String>? = null

The Amazon Resource Name (ARN) of a core network.

Link copied to clipboard
val destinationCidrBlock: Output<String>? = null

The destination CIDR block.

Link copied to clipboard
val destinationIpv6CidrBlock: Output<String>? = null

The destination IPv6 CIDR block.

Link copied to clipboard
val destinationPrefixListId: Output<String>? = null

The ID of a managed prefix list destination. One of the following target arguments must be supplied:

Link copied to clipboard
val egressOnlyGatewayId: Output<String>? = null

Identifier of a VPC Egress Only Internet Gateway.

Link copied to clipboard
val gatewayId: Output<String>? = null

Identifier of a VPC internet gateway or a virtual private gateway. Specify local when updating a previously imported local route.

Link copied to clipboard
val localGatewayId: Output<String>? = null

Identifier of a Outpost local gateway.

Link copied to clipboard
val natGatewayId: Output<String>? = null

Identifier of a VPC NAT gateway.

Link copied to clipboard
val networkInterfaceId: Output<String>? = null

Identifier of an EC2 network interface.

Link copied to clipboard
val routeTableId: Output<String>? = null

The ID of the routing table. One of the following destination arguments must be supplied:

Link copied to clipboard
val transitGatewayId: Output<String>? = null

Identifier of an EC2 Transit Gateway.

Link copied to clipboard
val vpcEndpointId: Output<String>? = null

Identifier of a VPC Endpoint.

Link copied to clipboard
val vpcPeeringConnectionId: Output<String>? = null

Identifier of a VPC peering connection. Note that the default route, mapping the VPC's CIDR block to "local", is created implicitly and cannot be specified.

Functions

Link copied to clipboard
open override fun toJava(): RouteArgs