1. Packages
  2. AWS
  3. API Docs
  4. ec2
  5. Route
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

aws.ec2.Route

Explore with Pulumi AI

aws logo
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

    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")
    
    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)
    public Route(String name, RouteArgs args)
    public Route(String name, RouteArgs args, CustomResourceOptions options)
    
    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:

    RouteTableId string

    The ID of the routing table.

    One of the following destination arguments must be supplied:

    CarrierGatewayId string
    Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.
    CoreNetworkArn string
    The Amazon Resource Name (ARN) of a core network.
    DestinationCidrBlock string
    The destination CIDR block.
    DestinationIpv6CidrBlock string
    The destination IPv6 CIDR block.
    DestinationPrefixListId string

    The ID of a managed prefix list destination.

    One of the following target arguments must be supplied:

    EgressOnlyGatewayId string
    Identifier of a VPC Egress Only Internet Gateway.
    GatewayId string
    Identifier of a VPC internet gateway or a virtual private gateway. Specify local when updating a previously imported local route.
    LocalGatewayId string
    Identifier of a Outpost local gateway.
    NatGatewayId string
    Identifier of a VPC NAT gateway.
    NetworkInterfaceId string
    Identifier of an EC2 network interface.
    TransitGatewayId string
    Identifier of an EC2 Transit Gateway.
    VpcEndpointId string
    Identifier of a VPC Endpoint.
    VpcPeeringConnectionId string

    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.

    RouteTableId string

    The ID of the routing table.

    One of the following destination arguments must be supplied:

    CarrierGatewayId string
    Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.
    CoreNetworkArn string
    The Amazon Resource Name (ARN) of a core network.
    DestinationCidrBlock string
    The destination CIDR block.
    DestinationIpv6CidrBlock string
    The destination IPv6 CIDR block.
    DestinationPrefixListId string

    The ID of a managed prefix list destination.

    One of the following target arguments must be supplied:

    EgressOnlyGatewayId string
    Identifier of a VPC Egress Only Internet Gateway.
    GatewayId string
    Identifier of a VPC internet gateway or a virtual private gateway. Specify local when updating a previously imported local route.
    LocalGatewayId string
    Identifier of a Outpost local gateway.
    NatGatewayId string
    Identifier of a VPC NAT gateway.
    NetworkInterfaceId string
    Identifier of an EC2 network interface.
    TransitGatewayId string
    Identifier of an EC2 Transit Gateway.
    VpcEndpointId string
    Identifier of a VPC Endpoint.
    VpcPeeringConnectionId string

    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.

    routeTableId String

    The ID of the routing table.

    One of the following destination arguments must be supplied:

    carrierGatewayId String
    Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.
    coreNetworkArn String
    The Amazon Resource Name (ARN) of a core network.
    destinationCidrBlock String
    The destination CIDR block.
    destinationIpv6CidrBlock String
    The destination IPv6 CIDR block.
    destinationPrefixListId String

    The ID of a managed prefix list destination.

    One of the following target arguments must be supplied:

    egressOnlyGatewayId String
    Identifier of a VPC Egress Only Internet Gateway.
    gatewayId String
    Identifier of a VPC internet gateway or a virtual private gateway. Specify local when updating a previously imported local route.
    localGatewayId String
    Identifier of a Outpost local gateway.
    natGatewayId String
    Identifier of a VPC NAT gateway.
    networkInterfaceId String
    Identifier of an EC2 network interface.
    transitGatewayId String
    Identifier of an EC2 Transit Gateway.
    vpcEndpointId String
    Identifier of a VPC Endpoint.
    vpcPeeringConnectionId String

    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.

    routeTableId string

    The ID of the routing table.

    One of the following destination arguments must be supplied:

    carrierGatewayId string
    Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.
    coreNetworkArn string
    The Amazon Resource Name (ARN) of a core network.
    destinationCidrBlock string
    The destination CIDR block.
    destinationIpv6CidrBlock string
    The destination IPv6 CIDR block.
    destinationPrefixListId string

    The ID of a managed prefix list destination.

    One of the following target arguments must be supplied:

    egressOnlyGatewayId string
    Identifier of a VPC Egress Only Internet Gateway.
    gatewayId string
    Identifier of a VPC internet gateway or a virtual private gateway. Specify local when updating a previously imported local route.
    localGatewayId string
    Identifier of a Outpost local gateway.
    natGatewayId string
    Identifier of a VPC NAT gateway.
    networkInterfaceId string
    Identifier of an EC2 network interface.
    transitGatewayId string
    Identifier of an EC2 Transit Gateway.
    vpcEndpointId string
    Identifier of a VPC Endpoint.
    vpcPeeringConnectionId string

    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_id str

    The ID of the routing table.

    One of the following destination arguments must be supplied:

    carrier_gateway_id str
    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_arn str
    The Amazon Resource Name (ARN) of a core network.
    destination_cidr_block str
    The destination CIDR block.
    destination_ipv6_cidr_block str
    The destination IPv6 CIDR block.
    destination_prefix_list_id str

    The ID of a managed prefix list destination.

    One of the following target arguments must be supplied:

    egress_only_gateway_id str
    Identifier of a VPC Egress Only Internet Gateway.
    gateway_id str
    Identifier of a VPC internet gateway or a virtual private gateway. Specify local when updating a previously imported local route.
    local_gateway_id str
    Identifier of a Outpost local gateway.
    nat_gateway_id str
    Identifier of a VPC NAT gateway.
    network_interface_id str
    Identifier of an EC2 network interface.
    transit_gateway_id str
    Identifier of an EC2 Transit Gateway.
    vpc_endpoint_id str
    Identifier of a VPC Endpoint.
    vpc_peering_connection_id str

    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.

    routeTableId String

    The ID of the routing table.

    One of the following destination arguments must be supplied:

    carrierGatewayId String
    Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.
    coreNetworkArn String
    The Amazon Resource Name (ARN) of a core network.
    destinationCidrBlock String
    The destination CIDR block.
    destinationIpv6CidrBlock String
    The destination IPv6 CIDR block.
    destinationPrefixListId String

    The ID of a managed prefix list destination.

    One of the following target arguments must be supplied:

    egressOnlyGatewayId String
    Identifier of a VPC Egress Only Internet Gateway.
    gatewayId String
    Identifier of a VPC internet gateway or a virtual private gateway. Specify local when updating a previously imported local route.
    localGatewayId String
    Identifier of a Outpost local gateway.
    natGatewayId String
    Identifier of a VPC NAT gateway.
    networkInterfaceId String
    Identifier of an EC2 network interface.
    transitGatewayId String
    Identifier of an EC2 Transit Gateway.
    vpcEndpointId String
    Identifier of a VPC Endpoint.
    vpcPeeringConnectionId String

    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.
    InstanceOwnerId string
    The AWS account ID of the owner of the EC2 instance.
    Origin string
    How the route was created - CreateRouteTable, CreateRoute or EnableVgwRoutePropagation.
    State string
    The state of the route - active or blackhole.
    Id string
    The provider-assigned unique ID for this managed resource.
    InstanceId string
    Identifier of an EC2 instance.
    InstanceOwnerId string
    The AWS account ID of the owner of the EC2 instance.
    Origin string
    How the route was created - CreateRouteTable, CreateRoute or EnableVgwRoutePropagation.
    State string
    The state of the route - active or blackhole.
    id String
    The provider-assigned unique ID for this managed resource.
    instanceId String
    Identifier of an EC2 instance.
    instanceOwnerId String
    The AWS account ID of the owner of the EC2 instance.
    origin String
    How the route was created - CreateRouteTable, CreateRoute or EnableVgwRoutePropagation.
    state String
    The state of the route - active or blackhole.
    id string
    The provider-assigned unique ID for this managed resource.
    instanceId string
    Identifier of an EC2 instance.
    instanceOwnerId string
    The AWS account ID of the owner of the EC2 instance.
    origin string
    How the route was created - CreateRouteTable, CreateRoute or EnableVgwRoutePropagation.
    state string
    The state of the route - active or blackhole.
    id str
    The provider-assigned unique ID for this managed resource.
    instance_id str
    Identifier of an EC2 instance.
    instance_owner_id str
    The AWS account ID of the owner of the EC2 instance.
    origin str
    How the route was created - CreateRouteTable, CreateRoute or EnableVgwRoutePropagation.
    state str
    The state of the route - active or blackhole.
    id String
    The provider-assigned unique ID for this managed resource.
    instanceId String
    Identifier of an EC2 instance.
    instanceOwnerId String
    The AWS account ID of the owner of the EC2 instance.
    origin String
    How the route was created - CreateRouteTable, CreateRoute or EnableVgwRoutePropagation.
    state String
    The state of the route - active or blackhole.

    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) -> Route
    func 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)
    Resource lookup is not supported in YAML
    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.
    The following state arguments are supported:
    CarrierGatewayId string
    Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.
    CoreNetworkArn string
    The Amazon Resource Name (ARN) of a core network.
    DestinationCidrBlock string
    The destination CIDR block.
    DestinationIpv6CidrBlock string
    The destination IPv6 CIDR block.
    DestinationPrefixListId string

    The ID of a managed prefix list destination.

    One of the following target arguments must be supplied:

    EgressOnlyGatewayId string
    Identifier of a VPC Egress Only Internet Gateway.
    GatewayId string
    Identifier of a VPC internet gateway or a virtual private gateway. Specify local when updating a previously imported local route.
    InstanceId string
    Identifier of an EC2 instance.
    InstanceOwnerId string
    The AWS account ID of the owner of the EC2 instance.
    LocalGatewayId string
    Identifier of a Outpost local gateway.
    NatGatewayId string
    Identifier of a VPC NAT gateway.
    NetworkInterfaceId string
    Identifier of an EC2 network interface.
    Origin string
    How the route was created - CreateRouteTable, CreateRoute or EnableVgwRoutePropagation.
    RouteTableId string

    The ID of the routing table.

    One of the following destination arguments must be supplied:

    State string
    The state of the route - active or blackhole.
    TransitGatewayId string
    Identifier of an EC2 Transit Gateway.
    VpcEndpointId string
    Identifier of a VPC Endpoint.
    VpcPeeringConnectionId string

    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.

    CarrierGatewayId string
    Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.
    CoreNetworkArn string
    The Amazon Resource Name (ARN) of a core network.
    DestinationCidrBlock string
    The destination CIDR block.
    DestinationIpv6CidrBlock string
    The destination IPv6 CIDR block.
    DestinationPrefixListId string

    The ID of a managed prefix list destination.

    One of the following target arguments must be supplied:

    EgressOnlyGatewayId string
    Identifier of a VPC Egress Only Internet Gateway.
    GatewayId string
    Identifier of a VPC internet gateway or a virtual private gateway. Specify local when updating a previously imported local route.
    InstanceId string
    Identifier of an EC2 instance.
    InstanceOwnerId string
    The AWS account ID of the owner of the EC2 instance.
    LocalGatewayId string
    Identifier of a Outpost local gateway.
    NatGatewayId string
    Identifier of a VPC NAT gateway.
    NetworkInterfaceId string
    Identifier of an EC2 network interface.
    Origin string
    How the route was created - CreateRouteTable, CreateRoute or EnableVgwRoutePropagation.
    RouteTableId string

    The ID of the routing table.

    One of the following destination arguments must be supplied:

    State string
    The state of the route - active or blackhole.
    TransitGatewayId string
    Identifier of an EC2 Transit Gateway.
    VpcEndpointId string
    Identifier of a VPC Endpoint.
    VpcPeeringConnectionId string

    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.

    carrierGatewayId String
    Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.
    coreNetworkArn String
    The Amazon Resource Name (ARN) of a core network.
    destinationCidrBlock String
    The destination CIDR block.
    destinationIpv6CidrBlock String
    The destination IPv6 CIDR block.
    destinationPrefixListId String

    The ID of a managed prefix list destination.

    One of the following target arguments must be supplied:

    egressOnlyGatewayId String
    Identifier of a VPC Egress Only Internet Gateway.
    gatewayId String
    Identifier of a VPC internet gateway or a virtual private gateway. Specify local when updating a previously imported local route.
    instanceId String
    Identifier of an EC2 instance.
    instanceOwnerId String
    The AWS account ID of the owner of the EC2 instance.
    localGatewayId String
    Identifier of a Outpost local gateway.
    natGatewayId String
    Identifier of a VPC NAT gateway.
    networkInterfaceId String
    Identifier of an EC2 network interface.
    origin String
    How the route was created - CreateRouteTable, CreateRoute or EnableVgwRoutePropagation.
    routeTableId String

    The ID of the routing table.

    One of the following destination arguments must be supplied:

    state String
    The state of the route - active or blackhole.
    transitGatewayId String
    Identifier of an EC2 Transit Gateway.
    vpcEndpointId String
    Identifier of a VPC Endpoint.
    vpcPeeringConnectionId String

    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.

    carrierGatewayId string
    Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.
    coreNetworkArn string
    The Amazon Resource Name (ARN) of a core network.
    destinationCidrBlock string
    The destination CIDR block.
    destinationIpv6CidrBlock string
    The destination IPv6 CIDR block.
    destinationPrefixListId string

    The ID of a managed prefix list destination.

    One of the following target arguments must be supplied:

    egressOnlyGatewayId string
    Identifier of a VPC Egress Only Internet Gateway.
    gatewayId string
    Identifier of a VPC internet gateway or a virtual private gateway. Specify local when updating a previously imported local route.
    instanceId string
    Identifier of an EC2 instance.
    instanceOwnerId string
    The AWS account ID of the owner of the EC2 instance.
    localGatewayId string
    Identifier of a Outpost local gateway.
    natGatewayId string
    Identifier of a VPC NAT gateway.
    networkInterfaceId string
    Identifier of an EC2 network interface.
    origin string
    How the route was created - CreateRouteTable, CreateRoute or EnableVgwRoutePropagation.
    routeTableId string

    The ID of the routing table.

    One of the following destination arguments must be supplied:

    state string
    The state of the route - active or blackhole.
    transitGatewayId string
    Identifier of an EC2 Transit Gateway.
    vpcEndpointId string
    Identifier of a VPC Endpoint.
    vpcPeeringConnectionId string

    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_id str
    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_arn str
    The Amazon Resource Name (ARN) of a core network.
    destination_cidr_block str
    The destination CIDR block.
    destination_ipv6_cidr_block str
    The destination IPv6 CIDR block.
    destination_prefix_list_id str

    The ID of a managed prefix list destination.

    One of the following target arguments must be supplied:

    egress_only_gateway_id str
    Identifier of a VPC Egress Only Internet Gateway.
    gateway_id str
    Identifier of a VPC internet gateway or a virtual private gateway. Specify local when updating a previously imported local route.
    instance_id str
    Identifier of an EC2 instance.
    instance_owner_id str
    The AWS account ID of the owner of the EC2 instance.
    local_gateway_id str
    Identifier of a Outpost local gateway.
    nat_gateway_id str
    Identifier of a VPC NAT gateway.
    network_interface_id str
    Identifier of an EC2 network interface.
    origin str
    How the route was created - CreateRouteTable, CreateRoute or EnableVgwRoutePropagation.
    route_table_id str

    The ID of the routing table.

    One of the following destination arguments must be supplied:

    state str
    The state of the route - active or blackhole.
    transit_gateway_id str
    Identifier of an EC2 Transit Gateway.
    vpc_endpoint_id str
    Identifier of a VPC Endpoint.
    vpc_peering_connection_id str

    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.

    carrierGatewayId String
    Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.
    coreNetworkArn String
    The Amazon Resource Name (ARN) of a core network.
    destinationCidrBlock String
    The destination CIDR block.
    destinationIpv6CidrBlock String
    The destination IPv6 CIDR block.
    destinationPrefixListId String

    The ID of a managed prefix list destination.

    One of the following target arguments must be supplied:

    egressOnlyGatewayId String
    Identifier of a VPC Egress Only Internet Gateway.
    gatewayId String
    Identifier of a VPC internet gateway or a virtual private gateway. Specify local when updating a previously imported local route.
    instanceId String
    Identifier of an EC2 instance.
    instanceOwnerId String
    The AWS account ID of the owner of the EC2 instance.
    localGatewayId String
    Identifier of a Outpost local gateway.
    natGatewayId String
    Identifier of a VPC NAT gateway.
    networkInterfaceId String
    Identifier of an EC2 network interface.
    origin String
    How the route was created - CreateRouteTable, CreateRoute or EnableVgwRoutePropagation.
    routeTableId String

    The ID of the routing table.

    One of the following destination arguments must be supplied:

    state String
    The state of the route - active or blackhole.
    transitGatewayId String
    Identifier of an EC2 Transit Gateway.
    vpcEndpointId String
    Identifier of a VPC Endpoint.
    vpcPeeringConnectionId String

    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 aws Terraform Provider.
    aws logo
    AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi