aws.ec2.Route
Explore with Pulumi AI
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_idattribute: The AWS API is very forgiving with the resource ID passed in thegateway_idattribute. For example anaws.ec2.Routeresource can be created with anaws.ec2.NatGatewayoraws.ec2.EgressOnlyInternetGatewayID specified for thegateway_idattribute. Specifying anything other than anaws.ec2.InternetGatewayoraws.ec2.VpnGatewayID 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 anaws.ec2.Routeresource, the first thing to check is that the correct attribute is being specified.
NOTE on combining
vpc_endpoint_idanddestination_prefix_list_idattributes: To associate a Gateway VPC Endpoint (such as S3) with destination prefix list, use theaws.ec2.VpcEndpointRouteTableAssociationresource 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")
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
	})
}
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 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)
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
	})
}
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 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}
Create Route Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Route(name: string, args: RouteArgs, opts?: CustomResourceOptions);@overload
def Route(resource_name: str,
          args: RouteArgs,
          opts: Optional[ResourceOptions] = None)
@overload
def Route(resource_name: str,
          opts: Optional[ResourceOptions] = None,
          route_table_id: Optional[str] = None,
          gateway_id: Optional[str] = None,
          destination_cidr_block: Optional[str] = None,
          destination_ipv6_cidr_block: Optional[str] = None,
          destination_prefix_list_id: Optional[str] = None,
          egress_only_gateway_id: Optional[str] = None,
          carrier_gateway_id: Optional[str] = None,
          local_gateway_id: Optional[str] = None,
          nat_gateway_id: Optional[str] = None,
          network_interface_id: Optional[str] = None,
          core_network_arn: Optional[str] = None,
          transit_gateway_id: Optional[str] = None,
          vpc_endpoint_id: Optional[str] = None,
          vpc_peering_connection_id: Optional[str] = None)func NewRoute(ctx *Context, name string, args RouteArgs, opts ...ResourceOption) (*Route, error)public Route(string name, RouteArgs args, CustomResourceOptions? opts = null)type: aws:ec2:Route
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args RouteArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args RouteArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args RouteArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RouteArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RouteArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var examplerouteResourceResourceFromEc2route = new Aws.Ec2.Route("examplerouteResourceResourceFromEc2route", new()
{
    RouteTableId = "string",
    GatewayId = "string",
    DestinationCidrBlock = "string",
    DestinationIpv6CidrBlock = "string",
    DestinationPrefixListId = "string",
    EgressOnlyGatewayId = "string",
    CarrierGatewayId = "string",
    LocalGatewayId = "string",
    NatGatewayId = "string",
    NetworkInterfaceId = "string",
    CoreNetworkArn = "string",
    TransitGatewayId = "string",
    VpcEndpointId = "string",
    VpcPeeringConnectionId = "string",
});
example, err := ec2.NewRoute(ctx, "examplerouteResourceResourceFromEc2route", &ec2.RouteArgs{
	RouteTableId:             pulumi.String("string"),
	GatewayId:                pulumi.String("string"),
	DestinationCidrBlock:     pulumi.String("string"),
	DestinationIpv6CidrBlock: pulumi.String("string"),
	DestinationPrefixListId:  pulumi.String("string"),
	EgressOnlyGatewayId:      pulumi.String("string"),
	CarrierGatewayId:         pulumi.String("string"),
	LocalGatewayId:           pulumi.String("string"),
	NatGatewayId:             pulumi.String("string"),
	NetworkInterfaceId:       pulumi.String("string"),
	CoreNetworkArn:           pulumi.String("string"),
	TransitGatewayId:         pulumi.String("string"),
	VpcEndpointId:            pulumi.String("string"),
	VpcPeeringConnectionId:   pulumi.String("string"),
})
var examplerouteResourceResourceFromEc2route = new Route("examplerouteResourceResourceFromEc2route", RouteArgs.builder()
    .routeTableId("string")
    .gatewayId("string")
    .destinationCidrBlock("string")
    .destinationIpv6CidrBlock("string")
    .destinationPrefixListId("string")
    .egressOnlyGatewayId("string")
    .carrierGatewayId("string")
    .localGatewayId("string")
    .natGatewayId("string")
    .networkInterfaceId("string")
    .coreNetworkArn("string")
    .transitGatewayId("string")
    .vpcEndpointId("string")
    .vpcPeeringConnectionId("string")
    .build());
