aws.ec2.RouteTable
Explore with Pulumi AI
Provides a resource to create 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
andnat_gateway_id
: The AWS API is very forgiving with these two attributes and theaws.ec2.RouteTable
resource can be created with a NAT ID specified as a Gateway ID attribute. This will lead to a permanent diff between your configuration and statefile, as the API returns the correct parameters in the returned route table. If you’re experiencing constant diffs in youraws.ec2.RouteTable
resources, the first thing to check is whether or not you’re specifying a NAT ID instead of a Gateway ID, or vice-versa.
NOTE on
propagating_vgws
and theaws.ec2.VpnGatewayRoutePropagation
resource: If thepropagating_vgws
argument is present, it’s not supported to also define route propagations usingaws.ec2.VpnGatewayRoutePropagation
, since this resource will delete any propagating gateways not explicitly listed inpropagating_vgws
. Omit this argument when defining route propagation using the separate resource.
Example Usage
Basic example
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.ec2.RouteTable("example", {
vpcId: exampleAwsVpc.id,
routes: [
{
cidrBlock: "10.0.1.0/24",
gatewayId: exampleAwsInternetGateway.id,
},
{
ipv6CidrBlock: "::/0",
egressOnlyGatewayId: exampleAwsEgressOnlyInternetGateway.id,
},
],
tags: {
Name: "example",
},
});
import pulumi
import pulumi_aws as aws
example = aws.ec2.RouteTable("example",
vpc_id=example_aws_vpc["id"],
routes=[
{
"cidr_block": "10.0.1.0/24",
"gateway_id": example_aws_internet_gateway["id"],
},
{
"ipv6_cidr_block": "::/0",
"egress_only_gateway_id": example_aws_egress_only_internet_gateway["id"],
},
],
tags={
"Name": "example",
})
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.NewRouteTable(ctx, "example", &ec2.RouteTableArgs{
VpcId: pulumi.Any(exampleAwsVpc.Id),
Routes: ec2.RouteTableRouteArray{
&ec2.RouteTableRouteArgs{
CidrBlock: pulumi.String("10.0.1.0/24"),
GatewayId: pulumi.Any(exampleAwsInternetGateway.Id),
},
&ec2.RouteTableRouteArgs{
Ipv6CidrBlock: pulumi.String("::/0"),
EgressOnlyGatewayId: pulumi.Any(exampleAwsEgressOnlyInternetGateway.Id),
},
},
Tags: pulumi.StringMap{
"Name": pulumi.String("example"),
},
})
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 example = new Aws.Ec2.RouteTable("example", new()
{
VpcId = exampleAwsVpc.Id,
Routes = new[]
{
new Aws.Ec2.Inputs.RouteTableRouteArgs
{
CidrBlock = "10.0.1.0/24",
GatewayId = exampleAwsInternetGateway.Id,
},
new Aws.Ec2.Inputs.RouteTableRouteArgs
{
Ipv6CidrBlock = "::/0",
EgressOnlyGatewayId = exampleAwsEgressOnlyInternetGateway.Id,
},
},
Tags =
{
{ "Name", "example" },
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.RouteTable;
import com.pulumi.aws.ec2.RouteTableArgs;
import com.pulumi.aws.ec2.inputs.RouteTableRouteArgs;
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 example = new RouteTable("example", RouteTableArgs.builder()
.vpcId(exampleAwsVpc.id())
.routes(
RouteTableRouteArgs.builder()
.cidrBlock("10.0.1.0/24")
.gatewayId(exampleAwsInternetGateway.id())
.build(),
RouteTableRouteArgs.builder()
.ipv6CidrBlock("::/0")
.egressOnlyGatewayId(exampleAwsEgressOnlyInternetGateway.id())
.build())
.tags(Map.of("Name", "example"))
.build());
}
}
resources:
example:
type: aws:ec2:RouteTable
properties:
vpcId: ${exampleAwsVpc.id}
routes:
- cidrBlock: 10.0.1.0/24
gatewayId: ${exampleAwsInternetGateway.id}
- ipv6CidrBlock: ::/0
egressOnlyGatewayId: ${exampleAwsEgressOnlyInternetGateway.id}
tags:
Name: example
To subsequently remove all managed routes:
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.ec2.RouteTable("example", {
vpcId: exampleAwsVpc.id,
routes: [],
tags: {
Name: "example",
},
});
import pulumi
import pulumi_aws as aws
example = aws.ec2.RouteTable("example",
vpc_id=example_aws_vpc["id"],
routes=[],
tags={
"Name": "example",
})
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.NewRouteTable(ctx, "example", &ec2.RouteTableArgs{
VpcId: pulumi.Any(exampleAwsVpc.Id),
Routes: ec2.RouteTableRouteArray{},
Tags: pulumi.StringMap{
"Name": pulumi.String("example"),
},
})
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 example = new Aws.Ec2.RouteTable("example", new()
{
VpcId = exampleAwsVpc.Id,
Routes = new[] {},
Tags =
{
{ "Name", "example" },
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.RouteTable;
import com.pulumi.aws.ec2.RouteTableArgs;
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 example = new RouteTable("example", RouteTableArgs.builder()
.vpcId(exampleAwsVpc.id())
.routes()
.tags(Map.of("Name", "example"))
.build());
}
}
resources:
example:
type: aws:ec2:RouteTable
properties:
vpcId: ${exampleAwsVpc.id}
routes: []
tags:
Name: example
Adopting an existing local route
AWS creates certain routes that the AWS provider mostly ignores. You can manage them by importing or adopting them. See Import below for information on importing. This example shows adopting a route and then updating its target.
First, adopt an existing AWS-created route:
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const test = new aws.ec2.Vpc("test", {cidrBlock: "10.1.0.0/16"});
const testRouteTable = new aws.ec2.RouteTable("test", {
vpcId: test.id,
routes: [{
cidrBlock: "10.1.0.0/16",
gatewayId: "local",
}],
});
import pulumi
import pulumi_aws as aws
test = aws.ec2.Vpc("test", cidr_block="10.1.0.0/16")
test_route_table = aws.ec2.RouteTable("test",
vpc_id=test.id,
routes=[{
"cidr_block": "10.1.0.0/16",
"gateway_id": "local",
}])
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 {
test, err := ec2.NewVpc(ctx, "test", &ec2.VpcArgs{
CidrBlock: pulumi.String("10.1.0.0/16"),
})
if err != nil {
return err
}
_, err = ec2.NewRouteTable(ctx, "test", &ec2.RouteTableArgs{
VpcId: test.ID(),
Routes: ec2.RouteTableRouteArray{
&ec2.RouteTableRouteArgs{
CidrBlock: pulumi.String("10.1.0.0/16"),
GatewayId: pulumi.String("local"),
},
},
})
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 test = new Aws.Ec2.Vpc("test", new()
{
CidrBlock = "10.1.0.0/16",
});
var testRouteTable = new Aws.Ec2.RouteTable("test", new()
{
VpcId = test.Id,
Routes = new[]
{
new Aws.Ec2.Inputs.RouteTableRouteArgs
{
CidrBlock = "10.1.0.0/16",
GatewayId = "local",
},
},
});
});
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.RouteTable;
import com.pulumi.aws.ec2.RouteTableArgs;
import com.pulumi.aws.ec2.inputs.RouteTableRouteArgs;
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 test = new Vpc("test", VpcArgs.builder()
.cidrBlock("10.1.0.0/16")
.build());
var testRouteTable = new RouteTable("testRouteTable", RouteTableArgs.builder()
.vpcId(test.id())
.routes(RouteTableRouteArgs.builder()
.cidrBlock("10.1.0.0/16")
.gatewayId("local")
.build())
.build());
}
}
resources:
test:
type: aws:ec2:Vpc
properties:
cidrBlock: 10.1.0.0/16
testRouteTable:
type: aws:ec2:RouteTable
name: test
properties:
vpcId: ${test.id}
routes:
- cidrBlock: 10.1.0.0/16
gatewayId: local
Next, update the target of the route:
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const test = new aws.ec2.Vpc("test", {cidrBlock: "10.1.0.0/16"});
const testSubnet = new aws.ec2.Subnet("test", {
cidrBlock: "10.1.1.0/24",
vpcId: test.id,
});
const testNetworkInterface = new aws.ec2.NetworkInterface("test", {subnetId: testSubnet.id});
const testRouteTable = new aws.ec2.RouteTable("test", {
vpcId: test.id,
routes: [{
cidrBlock: test.cidrBlock,
networkInterfaceId: testNetworkInterface.id,
}],
});
import pulumi
import pulumi_aws as aws
test = aws.ec2.Vpc("test", cidr_block="10.1.0.0/16")
test_subnet = aws.ec2.Subnet("test",
cidr_block="10.1.1.0/24",
vpc_id=test.id)
test_network_interface = aws.ec2.NetworkInterface("test", subnet_id=test_subnet.id)
test_route_table = aws.ec2.RouteTable("test",
vpc_id=test.id,
routes=[{
"cidr_block": test.cidr_block,
"network_interface_id": test_network_interface.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 {
test, err := ec2.NewVpc(ctx, "test", &ec2.VpcArgs{
CidrBlock: pulumi.String("10.1.0.0/16"),
})
if err != nil {
return err
}
testSubnet, err := ec2.NewSubnet(ctx, "test", &ec2.SubnetArgs{
CidrBlock: pulumi.String("10.1.1.0/24"),
VpcId: test.ID(),
})
if err != nil {
return err
}
testNetworkInterface, err := ec2.NewNetworkInterface(ctx, "test", &ec2.NetworkInterfaceArgs{
SubnetId: testSubnet.ID(),
})
if err != nil {
return err
}
_, err = ec2.NewRouteTable(ctx, "test", &ec2.RouteTableArgs{
VpcId: test.ID(),
Routes: ec2.RouteTableRouteArray{
&ec2.RouteTableRouteArgs{
CidrBlock: test.CidrBlock,
NetworkInterfaceId: testNetworkInterface.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 test = new Aws.Ec2.Vpc("test", new()
{
CidrBlock = "10.1.0.0/16",
});
var testSubnet = new Aws.Ec2.Subnet("test", new()
{
CidrBlock = "10.1.1.0/24",
VpcId = test.Id,
});
var testNetworkInterface = new Aws.Ec2.NetworkInterface("test", new()
{
SubnetId = testSubnet.Id,
});
var testRouteTable = new Aws.Ec2.RouteTable("test", new()
{
VpcId = test.Id,
Routes = new[]
{
new Aws.Ec2.Inputs.RouteTableRouteArgs
{
CidrBlock = test.CidrBlock,
NetworkInterfaceId = testNetworkInterface.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.Subnet;
import com.pulumi.aws.ec2.SubnetArgs;
import com.pulumi.aws.ec2.NetworkInterface;
import com.pulumi.aws.ec2.NetworkInterfaceArgs;
import com.pulumi.aws.ec2.RouteTable;
import com.pulumi.aws.ec2.RouteTableArgs;
import com.pulumi.aws.ec2.inputs.RouteTableRouteArgs;
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 test = new Vpc("test", VpcArgs.builder()
.cidrBlock("10.1.0.0/16")
.build());
var testSubnet = new Subnet("testSubnet", SubnetArgs.builder()
.cidrBlock("10.1.1.0/24")
.vpcId(test.id())
.build());
var testNetworkInterface = new NetworkInterface("testNetworkInterface", NetworkInterfaceArgs.builder()
.subnetId(testSubnet.id())
.build());
var testRouteTable = new RouteTable("testRouteTable", RouteTableArgs.builder()
.vpcId(test.id())
.routes(RouteTableRouteArgs.builder()
.cidrBlock(test.cidrBlock())
.networkInterfaceId(testNetworkInterface.id())
.build())
.build());
}
}
resources:
test:
type: aws:ec2:Vpc
properties:
cidrBlock: 10.1.0.0/16
testRouteTable:
type: aws:ec2:RouteTable
name: test
properties:
vpcId: ${test.id}
routes:
- cidrBlock: ${test.cidrBlock}
networkInterfaceId: ${testNetworkInterface.id}
testSubnet:
type: aws:ec2:Subnet
name: test
properties:
cidrBlock: 10.1.1.0/24
vpcId: ${test.id}
testNetworkInterface:
type: aws:ec2:NetworkInterface
name: test
properties:
subnetId: ${testSubnet.id}
The target could then be updated again back to local
.
Create RouteTable Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new RouteTable(name: string, args: RouteTableArgs, opts?: CustomResourceOptions);
@overload
def RouteTable(resource_name: str,
args: RouteTableArgs,
opts: Optional[ResourceOptions] = None)
@overload
def RouteTable(resource_name: str,
opts: Optional[ResourceOptions] = None,
vpc_id: Optional[str] = None,
propagating_vgws: Optional[Sequence[str]] = None,
routes: Optional[Sequence[RouteTableRouteArgs]] = None,
tags: Optional[Mapping[str, str]] = None)
func NewRouteTable(ctx *Context, name string, args RouteTableArgs, opts ...ResourceOption) (*RouteTable, error)
public RouteTable(string name, RouteTableArgs args, CustomResourceOptions? opts = null)
public RouteTable(String name, RouteTableArgs args)
public RouteTable(String name, RouteTableArgs args, CustomResourceOptions options)
type: aws:ec2:RouteTable
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 RouteTableArgs
- 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 RouteTableArgs
- 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 RouteTableArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RouteTableArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RouteTableArgs
- 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 routeTableResource = new Aws.Ec2.RouteTable("routeTableResource", new()
{
VpcId = "string",
PropagatingVgws = new[]
{
"string",
},
Routes = new[]
{
new Aws.Ec2.Inputs.RouteTableRouteArgs
{
CarrierGatewayId = "string",
CidrBlock = "string",
CoreNetworkArn = "string",
DestinationPrefixListId = "string",
EgressOnlyGatewayId = "string",
GatewayId = "string",
Ipv6CidrBlock = "string",
LocalGatewayId = "string",
NatGatewayId = "string",
NetworkInterfaceId = "string",
TransitGatewayId = "string",
VpcEndpointId = "string",
VpcPeeringConnectionId = "string",
},
},
Tags =
{
{ "string", "string" },
},
});
example, err := ec2.NewRouteTable(ctx, "routeTableResource", &ec2.RouteTableArgs{
VpcId: pulumi.String("string"),
PropagatingVgws: pulumi.StringArray{
pulumi.String("string"),
},
Routes: ec2.RouteTableRouteArray{
&ec2.RouteTableRouteArgs{
CarrierGatewayId: pulumi.String("string"),
CidrBlock: pulumi.String("string"),
CoreNetworkArn: pulumi.String("string"),
DestinationPrefixListId: pulumi.String("string"),
EgressOnlyGatewayId: pulumi.String("string"),
GatewayId: pulumi.String("string"),
Ipv6CidrBlock: pulumi.String("string"),
LocalGatewayId: pulumi.String("string"),
NatGatewayId: pulumi.String("string"),
NetworkInterfaceId: pulumi.String("string"),
TransitGatewayId: pulumi.String("string"),
VpcEndpointId: pulumi.String("string"),
VpcPeeringConnectionId: pulumi.String("string"),
},
},
Tags: pulumi.StringMap{
"string": pulumi.String("string"),
},
})
var routeTableResource = new RouteTable("routeTableResource", RouteTableArgs.builder()
.vpcId("string")
.propagatingVgws("string")
.routes(RouteTableRouteArgs.builder()
.carrierGatewayId("string")
.cidrBlock("string")
.coreNetworkArn("string")
.destinationPrefixListId("string")
.egressOnlyGatewayId("string")
.gatewayId("string")
.ipv6CidrBlock("string")
.localGatewayId("string")
.natGatewayId("string")
.networkInterfaceId("string")
.transitGatewayId("string")
.vpcEndpointId("string")
.vpcPeeringConnectionId("string")
.build())
.tags(Map.of("string", "string"))
.build());
route_table_resource = aws.ec2.RouteTable("routeTableResource",
vpc_id="string",
propagating_vgws=["string"],
routes=[{
"carrier_gateway_id": "string",
"cidr_block": "string",
"core_network_arn": "string",
"destination_prefix_list_id": "string",
"egress_only_gateway_id": "string",
"gateway_id": "string",
"ipv6_cidr_block": "string",
"local_gateway_id": "string",
"nat_gateway_id": "string",
"network_interface_id": "string",
"transit_gateway_id": "string",
"vpc_endpoint_id": "string",
"vpc_peering_connection_id": "string",
}],
tags={
"string": "string",
})
const routeTableResource = new aws.ec2.RouteTable("routeTableResource", {
vpcId: "string",
propagatingVgws: ["string"],
routes: [{
carrierGatewayId: "string",
cidrBlock: "string",
coreNetworkArn: "string",
destinationPrefixListId: "string",
egressOnlyGatewayId: "string",
gatewayId: "string",
ipv6CidrBlock: "string",
localGatewayId: "string",
natGatewayId: "string",
networkInterfaceId: "string",
transitGatewayId: "string",
vpcEndpointId: "string",
vpcPeeringConnectionId: "string",
}],
tags: {
string: "string",
},
});
type: aws:ec2:RouteTable
properties:
propagatingVgws:
- string
routes:
- carrierGatewayId: string
cidrBlock: string
coreNetworkArn: string
destinationPrefixListId: string
egressOnlyGatewayId: string
gatewayId: string
ipv6CidrBlock: string
localGatewayId: string
natGatewayId: string
networkInterfaceId: string
transitGatewayId: string
vpcEndpointId: string
vpcPeeringConnectionId: string
tags:
string: string
vpcId: string
RouteTable 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 RouteTable resource accepts the following input properties:
- Vpc
Id string - The VPC ID.
- Propagating
Vgws List<string> - A list of virtual gateways for propagation.
- Routes
List<Route
Table Route> - A list of route objects. Their keys are documented below. This means that omitting this argument is interpreted as ignoring any existing routes. To remove all managed routes an empty list should be specified. See the example above.
- Dictionary<string, string>
- A map of tags to assign to the resource. If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
- Vpc
Id string - The VPC ID.
- Propagating
Vgws []string - A list of virtual gateways for propagation.
- Routes
[]Route
Table Route Args - A list of route objects. Their keys are documented below. This means that omitting this argument is interpreted as ignoring any existing routes. To remove all managed routes an empty list should be specified. See the example above.
- map[string]string
- A map of tags to assign to the resource. If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
- vpc
Id String - The VPC ID.
- propagating
Vgws List<String> - A list of virtual gateways for propagation.
- routes
List<Route
Table Route> - A list of route objects. Their keys are documented below. This means that omitting this argument is interpreted as ignoring any existing routes. To remove all managed routes an empty list should be specified. See the example above.
- Map<String,String>
- A map of tags to assign to the resource. If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
- vpc
Id string - The VPC ID.
- propagating
Vgws string[] - A list of virtual gateways for propagation.
- routes
Route
Table Route[] - A list of route objects. Their keys are documented below. This means that omitting this argument is interpreted as ignoring any existing routes. To remove all managed routes an empty list should be specified. See the example above.
- {[key: string]: string}
- A map of tags to assign to the resource. If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
- vpc_
id str - The VPC ID.
- propagating_
vgws Sequence[str] - A list of virtual gateways for propagation.
- routes
Sequence[Route
Table Route Args] - A list of route objects. Their keys are documented below. This means that omitting this argument is interpreted as ignoring any existing routes. To remove all managed routes an empty list should be specified. See the example above.
- Mapping[str, str]
- A map of tags to assign to the resource. If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
- vpc
Id String - The VPC ID.
- propagating
Vgws List<String> - A list of virtual gateways for propagation.
- routes List<Property Map>
- A list of route objects. Their keys are documented below. This means that omitting this argument is interpreted as ignoring any existing routes. To remove all managed routes an empty list should be specified. See the example above.
- Map<String>
- A map of tags to assign to the resource. If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Outputs
All input properties are implicitly available as output properties. Additionally, the RouteTable resource produces the following output properties:
- Arn string
- The ARN of the route table.
- Id string
- The provider-assigned unique ID for this managed resource.
- Owner
Id string - The ID of the AWS account that owns the route table.
- Dictionary<string, string>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- Arn string
- The ARN of the route table.
- Id string
- The provider-assigned unique ID for this managed resource.
- Owner
Id string - The ID of the AWS account that owns the route table.
- map[string]string
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- arn String
- The ARN of the route table.
- id String
- The provider-assigned unique ID for this managed resource.
- owner
Id String - The ID of the AWS account that owns the route table.
- Map<String,String>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- arn string
- The ARN of the route table.
- id string
- The provider-assigned unique ID for this managed resource.
- owner
Id string - The ID of the AWS account that owns the route table.
- {[key: string]: string}
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
Look up Existing RouteTable Resource
Get an existing RouteTable 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?: RouteTableState, opts?: CustomResourceOptions): RouteTable
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
arn: Optional[str] = None,
owner_id: Optional[str] = None,
propagating_vgws: Optional[Sequence[str]] = None,
routes: Optional[Sequence[RouteTableRouteArgs]] = None,
tags: Optional[Mapping[str, str]] = None,
tags_all: Optional[Mapping[str, str]] = None,
vpc_id: Optional[str] = None) -> RouteTable
func GetRouteTable(ctx *Context, name string, id IDInput, state *RouteTableState, opts ...ResourceOption) (*RouteTable, error)
public static RouteTable Get(string name, Input<string> id, RouteTableState? state, CustomResourceOptions? opts = null)
public static RouteTable get(String name, Output<String> id, RouteTableState 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.
- Arn string
- The ARN of the route table.
- Owner
Id string - The ID of the AWS account that owns the route table.
- Propagating
Vgws List<string> - A list of virtual gateways for propagation.
- Routes
List<Route
Table Route> - A list of route objects. Their keys are documented below. This means that omitting this argument is interpreted as ignoring any existing routes. To remove all managed routes an empty list should be specified. See the example above.
- Dictionary<string, string>
- A map of tags to assign to the resource. If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level. - Dictionary<string, string>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block. - Vpc
Id string - The VPC ID.
- Arn string
- The ARN of the route table.
- Owner
Id string - The ID of the AWS account that owns the route table.
- Propagating
Vgws []string - A list of virtual gateways for propagation.
- Routes
[]Route
Table Route Args - A list of route objects. Their keys are documented below. This means that omitting this argument is interpreted as ignoring any existing routes. To remove all managed routes an empty list should be specified. See the example above.
- map[string]string
- A map of tags to assign to the resource. If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level. - map[string]string
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block. - Vpc
Id string - The VPC ID.
- arn String
- The ARN of the route table.
- owner
Id String - The ID of the AWS account that owns the route table.
- propagating
Vgws List<String> - A list of virtual gateways for propagation.
- routes
List<Route
Table Route> - A list of route objects. Their keys are documented below. This means that omitting this argument is interpreted as ignoring any existing routes. To remove all managed routes an empty list should be specified. See the example above.
- Map<String,String>
- A map of tags to assign to the resource. If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level. - Map<String,String>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block. - vpc
Id String - The VPC ID.
- arn string
- The ARN of the route table.
- owner
Id string - The ID of the AWS account that owns the route table.
- propagating
Vgws string[] - A list of virtual gateways for propagation.
- routes
Route
Table Route[] - A list of route objects. Their keys are documented below. This means that omitting this argument is interpreted as ignoring any existing routes. To remove all managed routes an empty list should be specified. See the example above.
- {[key: string]: string}
- A map of tags to assign to the resource. If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level. - {[key: string]: string}
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block. - vpc
Id string - The VPC ID.
- arn str
- The ARN of the route table.
- owner_
id str - The ID of the AWS account that owns the route table.
- propagating_
vgws Sequence[str] - A list of virtual gateways for propagation.
- routes
Sequence[Route
Table Route Args] - A list of route objects. Their keys are documented below. This means that omitting this argument is interpreted as ignoring any existing routes. To remove all managed routes an empty list should be specified. See the example above.
- Mapping[str, str]
- A map of tags to assign to the resource. If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level. - Mapping[str, str]
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block. - vpc_
id str - The VPC ID.
- arn String
- The ARN of the route table.
- owner
Id String - The ID of the AWS account that owns the route table.
- propagating
Vgws List<String> - A list of virtual gateways for propagation.
- routes List<Property Map>
- A list of route objects. Their keys are documented below. This means that omitting this argument is interpreted as ignoring any existing routes. To remove all managed routes an empty list should be specified. See the example above.
- Map<String>
- A map of tags to assign to the resource. If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level. - Map<String>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block. - vpc
Id String - The VPC ID.
Supporting Types
RouteTableRoute, RouteTableRouteArgs
- 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.
- Cidr
Block string - The CIDR block of the route.
- Core
Network stringArn - The Amazon Resource Name (ARN) of a core network.
- Destination
Prefix stringList Id The ID of a managed prefix list destination of the route.
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, virtual private gateway, or
local
.local
routes cannot be created but can be adopted or imported. See the example above. - Ipv6Cidr
Block string - The Ipv6 CIDR block of the 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.
- 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.
- Cidr
Block string - The CIDR block of the route.
- Core
Network stringArn - The Amazon Resource Name (ARN) of a core network.
- Destination
Prefix stringList Id The ID of a managed prefix list destination of the route.
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, virtual private gateway, or
local
.local
routes cannot be created but can be adopted or imported. See the example above. - Ipv6Cidr
Block string - The Ipv6 CIDR block of the 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.
- 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.
- cidr
Block String - The CIDR block of the route.
- core
Network StringArn - The Amazon Resource Name (ARN) of a core network.
- destination
Prefix StringList Id The ID of a managed prefix list destination of the route.
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, virtual private gateway, or
local
.local
routes cannot be created but can be adopted or imported. See the example above. - ipv6Cidr
Block String - The Ipv6 CIDR block of the 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.
- 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.
- cidr
Block string - The CIDR block of the route.
- core
Network stringArn - The Amazon Resource Name (ARN) of a core network.
- destination
Prefix stringList Id The ID of a managed prefix list destination of the route.
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, virtual private gateway, or
local
.local
routes cannot be created but can be adopted or imported. See the example above. - ipv6Cidr
Block string - The Ipv6 CIDR block of the 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.
- 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.
- cidr_
block str - The CIDR block of the route.
- core_
network_ strarn - The Amazon Resource Name (ARN) of a core network.
- destination_
prefix_ strlist_ id The ID of a managed prefix list destination of the route.
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, virtual private gateway, or
local
.local
routes cannot be created but can be adopted or imported. See the example above. - ipv6_
cidr_ strblock - The Ipv6 CIDR block of the 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.
- 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.
- cidr
Block String - The CIDR block of the route.
- core
Network StringArn - The Amazon Resource Name (ARN) of a core network.
- destination
Prefix StringList Id The ID of a managed prefix list destination of the route.
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, virtual private gateway, or
local
.local
routes cannot be created but can be adopted or imported. See the example above. - ipv6Cidr
Block String - The Ipv6 CIDR block of the 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.
Import
Using pulumi import
, import Route Tables using the route table id
. For example:
$ pulumi import aws:ec2/routeTable:RouteTable public_rt rtb-4e616f6d69
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.