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_id
attribute: The AWS API is very forgiving with the resource ID passed in thegateway_id
attribute. For example anaws.ec2.Route
resource can be created with anaws.ec2.NatGateway
oraws.ec2.EgressOnlyInternetGateway
ID specified for thegateway_id
attribute. Specifying anything other than anaws.ec2.InternetGateway
oraws.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 anaws.ec2.Route
resource, the first thing to check is that the correct attribute is being specified.
NOTE on combining
vpc_endpoint_id
anddestination_prefix_list_id
attributes: To associate a Gateway VPC Endpoint (such as S3) with destination prefix list, use theaws.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)
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
The Route resource accepts the following input properties:
- Route
Table stringId The ID of the routing table.
One of the following destination arguments must be supplied:
- Carrier
Gateway 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.
- Core
Network stringArn - The Amazon Resource Name (ARN) of a core network.
- Destination
Cidr stringBlock - The destination CIDR block.
- Destination
Ipv6Cidr stringBlock - The destination IPv6 CIDR block.
- Destination
Prefix stringList Id The ID of a managed prefix list destination.
One of the following target arguments must be supplied:
- Egress
Only stringGateway Id - Identifier of a VPC Egress Only Internet Gateway.
- Gateway
Id string - Identifier of a VPC internet gateway or a virtual private gateway. Specify
local
when updating a previously imported local route. - Local
Gateway stringId - Identifier of a Outpost local gateway.
- Nat
Gateway stringId - Identifier of a VPC NAT gateway.
- Network
Interface stringId - Identifier of an EC2 network interface.
- Transit
Gateway stringId - Identifier of an EC2 Transit Gateway.
- Vpc
Endpoint stringId - Identifier of a VPC Endpoint.
- Vpc
Peering 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 stringId The ID of the routing table.
One of the following destination arguments must be supplied:
- Carrier
Gateway 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.
- Core
Network stringArn - The Amazon Resource Name (ARN) of a core network.
- Destination
Cidr stringBlock - The destination CIDR block.
- Destination
Ipv6Cidr stringBlock - The destination IPv6 CIDR block.
- Destination
Prefix stringList Id The ID of a managed prefix list destination.
One of the following target arguments must be supplied:
- Egress
Only stringGateway Id - Identifier of a VPC Egress Only Internet Gateway.
- Gateway
Id string - Identifier of a VPC internet gateway or a virtual private gateway. Specify
local
when updating a previously imported local route. - Local
Gateway stringId - Identifier of a Outpost local gateway.
- Nat
Gateway stringId - Identifier of a VPC NAT gateway.
- Network
Interface stringId - Identifier of an EC2 network interface.
- Transit
Gateway stringId - Identifier of an EC2 Transit Gateway.
- Vpc
Endpoint stringId - Identifier of a VPC Endpoint.
- Vpc
Peering 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 StringId The ID of the routing table.
One of the following destination arguments must be supplied:
- carrier
Gateway 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.
- core
Network StringArn - The Amazon Resource Name (ARN) of a core network.
- destination
Cidr StringBlock - The destination CIDR block.
- destination
Ipv6Cidr StringBlock - The destination IPv6 CIDR block.
- destination
Prefix StringList Id The ID of a managed prefix list destination.
One of the following target arguments must be supplied:
- egress
Only StringGateway Id - Identifier of a VPC Egress Only Internet Gateway.
- gateway
Id String - Identifier of a VPC internet gateway or a virtual private gateway. Specify
local
when updating a previously imported local route. - local
Gateway StringId - Identifier of a Outpost local gateway.
- nat
Gateway StringId - Identifier of a VPC NAT gateway.
- network
Interface StringId - Identifier of an EC2 network interface.
- transit
Gateway StringId - Identifier of an EC2 Transit Gateway.
- vpc
Endpoint StringId - Identifier of a VPC Endpoint.
- vpc
Peering 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 stringId The ID of the routing table.
One of the following destination arguments must be supplied:
- carrier
Gateway 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.
- core
Network stringArn - The Amazon Resource Name (ARN) of a core network.
- destination
Cidr stringBlock - The destination CIDR block.
- destination
Ipv6Cidr stringBlock - The destination IPv6 CIDR block.
- destination
Prefix stringList Id The ID of a managed prefix list destination.
One of the following target arguments must be supplied:
- egress
Only stringGateway Id - Identifier of a VPC Egress Only Internet Gateway.
- gateway
Id string - Identifier of a VPC internet gateway or a virtual private gateway. Specify
local
when updating a previously imported local route. - local
Gateway stringId - Identifier of a Outpost local gateway.
- nat
Gateway stringId - Identifier of a VPC NAT gateway.
- network
Interface stringId - Identifier of an EC2 network interface.
- transit
Gateway stringId - Identifier of an EC2 Transit Gateway.
- vpc
Endpoint stringId - Identifier of a VPC Endpoint.
- vpc
Peering 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
local
when 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.
- route
Table StringId The ID of the routing table.
One of the following destination arguments must be supplied:
- carrier
Gateway 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.
- core
Network StringArn - The Amazon Resource Name (ARN) of a core network.
- destination
Cidr StringBlock - The destination CIDR block.
- destination
Ipv6Cidr StringBlock - The destination IPv6 CIDR block.
- destination
Prefix StringList Id The ID of a managed prefix list destination.
One of the following target arguments must be supplied:
- egress
Only StringGateway Id - Identifier of a VPC Egress Only Internet Gateway.
- gateway
Id String - Identifier of a VPC internet gateway or a virtual private gateway. Specify
local
when updating a previously imported local route. - local
Gateway StringId - Identifier of a Outpost local gateway.
- nat
Gateway StringId - Identifier of a VPC NAT gateway.
- network
Interface StringId - Identifier of an EC2 network interface.
- transit
Gateway StringId - Identifier of an EC2 Transit Gateway.
- vpc
Endpoint StringId - Identifier of a VPC Endpoint.
- vpc
Peering 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.
- Instance
Id string - Identifier of an EC2 instance.
- Instance
Owner stringId - The AWS account ID of the owner of the EC2 instance.
- Origin string
- How the route was created -
CreateRouteTable
,CreateRoute
orEnableVgwRoutePropagation
. - State string
- The state of the route -
active
orblackhole
.
- Id string
- The provider-assigned unique ID for this managed resource.
- Instance
Id string - Identifier of an EC2 instance.
- Instance
Owner stringId - The AWS account ID of the owner of the EC2 instance.
- Origin string
- How the route was created -
CreateRouteTable
,CreateRoute
orEnableVgwRoutePropagation
. - State string
- The state of the route -
active
orblackhole
.
- id String
- The provider-assigned unique ID for this managed resource.
- instance
Id String - Identifier of an EC2 instance.
- instance
Owner StringId - The AWS account ID of the owner of the EC2 instance.
- origin String
- How the route was created -
CreateRouteTable
,CreateRoute
orEnableVgwRoutePropagation
. - state String
- The state of the route -
active
orblackhole
.
- id string
- The provider-assigned unique ID for this managed resource.
- instance
Id string - Identifier of an EC2 instance.
- instance
Owner stringId - The AWS account ID of the owner of the EC2 instance.
- origin string
- How the route was created -
CreateRouteTable
,CreateRoute
orEnableVgwRoutePropagation
. - state string
- The state of the route -
active
orblackhole
.
- 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
,CreateRoute
orEnableVgwRoutePropagation
. - state str
- The state of the route -
active
orblackhole
.
- id String
- The provider-assigned unique ID for this managed resource.
- instance
Id String - Identifier of an EC2 instance.
- instance
Owner StringId - The AWS account ID of the owner of the EC2 instance.
- origin String
- How the route was created -
CreateRouteTable
,CreateRoute
orEnableVgwRoutePropagation
. - state String
- The state of the route -
active
orblackhole
.
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.
- Carrier
Gateway 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.
- Core
Network stringArn - The Amazon Resource Name (ARN) of a core network.
- Destination
Cidr stringBlock - The destination CIDR block.
- Destination
Ipv6Cidr stringBlock - The destination IPv6 CIDR block.
- Destination
Prefix stringList Id The ID of a managed prefix list destination.
One of the following target arguments must be supplied:
- Egress
Only stringGateway Id - Identifier of a VPC Egress Only Internet Gateway.
- Gateway
Id string - Identifier of a VPC internet gateway or a virtual private gateway. Specify
local
when updating a previously imported local route. - Instance
Id string - Identifier of an EC2 instance.
- Instance
Owner stringId - The AWS account ID of the owner of the EC2 instance.
- Local
Gateway stringId - Identifier of a Outpost local gateway.
- Nat
Gateway stringId - Identifier of a VPC NAT gateway.
- Network
Interface stringId - Identifier of an EC2 network interface.
- Origin string
- How the route was created -
CreateRouteTable
,CreateRoute
orEnableVgwRoutePropagation
. - Route
Table stringId The ID of the routing table.
One of the following destination arguments must be supplied:
- State string
- The state of the route -
active
orblackhole
. - Transit
Gateway stringId - Identifier of an EC2 Transit Gateway.
- Vpc
Endpoint stringId - Identifier of a VPC Endpoint.
- Vpc
Peering 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 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.
- Core
Network stringArn - The Amazon Resource Name (ARN) of a core network.
- Destination
Cidr stringBlock - The destination CIDR block.
- Destination
Ipv6Cidr stringBlock - The destination IPv6 CIDR block.
- Destination
Prefix stringList Id The ID of a managed prefix list destination.
One of the following target arguments must be supplied:
- Egress
Only stringGateway Id - Identifier of a VPC Egress Only Internet Gateway.
- Gateway
Id string - Identifier of a VPC internet gateway or a virtual private gateway. Specify
local
when updating a previously imported local route. - Instance
Id string - Identifier of an EC2 instance.
- Instance
Owner stringId - The AWS account ID of the owner of the EC2 instance.
- Local
Gateway stringId - Identifier of a Outpost local gateway.
- Nat
Gateway stringId - Identifier of a VPC NAT gateway.
- Network
Interface stringId - Identifier of an EC2 network interface.
- Origin string
- How the route was created -
CreateRouteTable
,CreateRoute
orEnableVgwRoutePropagation
. - Route
Table stringId The ID of the routing table.
One of the following destination arguments must be supplied:
- State string
- The state of the route -
active
orblackhole
. - Transit
Gateway stringId - Identifier of an EC2 Transit Gateway.
- Vpc
Endpoint stringId - Identifier of a VPC Endpoint.
- Vpc
Peering 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 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.
- core
Network StringArn - The Amazon Resource Name (ARN) of a core network.
- destination
Cidr StringBlock - The destination CIDR block.
- destination
Ipv6Cidr StringBlock - The destination IPv6 CIDR block.
- destination
Prefix StringList Id The ID of a managed prefix list destination.
One of the following target arguments must be supplied:
- egress
Only StringGateway Id - Identifier of a VPC Egress Only Internet Gateway.
- gateway
Id String - Identifier of a VPC internet gateway or a virtual private gateway. Specify
local
when updating a previously imported local route. - instance
Id String - Identifier of an EC2 instance.
- instance
Owner StringId - The AWS account ID of the owner of the EC2 instance.
- local
Gateway StringId - Identifier of a Outpost local gateway.
- nat
Gateway StringId - Identifier of a VPC NAT gateway.
- network
Interface StringId - Identifier of an EC2 network interface.
- origin String
- How the route was created -
CreateRouteTable
,CreateRoute
orEnableVgwRoutePropagation
. - route
Table StringId The ID of the routing table.
One of the following destination arguments must be supplied:
- state String
- The state of the route -
active
orblackhole
. - transit
Gateway StringId - Identifier of an EC2 Transit Gateway.
- vpc
Endpoint StringId - Identifier of a VPC Endpoint.
- vpc
Peering 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 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.
- core
Network stringArn - The Amazon Resource Name (ARN) of a core network.
- destination
Cidr stringBlock - The destination CIDR block.
- destination
Ipv6Cidr stringBlock - The destination IPv6 CIDR block.
- destination
Prefix stringList Id The ID of a managed prefix list destination.
One of the following target arguments must be supplied:
- egress
Only stringGateway Id - Identifier of a VPC Egress Only Internet Gateway.
- gateway
Id string - Identifier of a VPC internet gateway or a virtual private gateway. Specify
local
when updating a previously imported local route. - instance
Id string - Identifier of an EC2 instance.
- instance
Owner stringId - The AWS account ID of the owner of the EC2 instance.
- local
Gateway stringId - Identifier of a Outpost local gateway.
- nat
Gateway stringId - Identifier of a VPC NAT gateway.
- network
Interface stringId - Identifier of an EC2 network interface.
- origin string
- How the route was created -
CreateRouteTable
,CreateRoute
orEnableVgwRoutePropagation
. - route
Table stringId The ID of the routing table.
One of the following destination arguments must be supplied:
- state string
- The state of the route -
active
orblackhole
. - transit
Gateway stringId - Identifier of an EC2 Transit Gateway.
- vpc
Endpoint stringId - Identifier of a VPC Endpoint.
- vpc
Peering 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
local
when 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
,CreateRoute
orEnableVgwRoutePropagation
. - 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 -
active
orblackhole
. - 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.
- carrier
Gateway 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.
- core
Network StringArn - The Amazon Resource Name (ARN) of a core network.
- destination
Cidr StringBlock - The destination CIDR block.
- destination
Ipv6Cidr StringBlock - The destination IPv6 CIDR block.
- destination
Prefix StringList Id The ID of a managed prefix list destination.
One of the following target arguments must be supplied:
- egress
Only StringGateway Id - Identifier of a VPC Egress Only Internet Gateway.
- gateway
Id String - Identifier of a VPC internet gateway or a virtual private gateway. Specify
local
when updating a previously imported local route. - instance
Id String - Identifier of an EC2 instance.
- instance
Owner StringId - The AWS account ID of the owner of the EC2 instance.
- local
Gateway StringId - Identifier of a Outpost local gateway.
- nat
Gateway StringId - Identifier of a VPC NAT gateway.
- network
Interface StringId - Identifier of an EC2 network interface.
- origin String
- How the route was created -
CreateRouteTable
,CreateRoute
orEnableVgwRoutePropagation
. - route
Table StringId The ID of the routing table.
One of the following destination arguments must be supplied:
- state String
- The state of the route -
active
orblackhole
. - transit
Gateway StringId - Identifier of an EC2 Transit Gateway.
- vpc
Endpoint StringId - Identifier of a VPC Endpoint.
- vpc
Peering 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
aws
Terraform Provider.