exampleroute_resource_resource_from_ec2route = aws.ec2.Route("examplerouteResourceResourceFromEc2route",
    route_table_id="string",
    gateway_id="string",
    destination_cidr_block="string",
    destination_ipv6_cidr_block="string",
    destination_prefix_list_id="string",
    egress_only_gateway_id="string",
    carrier_gateway_id="string",
    local_gateway_id="string",
    nat_gateway_id="string",
    network_interface_id="string",
    core_network_arn="string",
    transit_gateway_id="string",
    vpc_endpoint_id="string",
    vpc_peering_connection_id="string")
const examplerouteResourceResourceFromEc2route = new aws.ec2.Route("examplerouteResourceResourceFromEc2route", {
    routeTableId: "string",
    gatewayId: "string",
    destinationCidrBlock: "string",
    destinationIpv6CidrBlock: "string",
    destinationPrefixListId: "string",
    egressOnlyGatewayId: "string",
    carrierGatewayId: "string",
    localGatewayId: "string",
    natGatewayId: "string",
    networkInterfaceId: "string",
    coreNetworkArn: "string",
    transitGatewayId: "string",
    vpcEndpointId: "string",
    vpcPeeringConnectionId: "string",
});
type: aws:ec2:Route
properties:
    carrierGatewayId: string
    coreNetworkArn: string
    destinationCidrBlock: string
    destinationIpv6CidrBlock: string
    destinationPrefixListId: string
    egressOnlyGatewayId: string
    gatewayId: string
    localGatewayId: string
    natGatewayId: string
    networkInterfaceId: string
    routeTableId: string
    transitGatewayId: string
    vpcEndpointId: string
    vpcPeeringConnectionId: string
