Route
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.
Example IPv6 Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const vpc = new aws.ec2.Vpc("vpc", {
assignGeneratedIpv6CidrBlock: true,
cidrBlock: "10.1.0.0/16",
});
const egress = new aws.ec2.EgressOnlyInternetGateway("egress", {
vpcId: vpc.id,
});
const route = new aws.ec2.Route("r", {
destinationIpv6CidrBlock: "::/0",
egressOnlyGatewayId: egress.id,
routeTableId: "rtb-4fbb3ac4",
});import pulumi
import pulumi_aws as aws
vpc = aws.ec2.Vpc("vpc",
assign_generated_ipv6_cidr_block=True,
cidr_block="10.1.0.0/16")
egress = aws.ec2.EgressOnlyInternetGateway("egress", vpc_id=vpc.id)
route = aws.ec2.Route("route",
destination_ipv6_cidr_block="::/0",
egress_only_gateway_id=egress.id,
route_table_id="rtb-4fbb3ac4")using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var vpc = new Aws.Ec2.Vpc("vpc", new Aws.Ec2.VpcArgs
{
AssignGeneratedIpv6CidrBlock = true,
CidrBlock = "10.1.0.0/16",
});
var egress = new Aws.Ec2.EgressOnlyInternetGateway("egress", new Aws.Ec2.EgressOnlyInternetGatewayArgs
{
VpcId = vpc.Id,
});
var route = new Aws.Ec2.Route("route", new Aws.Ec2.RouteArgs
{
DestinationIpv6CidrBlock = "::/0",
EgressOnlyGatewayId = egress.Id,
RouteTableId = "rtb-4fbb3ac4",
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
vpc, err := ec2.NewVpc(ctx, "vpc", &ec2.VpcArgs{
AssignGeneratedIpv6CidrBlock: pulumi.Bool(true),
CidrBlock: pulumi.String("10.1.0.0/16"),
})
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, "route", &ec2.RouteArgs{
DestinationIpv6CidrBlock: pulumi.String("::/0"),
EgressOnlyGatewayId: egress.ID(),
RouteTableId: pulumi.String("rtb-4fbb3ac4"),
})
if err != nil {
return err
}
return nil
})
}Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var route = new Aws.Ec2.Route("route", new Aws.Ec2.RouteArgs
{
RouteTableId = "rtb-4fbb3ac4",
DestinationCidrBlock = "10.0.1.0/22",
VpcPeeringConnectionId = "pcx-45ff3dc1",
}, new CustomResourceOptions
{
DependsOn =
{
"aws_route_table.testing",
},
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ec2.NewRoute(ctx, "route", &ec2.RouteArgs{
RouteTableId: pulumi.String("rtb-4fbb3ac4"),
DestinationCidrBlock: pulumi.String("10.0.1.0/22"),
VpcPeeringConnectionId: pulumi.String("pcx-45ff3dc1"),
}, pulumi.DependsOn([]pulumi.Resource{
"aws_route_table.testing",
}))
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
route = aws.ec2.Route("route",
route_table_id="rtb-4fbb3ac4",
destination_cidr_block="10.0.1.0/22",
vpc_peering_connection_id="pcx-45ff3dc1",
opts=ResourceOptions(depends_on=["aws_route_table.testing"]))import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const route = new aws.ec2.Route("route", {
routeTableId: "rtb-4fbb3ac4",
destinationCidrBlock: "10.0.1.0/22",
vpcPeeringConnectionId: "pcx-45ff3dc1",
}, {
dependsOn: ["aws_route_table.testing"],
});Create a Route Resource
new Route(name: string, args: RouteArgs, opts?: CustomResourceOptions);def Route(resource_name, opts=None, destination_cidr_block=None, destination_ipv6_cidr_block=None, egress_only_gateway_id=None, gateway_id=None, instance_id=None, nat_gateway_id=None, network_interface_id=None, route_table_id=None, transit_gateway_id=None, vpc_peering_connection_id=None, __props__=None);public Route(string name, RouteArgs args, CustomResourceOptions? opts = null)- 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.
- opts ResourceOptions
- A bag of options that control this 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.
Route Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The Route resource accepts the following input properties:
- Route
Table stringId The ID of the routing table.
- Destination
Cidr stringBlock The destination CIDR block.
- Destination
Ipv6Cidr stringBlock The destination IPv6 CIDR block.
- 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.
- Instance
Id string Identifier of an EC2 instance.
- 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
Peering stringConnection Id Identifier of a VPC peering connection.
- Route
Table stringId The ID of the routing table.
- Destination
Cidr stringBlock The destination CIDR block.
- Destination
Ipv6Cidr stringBlock The destination IPv6 CIDR block.
- 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.
- Instance
Id string Identifier of an EC2 instance.
- 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
Peering stringConnection Id Identifier of a VPC peering connection.
- route
Table stringId The ID of the routing table.
- destination
Cidr stringBlock The destination CIDR block.
- destination
Ipv6Cidr stringBlock The destination IPv6 CIDR block.
- 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.
- instance
Id string Identifier of an EC2 instance.
- 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
Peering stringConnection Id Identifier of a VPC peering connection.
- route_
table_ strid The ID of the routing table.
- destination_
cidr_ strblock The destination CIDR block.
- destination_
ipv6_ strcidr_ block The destination IPv6 CIDR block.
- 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.
- instance_
id str Identifier of an EC2 instance.
- 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_
peering_ strconnection_ id Identifier of a VPC peering connection.
Outputs
All input properties are implicitly available as output properties. Additionally, the Route resource produces the following output properties:
- Destination
Prefix stringList Id - Id string
- The provider-assigned unique ID for this managed resource.
- Instance
Owner stringId - Origin string
- State string
- Destination
Prefix stringList Id - Id string
- The provider-assigned unique ID for this managed resource.
- Instance
Owner stringId - Origin string
- State string
- destination
Prefix stringList Id - id string
- The provider-assigned unique ID for this managed resource.
- instance
Owner stringId - origin string
- state string
- destination_
prefix_ strlist_ id - id str
- The provider-assigned unique ID for this managed resource.
- instance_
owner_ strid - origin str
- state str
Look up an 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): Routestatic get(resource_name, id, opts=None, destination_cidr_block=None, destination_ipv6_cidr_block=None, destination_prefix_list_id=None, egress_only_gateway_id=None, gateway_id=None, instance_id=None, instance_owner_id=None, nat_gateway_id=None, network_interface_id=None, origin=None, route_table_id=None, state=None, transit_gateway_id=None, vpc_peering_connection_id=None, __props__=None);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)- 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.
The following state arguments are supported:
- Destination
Cidr stringBlock The destination CIDR block.
- Destination
Ipv6Cidr stringBlock The destination IPv6 CIDR block.
- Destination
Prefix stringList Id - 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.
- Instance
Id string Identifier of an EC2 instance.
- Instance
Owner stringId - Nat
Gateway stringId Identifier of a VPC NAT gateway.
- Network
Interface stringId Identifier of an EC2 network interface.
- Origin string
- Route
Table stringId The ID of the routing table.
- State string
- Transit
Gateway stringId Identifier of an EC2 Transit Gateway.
- Vpc
Peering stringConnection Id Identifier of a VPC peering connection.
- Destination
Cidr stringBlock The destination CIDR block.
- Destination
Ipv6Cidr stringBlock The destination IPv6 CIDR block.
- Destination
Prefix stringList Id - 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.
- Instance
Id string Identifier of an EC2 instance.
- Instance
Owner stringId - Nat
Gateway stringId Identifier of a VPC NAT gateway.
- Network
Interface stringId Identifier of an EC2 network interface.
- Origin string
- Route
Table stringId The ID of the routing table.
- State string
- Transit
Gateway stringId Identifier of an EC2 Transit Gateway.
- Vpc
Peering stringConnection Id Identifier of a VPC peering connection.
- destination
Cidr stringBlock The destination CIDR block.
- destination
Ipv6Cidr stringBlock The destination IPv6 CIDR block.
- destination
Prefix stringList Id - 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.
- instance
Id string Identifier of an EC2 instance.
- instance
Owner stringId - nat
Gateway stringId Identifier of a VPC NAT gateway.
- network
Interface stringId Identifier of an EC2 network interface.
- origin string
- route
Table stringId The ID of the routing table.
- state string
- transit
Gateway stringId Identifier of an EC2 Transit Gateway.
- vpc
Peering stringConnection Id Identifier of a VPC peering connection.
- destination_
cidr_ strblock The destination CIDR block.
- destination_
ipv6_ strcidr_ block The destination IPv6 CIDR block.
- destination_
prefix_ strlist_ id - 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.
- instance_
id str Identifier of an EC2 instance.
- instance_
owner_ strid - nat_
gateway_ strid Identifier of a VPC NAT gateway.
- network_
interface_ strid Identifier of an EC2 network interface.
- origin str
- route_
table_ strid The ID of the routing table.
- state str
- transit_
gateway_ strid Identifier of an EC2 Transit Gateway.
- vpc_
peering_ strconnection_ id Identifier of a VPC peering connection.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.