Route Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Route resource accepts the following input properties:
- RouteTable stringId 
- The ID of the routing table. - One of the following destination arguments must be supplied: 
- CarrierGateway stringId 
- Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.
- CoreNetwork stringArn 
- The Amazon Resource Name (ARN) of a core network.
- DestinationCidr stringBlock 
- The destination CIDR block.
- DestinationIpv6Cidr stringBlock 
- The destination IPv6 CIDR block.
- DestinationPrefix stringList Id 
- The ID of a managed prefix list destination. - One of the following target arguments must be supplied: 
- EgressOnly stringGateway Id 
- Identifier of a VPC Egress Only Internet Gateway.
- GatewayId string
- Identifier of a VPC internet gateway or a virtual private gateway. Specify localwhen updating a previously imported local route.
- LocalGateway stringId 
- Identifier of a Outpost local gateway.
- NatGateway stringId 
- Identifier of a VPC NAT gateway.
- NetworkInterface stringId 
- Identifier of an EC2 network interface.
- TransitGateway stringId 
- Identifier of an EC2 Transit Gateway.
- VpcEndpoint stringId 
- Identifier of a VPC Endpoint.
- VpcPeering stringConnection Id 
- 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. 
- RouteTable stringId 
- The ID of the routing table. - One of the following destination arguments must be supplied: 
- CarrierGateway stringId 
- Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.
- CoreNetwork stringArn 
- The Amazon Resource Name (ARN) of a core network.
- DestinationCidr stringBlock 
- The destination CIDR block.
- DestinationIpv6Cidr stringBlock 
- The destination IPv6 CIDR block.
- DestinationPrefix stringList Id 
- The ID of a managed prefix list destination. - One of the following target arguments must be supplied: 
- EgressOnly stringGateway Id 
- Identifier of a VPC Egress Only Internet Gateway.
- GatewayId string
- Identifier of a VPC internet gateway or a virtual private gateway. Specify localwhen updating a previously imported local route.
- LocalGateway stringId 
- Identifier of a Outpost local gateway.
- NatGateway stringId 
- Identifier of a VPC NAT gateway.
- NetworkInterface stringId 
- Identifier of an EC2 network interface.
- TransitGateway stringId 
- Identifier of an EC2 Transit Gateway.
- VpcEndpoint stringId 
- Identifier of a VPC Endpoint.
- VpcPeering stringConnection Id 
- 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. 
- routeTable StringId 
- The ID of the routing table. - One of the following destination arguments must be supplied: 
- carrierGateway StringId 
- Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.
- coreNetwork StringArn 
- The Amazon Resource Name (ARN) of a core network.
- destinationCidr StringBlock 
- The destination CIDR block.
- destinationIpv6Cidr StringBlock 
- The destination IPv6 CIDR block.
- destinationPrefix StringList Id 
- The ID of a managed prefix list destination. - One of the following target arguments must be supplied: 
- egressOnly StringGateway Id 
- Identifier of a VPC Egress Only Internet Gateway.
- gatewayId String
- Identifier of a VPC internet gateway or a virtual private gateway. Specify localwhen updating a previously imported local route.
- localGateway StringId 
- Identifier of a Outpost local gateway.
- natGateway StringId 
- Identifier of a VPC NAT gateway.
- networkInterface StringId 
- Identifier of an EC2 network interface.
- transitGateway StringId 
- Identifier of an EC2 Transit Gateway.
- vpcEndpoint StringId 
- Identifier of a VPC Endpoint.
- vpcPeering StringConnection Id 
- 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. 
- routeTable stringId 
- The ID of the routing table. - One of the following destination arguments must be supplied: 
- carrierGateway stringId 
- Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.
- coreNetwork stringArn 
- The Amazon Resource Name (ARN) of a core network.
- destinationCidr stringBlock 
- The destination CIDR block.
- destinationIpv6Cidr stringBlock 
- The destination IPv6 CIDR block.
- destinationPrefix stringList Id 
- The ID of a managed prefix list destination. - One of the following target arguments must be supplied: 
- egressOnly stringGateway Id 
- Identifier of a VPC Egress Only Internet Gateway.
- gatewayId string
- Identifier of a VPC internet gateway or a virtual private gateway. Specify localwhen updating a previously imported local route.
- localGateway stringId 
- Identifier of a Outpost local gateway.
- natGateway stringId 
- Identifier of a VPC NAT gateway.
- networkInterface stringId 
- Identifier of an EC2 network interface.
- transitGateway stringId 
- Identifier of an EC2 Transit Gateway.
- vpcEndpoint stringId 
- Identifier of a VPC Endpoint.
- vpcPeering stringConnection Id 
- 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. 
- route_table_ strid 
- The ID of the routing table. - One of the following destination arguments must be supplied: 
- carrier_gateway_ strid 
- Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.
- core_network_ strarn 
- The Amazon Resource Name (ARN) of a core network.
- destination_cidr_ strblock 
- The destination CIDR block.
- destination_ipv6_ strcidr_ block 
- The destination IPv6 CIDR block.
- destination_prefix_ strlist_ id 
- The ID of a managed prefix list destination. - One of the following target arguments must be supplied: 
- egress_only_ strgateway_ id 
- Identifier of a VPC Egress Only Internet Gateway.
- gateway_id str
- Identifier of a VPC internet gateway or a virtual private gateway. Specify localwhen updating a previously imported local route.
- local_gateway_ strid 
- Identifier of a Outpost local gateway.
- nat_gateway_ strid 
- Identifier of a VPC NAT gateway.
- network_interface_ strid 
- Identifier of an EC2 network interface.
- transit_gateway_ strid 
- Identifier of an EC2 Transit Gateway.
- vpc_endpoint_ strid 
- Identifier of a VPC Endpoint.
- vpc_peering_ strconnection_ id 
- 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. 
- routeTable StringId 
- The ID of the routing table. - One of the following destination arguments must be supplied: 
- carrierGateway StringId 
- Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.
- coreNetwork StringArn 
- The Amazon Resource Name (ARN) of a core network.
- destinationCidr StringBlock 
- The destination CIDR block.
- destinationIpv6Cidr StringBlock 
- The destination IPv6 CIDR block.
- destinationPrefix StringList Id 
- The ID of a managed prefix list destination. - One of the following target arguments must be supplied: 
- egressOnly StringGateway Id 
- Identifier of a VPC Egress Only Internet Gateway.
- gatewayId String
- Identifier of a VPC internet gateway or a virtual private gateway. Specify localwhen updating a previously imported local route.
- localGateway StringId 
- Identifier of a Outpost local gateway.
- natGateway StringId 
- Identifier of a VPC NAT gateway.
- networkInterface StringId 
- Identifier of an EC2 network interface.
- transitGateway StringId 
- Identifier of an EC2 Transit Gateway.
- vpcEndpoint StringId 
- Identifier of a VPC Endpoint.
- vpcPeering StringConnection Id 
- 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. 
Outputs
All input properties are implicitly available as output properties. Additionally, the Route resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- InstanceId string
- Identifier of an EC2 instance.
- InstanceOwner stringId 
- The AWS account ID of the owner of the EC2 instance.
- Origin string
- How the route was created - CreateRouteTable,CreateRouteorEnableVgwRoutePropagation.
- State string
- The state of the route - activeorblackhole.
- Id string
- The provider-assigned unique ID for this managed resource.
- InstanceId string
- Identifier of an EC2 instance.
- InstanceOwner stringId 
- The AWS account ID of the owner of the EC2 instance.
- Origin string
- How the route was created - CreateRouteTable,CreateRouteorEnableVgwRoutePropagation.
- State string
- The state of the route - activeorblackhole.
- id String
- The provider-assigned unique ID for this managed resource.
- instanceId String
- Identifier of an EC2 instance.
- instanceOwner StringId 
- The AWS account ID of the owner of the EC2 instance.
- origin String
- How the route was created - CreateRouteTable,CreateRouteorEnableVgwRoutePropagation.
- state String
- The state of the route - activeorblackhole.
- id string
- The provider-assigned unique ID for this managed resource.
- instanceId string
- Identifier of an EC2 instance.
- instanceOwner stringId 
- The AWS account ID of the owner of the EC2 instance.
- origin string
- How the route was created - CreateRouteTable,CreateRouteorEnableVgwRoutePropagation.
- state string
- The state of the route - activeorblackhole.
- id str
- The provider-assigned unique ID for this managed resource.
- instance_id str
- Identifier of an EC2 instance.
- instance_owner_ strid 
- The AWS account ID of the owner of the EC2 instance.
- origin str
- How the route was created - CreateRouteTable,CreateRouteorEnableVgwRoutePropagation.
- state str
- The state of the route - activeorblackhole.
- id String
- The provider-assigned unique ID for this managed resource.
- instanceId String
- Identifier of an EC2 instance.
- instanceOwner StringId 
- The AWS account ID of the owner of the EC2 instance.
- origin String
- How the route was created - CreateRouteTable,CreateRouteorEnableVgwRoutePropagation.
- state String
- The state of the route - activeorblackhole.
Look up Existing Route Resource
Get an existing Route resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: RouteState, opts?: CustomResourceOptions): Route@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        carrier_gateway_id: Optional[str] = None,
        core_network_arn: Optional[str] = None,
        destination_cidr_block: Optional[str] = None,
        destination_ipv6_cidr_block: Optional[str] = None,
        destination_prefix_list_id: Optional[str] = None,
        egress_only_gateway_id: Optional[str] = None,
        gateway_id: Optional[str] = None,
        instance_id: Optional[str] = None,
        instance_owner_id: Optional[str] = None,
        local_gateway_id: Optional[str] = None,
        nat_gateway_id: Optional[str] = None,
        network_interface_id: Optional[str] = None,
        origin: Optional[str] = None,
        route_table_id: Optional[str] = None,
        state: Optional[str] = None,
        transit_gateway_id: Optional[str] = None,
        vpc_endpoint_id: Optional[str] = None,
        vpc_peering_connection_id: Optional[str] = None) -> Routefunc GetRoute(ctx *Context, name string, id IDInput, state *RouteState, opts ...ResourceOption) (*Route, error)public static Route Get(string name, Input<string> id, RouteState? state, CustomResourceOptions? opts = null)public static Route get(String name, Output<String> id, RouteState state, CustomResourceOptions options)resources:  _:    type: aws:ec2:Route    get:      id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- CarrierGateway stringId 
- Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.
- CoreNetwork stringArn 
- The Amazon Resource Name (ARN) of a core network.
- DestinationCidr stringBlock 
- The destination CIDR block.
- DestinationIpv6Cidr stringBlock 
- The destination IPv6 CIDR block.
- DestinationPrefix stringList Id 
- The ID of a managed prefix list destination. - One of the following target arguments must be supplied: 
- EgressOnly stringGateway Id 
- Identifier of a VPC Egress Only Internet Gateway.
- GatewayId string
- Identifier of a VPC internet gateway or a virtual private gateway. Specify localwhen updating a previously imported local route.
- InstanceId string
- Identifier of an EC2 instance.
- InstanceOwner stringId 
- The AWS account ID of the owner of the EC2 instance.
- LocalGateway stringId 
- Identifier of a Outpost local gateway.
- NatGateway stringId 
- Identifier of a VPC NAT gateway.
- NetworkInterface stringId 
- Identifier of an EC2 network interface.
- Origin string
- How the route was created - CreateRouteTable,CreateRouteorEnableVgwRoutePropagation.
- RouteTable stringId 
- The ID of the routing table. - One of the following destination arguments must be supplied: 
- State string
- The state of the route - activeorblackhole.
- TransitGateway stringId 
- Identifier of an EC2 Transit Gateway.
- VpcEndpoint stringId 
- Identifier of a VPC Endpoint.
- VpcPeering stringConnection Id 
- 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. 
- CarrierGateway stringId 
- Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.
- CoreNetwork stringArn 
- The Amazon Resource Name (ARN) of a core network.
- DestinationCidr stringBlock 
- The destination CIDR block.
- DestinationIpv6Cidr stringBlock 
- The destination IPv6 CIDR block.
- DestinationPrefix stringList Id 
- The ID of a managed prefix list destination. - One of the following target arguments must be supplied: 
- EgressOnly stringGateway Id 
- Identifier of a VPC Egress Only Internet Gateway.
- GatewayId string
- Identifier of a VPC internet gateway or a virtual private gateway. Specify localwhen updating a previously imported local route.
- InstanceId string
- Identifier of an EC2 instance.
- InstanceOwner stringId 
- The AWS account ID of the owner of the EC2 instance.
- LocalGateway stringId 
- Identifier of a Outpost local gateway.
- NatGateway stringId 
- Identifier of a VPC NAT gateway.
- NetworkInterface stringId 
- Identifier of an EC2 network interface.
- Origin string
- How the route was created - CreateRouteTable,CreateRouteorEnableVgwRoutePropagation.
- RouteTable stringId 
- The ID of the routing table. - One of the following destination arguments must be supplied: 
- State string
- The state of the route - activeorblackhole.
- TransitGateway stringId 
- Identifier of an EC2 Transit Gateway.
- VpcEndpoint stringId 
- Identifier of a VPC Endpoint.
- VpcPeering stringConnection Id 
- 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. 
- carrierGateway StringId 
- Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.
- coreNetwork StringArn 
- The Amazon Resource Name (ARN) of a core network.
- destinationCidr StringBlock 
- The destination CIDR block.
- destinationIpv6Cidr StringBlock 
- The destination IPv6 CIDR block.
- destinationPrefix StringList Id 
- The ID of a managed prefix list destination. - One of the following target arguments must be supplied: 
- egressOnly StringGateway Id 
- Identifier of a VPC Egress Only Internet Gateway.
- gatewayId String
- Identifier of a VPC internet gateway or a virtual private gateway. Specify localwhen updating a previously imported local route.
- instanceId String
- Identifier of an EC2 instance.
- instanceOwner StringId 
- The AWS account ID of the owner of the EC2 instance.
- localGateway StringId 
- Identifier of a Outpost local gateway.
- natGateway StringId 
- Identifier of a VPC NAT gateway.
- networkInterface StringId 
- Identifier of an EC2 network interface.
- origin String
- How the route was created - CreateRouteTable,CreateRouteorEnableVgwRoutePropagation.
- routeTable StringId 
- The ID of the routing table. - One of the following destination arguments must be supplied: 
- state String
- The state of the route - activeorblackhole.
- transitGateway StringId 
- Identifier of an EC2 Transit Gateway.
- vpcEndpoint StringId 
- Identifier of a VPC Endpoint.
- vpcPeering StringConnection Id 
- 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. 
- carrierGateway stringId 
- Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.
- coreNetwork stringArn 
- The Amazon Resource Name (ARN) of a core network.
- destinationCidr stringBlock 
- The destination CIDR block.
- destinationIpv6Cidr stringBlock 
- The destination IPv6 CIDR block.
- destinationPrefix stringList Id 
- The ID of a managed prefix list destination. - One of the following target arguments must be supplied: 
- egressOnly stringGateway Id 
- Identifier of a VPC Egress Only Internet Gateway.
- gatewayId string
- Identifier of a VPC internet gateway or a virtual private gateway. Specify localwhen updating a previously imported local route.
- instanceId string
- Identifier of an EC2 instance.
- instanceOwner stringId 
- The AWS account ID of the owner of the EC2 instance.
- localGateway stringId 
- Identifier of a Outpost local gateway.
- natGateway stringId 
- Identifier of a VPC NAT gateway.
- networkInterface stringId 
- Identifier of an EC2 network interface.
- origin string
- How the route was created - CreateRouteTable,CreateRouteorEnableVgwRoutePropagation.
- routeTable stringId 
- The ID of the routing table. - One of the following destination arguments must be supplied: 
- state string
- The state of the route - activeorblackhole.
- transitGateway stringId 
- Identifier of an EC2 Transit Gateway.
- vpcEndpoint stringId 
- Identifier of a VPC Endpoint.
- vpcPeering stringConnection Id 
- 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. 
- carrier_gateway_ strid 
- Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.
- core_network_ strarn 
- The Amazon Resource Name (ARN) of a core network.
- destination_cidr_ strblock 
- The destination CIDR block.
- destination_ipv6_ strcidr_ block 
- The destination IPv6 CIDR block.
- destination_prefix_ strlist_ id 
- The ID of a managed prefix list destination. - One of the following target arguments must be supplied: 
- egress_only_ strgateway_ id 
- Identifier of a VPC Egress Only Internet Gateway.
- gateway_id str
- Identifier of a VPC internet gateway or a virtual private gateway. Specify localwhen updating a previously imported local route.
- instance_id str
- Identifier of an EC2 instance.
- instance_owner_ strid 
- The AWS account ID of the owner of the EC2 instance.
- local_gateway_ strid 
- Identifier of a Outpost local gateway.
- nat_gateway_ strid 
- Identifier of a VPC NAT gateway.
- network_interface_ strid 
- Identifier of an EC2 network interface.
- origin str
- How the route was created - CreateRouteTable,CreateRouteorEnableVgwRoutePropagation.
- route_table_ strid 
- The ID of the routing table. - One of the following destination arguments must be supplied: 
- state str
- The state of the route - activeorblackhole.
- transit_gateway_ strid 
- Identifier of an EC2 Transit Gateway.
- vpc_endpoint_ strid 
- Identifier of a VPC Endpoint.
- vpc_peering_ strconnection_ id 
- 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. 
- carrierGateway StringId 
- Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.
- coreNetwork StringArn 
- The Amazon Resource Name (ARN) of a core network.
- destinationCidr StringBlock 
- The destination CIDR block.
- destinationIpv6Cidr StringBlock 
- The destination IPv6 CIDR block.
- destinationPrefix StringList Id 
- The ID of a managed prefix list destination. - One of the following target arguments must be supplied: 
- egressOnly StringGateway Id 
- Identifier of a VPC Egress Only Internet Gateway.
- gatewayId String
- Identifier of a VPC internet gateway or a virtual private gateway. Specify localwhen updating a previously imported local route.
- instanceId String
- Identifier of an EC2 instance.
- instanceOwner StringId 
- The AWS account ID of the owner of the EC2 instance.
- localGateway StringId 
- Identifier of a Outpost local gateway.
- natGateway StringId 
- Identifier of a VPC NAT gateway.
- networkInterface StringId 
- Identifier of an EC2 network interface.
- origin String
- How the route was created - CreateRouteTable,CreateRouteorEnableVgwRoutePropagation.
- routeTable StringId 
- The ID of the routing table. - One of the following destination arguments must be supplied: 
- state String
- The state of the route - activeorblackhole.
- transitGateway StringId 
- Identifier of an EC2 Transit Gateway.
- vpcEndpoint StringId 
- Identifier of a VPC Endpoint.
- vpcPeering StringConnection Id 
- 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. 
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
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the awsTerraform Provider.