1. Packages
  2. AWS Classic
  3. API Docs
  4. ec2
  5. RouteTable

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.2.1 published on Friday, Sep 22, 2023 by Pulumi

aws.ec2.RouteTable

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.2.1 published on Friday, Sep 22, 2023 by Pulumi

    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 and nat_gateway_id: The AWS API is very forgiving with these two attributes and the aws.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 your aws.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 the aws.ec2.VpnGatewayRoutePropagation resource: If the propagating_vgws argument is present, it’s not supported to also define route propagations using aws.ec2.VpnGatewayRoutePropagation, since this resource will delete any propagating gateways not explicitly listed in propagating_vgws. Omit this argument when defining route propagation using the separate resource.

    Example Usage

    Basic example

    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 = aws_vpc.Example.Id,
            Routes = new[]
            {
                new Aws.Ec2.Inputs.RouteTableRouteArgs
                {
                    CidrBlock = "10.0.1.0/24",
                    GatewayId = aws_internet_gateway.Example.Id,
                },
                new Aws.Ec2.Inputs.RouteTableRouteArgs
                {
                    Ipv6CidrBlock = "::/0",
                    EgressOnlyGatewayId = aws_egress_only_internet_gateway.Example.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(aws_vpc.Example.Id),
    			Routes: ec2.RouteTableRouteArray{
    				&ec2.RouteTableRouteArgs{
    					CidrBlock: pulumi.String("10.0.1.0/24"),
    					GatewayId: pulumi.Any(aws_internet_gateway.Example.Id),
    				},
    				&ec2.RouteTableRouteArgs{
    					Ipv6CidrBlock:       pulumi.String("::/0"),
    					EgressOnlyGatewayId: pulumi.Any(aws_egress_only_internet_gateway.Example.Id),
    				},
    			},
    			Tags: pulumi.StringMap{
    				"Name": pulumi.String("example"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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(aws_vpc.example().id())
                .routes(            
                    RouteTableRouteArgs.builder()
                        .cidrBlock("10.0.1.0/24")
                        .gatewayId(aws_internet_gateway.example().id())
                        .build(),
                    RouteTableRouteArgs.builder()
                        .ipv6CidrBlock("::/0")
                        .egressOnlyGatewayId(aws_egress_only_internet_gateway.example().id())
                        .build())
                .tags(Map.of("Name", "example"))
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.ec2.RouteTable("example",
        vpc_id=aws_vpc["example"]["id"],
        routes=[
            aws.ec2.RouteTableRouteArgs(
                cidr_block="10.0.1.0/24",
                gateway_id=aws_internet_gateway["example"]["id"],
            ),
            aws.ec2.RouteTableRouteArgs(
                ipv6_cidr_block="::/0",
                egress_only_gateway_id=aws_egress_only_internet_gateway["example"]["id"],
            ),
        ],
        tags={
            "Name": "example",
        })
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.ec2.RouteTable("example", {
        vpcId: aws_vpc.example.id,
        routes: [
            {
                cidrBlock: "10.0.1.0/24",
                gatewayId: aws_internet_gateway.example.id,
            },
            {
                ipv6CidrBlock: "::/0",
                egressOnlyGatewayId: aws_egress_only_internet_gateway.example.id,
            },
        ],
        tags: {
            Name: "example",
        },
    });
    
    resources:
      example:
        type: aws:ec2:RouteTable
        properties:
          vpcId: ${aws_vpc.example.id}
          routes:
            - cidrBlock: 10.0.1.0/24
              gatewayId: ${aws_internet_gateway.example.id}
            - ipv6CidrBlock: ::/0
              egressOnlyGatewayId: ${aws_egress_only_internet_gateway.example.id}
          tags:
            Name: example
    

    To subsequently remove all managed routes

    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 = aws_vpc.Example.Id,
            Routes = new[] {},
            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(aws_vpc.Example.Id),
    			Routes: ec2.RouteTableRouteArray{},
    			Tags: pulumi.StringMap{
    				"Name": pulumi.String("example"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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(aws_vpc.example().id())
                .routes()
                .tags(Map.of("Name", "example"))
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.ec2.RouteTable("example",
        vpc_id=aws_vpc["example"]["id"],
        routes=[],
        tags={
            "Name": "example",
        })
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.ec2.RouteTable("example", {
        vpcId: aws_vpc.example.id,
        routes: [],
        tags: {
            Name: "example",
        },
    });
    
    resources:
      example:
        type: aws:ec2:RouteTable
        properties:
          vpcId: ${aws_vpc.example.id}
          routes: []
          tags:
            Name: example
    

    Adopting an existing local route

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var testVpc = new Aws.Ec2.Vpc("testVpc", new()
        {
            CidrBlock = "10.1.0.0/16",
        });
    
        var testRouteTable = new Aws.Ec2.RouteTable("testRouteTable", new()
        {
            VpcId = testVpc.Id,
            Routes = new[]
            {
                new Aws.Ec2.Inputs.RouteTableRouteArgs
                {
                    CidrBlock = "10.1.0.0/16",
                    GatewayId = "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 {
    		testVpc, err := ec2.NewVpc(ctx, "testVpc", &ec2.VpcArgs{
    			CidrBlock: pulumi.String("10.1.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ec2.NewRouteTable(ctx, "testRouteTable", &ec2.RouteTableArgs{
    			VpcId: testVpc.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
    	})
    }
    
    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 testVpc = new Vpc("testVpc", VpcArgs.builder()        
                .cidrBlock("10.1.0.0/16")
                .build());
    
            var testRouteTable = new RouteTable("testRouteTable", RouteTableArgs.builder()        
                .vpcId(testVpc.id())
                .routes(RouteTableRouteArgs.builder()
                    .cidrBlock("10.1.0.0/16")
                    .gatewayId("local")
                    .build())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_aws as aws
    
    test_vpc = aws.ec2.Vpc("testVpc", cidr_block="10.1.0.0/16")
    test_route_table = aws.ec2.RouteTable("testRouteTable",
        vpc_id=test_vpc.id,
        routes=[aws.ec2.RouteTableRouteArgs(
            cidr_block="10.1.0.0/16",
            gateway_id="local",
        )])
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const testVpc = new aws.ec2.Vpc("testVpc", {cidrBlock: "10.1.0.0/16"});
    const testRouteTable = new aws.ec2.RouteTable("testRouteTable", {
        vpcId: testVpc.id,
        routes: [{
            cidrBlock: "10.1.0.0/16",
            gatewayId: "local",
        }],
    });
    
    resources:
      testVpc:
        type: aws:ec2:Vpc
        properties:
          cidrBlock: 10.1.0.0/16
      testRouteTable:
        type: aws:ec2:RouteTable
        properties:
          vpcId: ${testVpc.id}
          # since this is exactly the route AWS will create, the route will be adopted
          routes:
            - cidrBlock: 10.1.0.0/16
              gatewayId: local
    

    Next, update the target of the route

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var testVpc = new Aws.Ec2.Vpc("testVpc", new()
        {
            CidrBlock = "10.1.0.0/16",
        });
    
        var testSubnet = new Aws.Ec2.Subnet("testSubnet", new()
        {
            CidrBlock = "10.1.1.0/24",
            VpcId = testVpc.Id,
        });
    
        var testNetworkInterface = new Aws.Ec2.NetworkInterface("testNetworkInterface", new()
        {
            SubnetId = testSubnet.Id,
        });
    
        var testRouteTable = new Aws.Ec2.RouteTable("testRouteTable", new()
        {
            VpcId = testVpc.Id,
            Routes = new[]
            {
                new Aws.Ec2.Inputs.RouteTableRouteArgs
                {
                    CidrBlock = testVpc.CidrBlock,
                    NetworkInterfaceId = testNetworkInterface.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 {
    		testVpc, err := ec2.NewVpc(ctx, "testVpc", &ec2.VpcArgs{
    			CidrBlock: pulumi.String("10.1.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		testSubnet, err := ec2.NewSubnet(ctx, "testSubnet", &ec2.SubnetArgs{
    			CidrBlock: pulumi.String("10.1.1.0/24"),
    			VpcId:     testVpc.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		testNetworkInterface, err := ec2.NewNetworkInterface(ctx, "testNetworkInterface", &ec2.NetworkInterfaceArgs{
    			SubnetId: testSubnet.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ec2.NewRouteTable(ctx, "testRouteTable", &ec2.RouteTableArgs{
    			VpcId: testVpc.ID(),
    			Routes: ec2.RouteTableRouteArray{
    				&ec2.RouteTableRouteArgs{
    					CidrBlock:          testVpc.CidrBlock,
    					NetworkInterfaceId: testNetworkInterface.ID(),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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 testVpc = new Vpc("testVpc", VpcArgs.builder()        
                .cidrBlock("10.1.0.0/16")
                .build());
    
            var testSubnet = new Subnet("testSubnet", SubnetArgs.builder()        
                .cidrBlock("10.1.1.0/24")
                .vpcId(testVpc.id())
                .build());
    
            var testNetworkInterface = new NetworkInterface("testNetworkInterface", NetworkInterfaceArgs.builder()        
                .subnetId(testSubnet.id())
                .build());
    
            var testRouteTable = new RouteTable("testRouteTable", RouteTableArgs.builder()        
                .vpcId(testVpc.id())
                .routes(RouteTableRouteArgs.builder()
                    .cidrBlock(testVpc.cidrBlock())
                    .networkInterfaceId(testNetworkInterface.id())
                    .build())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_aws as aws
    
    test_vpc = aws.ec2.Vpc("testVpc", cidr_block="10.1.0.0/16")
    test_subnet = aws.ec2.Subnet("testSubnet",
        cidr_block="10.1.1.0/24",
        vpc_id=test_vpc.id)
    test_network_interface = aws.ec2.NetworkInterface("testNetworkInterface", subnet_id=test_subnet.id)
    test_route_table = aws.ec2.RouteTable("testRouteTable",
        vpc_id=test_vpc.id,
        routes=[aws.ec2.RouteTableRouteArgs(
            cidr_block=test_vpc.cidr_block,
            network_interface_id=test_network_interface.id,
        )])
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const testVpc = new aws.ec2.Vpc("testVpc", {cidrBlock: "10.1.0.0/16"});
    const testSubnet = new aws.ec2.Subnet("testSubnet", {
        cidrBlock: "10.1.1.0/24",
        vpcId: testVpc.id,
    });
    const testNetworkInterface = new aws.ec2.NetworkInterface("testNetworkInterface", {subnetId: testSubnet.id});
    const testRouteTable = new aws.ec2.RouteTable("testRouteTable", {
        vpcId: testVpc.id,
        routes: [{
            cidrBlock: testVpc.cidrBlock,
            networkInterfaceId: testNetworkInterface.id,
        }],
    });
    
    resources:
      testVpc:
        type: aws:ec2:Vpc
        properties:
          cidrBlock: 10.1.0.0/16
      testRouteTable:
        type: aws:ec2:RouteTable
        properties:
          vpcId: ${testVpc.id}
          routes:
            - cidrBlock: ${testVpc.cidrBlock}
              networkInterfaceId: ${testNetworkInterface.id}
      testSubnet:
        type: aws:ec2:Subnet
        properties:
          cidrBlock: 10.1.1.0/24
          vpcId: ${testVpc.id}
      testNetworkInterface:
        type: aws:ec2:NetworkInterface
        properties:
          subnetId: ${testSubnet.id}
    

    Create RouteTable Resource

    new RouteTable(name: string, args: RouteTableArgs, opts?: CustomResourceOptions);
    @overload
    def RouteTable(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   propagating_vgws: Optional[Sequence[str]] = None,
                   routes: Optional[Sequence[RouteTableRouteArgs]] = None,
                   tags: Optional[Mapping[str, str]] = None,
                   vpc_id: Optional[str] = None)
    @overload
    def RouteTable(resource_name: str,
                   args: RouteTableArgs,
                   opts: Optional[ResourceOptions] = 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.
    
    
    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.

    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

    The RouteTable resource accepts the following input properties:

    VpcId string

    The VPC ID.

    PropagatingVgws List<string>

    A list of virtual gateways for propagation.

    Routes List<RouteTableRoute>

    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.

    Tags 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.

    VpcId string

    The VPC ID.

    PropagatingVgws []string

    A list of virtual gateways for propagation.

    Routes []RouteTableRouteArgs

    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.

    Tags 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.

    vpcId String

    The VPC ID.

    propagatingVgws List<String>

    A list of virtual gateways for propagation.

    routes List<RouteTableRoute>

    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.

    tags 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.

    vpcId string

    The VPC ID.

    propagatingVgws string[]

    A list of virtual gateways for propagation.

    routes RouteTableRoute[]

    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.

    tags {[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[RouteTableRouteArgs]

    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.

    tags 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.

    vpcId String

    The VPC ID.

    propagatingVgws 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.

    tags 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.

    OwnerId string

    The ID of the AWS account that owns the route table.

    TagsAll Dictionary<string, string>

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    Arn string

    The ARN of the route table.

    Id string

    The provider-assigned unique ID for this managed resource.

    OwnerId string

    The ID of the AWS account that owns the route table.

    TagsAll map[string]string

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    arn String

    The ARN of the route table.

    id String

    The provider-assigned unique ID for this managed resource.

    ownerId String

    The ID of the AWS account that owns the route table.

    tagsAll Map<String,String>

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    arn string

    The ARN of the route table.

    id string

    The provider-assigned unique ID for this managed resource.

    ownerId string

    The ID of the AWS account that owns the route table.

    tagsAll {[key: string]: string}

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    arn str

    The ARN of the route table.

    id str

    The provider-assigned unique ID for this managed resource.

    owner_id str

    The ID of the AWS account that owns the route table.

    tags_all Mapping[str, str]

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    arn String

    The ARN of the route table.

    id String

    The provider-assigned unique ID for this managed resource.

    ownerId String

    The ID of the AWS account that owns the route table.

    tagsAll Map<String>

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    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.
    The following state arguments are supported:
    Arn string

    The ARN of the route table.

    OwnerId string

    The ID of the AWS account that owns the route table.

    PropagatingVgws List<string>

    A list of virtual gateways for propagation.

    Routes List<RouteTableRoute>

    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.

    Tags 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.

    TagsAll Dictionary<string, string>

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    VpcId string

    The VPC ID.

    Arn string

    The ARN of the route table.

    OwnerId string

    The ID of the AWS account that owns the route table.

    PropagatingVgws []string

    A list of virtual gateways for propagation.

    Routes []RouteTableRouteArgs

    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.

    Tags 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.

    TagsAll map[string]string

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    VpcId string

    The VPC ID.

    arn String

    The ARN of the route table.

    ownerId String

    The ID of the AWS account that owns the route table.

    propagatingVgws List<String>

    A list of virtual gateways for propagation.

    routes List<RouteTableRoute>

    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.

    tags 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.

    tagsAll Map<String,String>

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    vpcId String

    The VPC ID.

    arn string

    The ARN of the route table.

    ownerId string

    The ID of the AWS account that owns the route table.

    propagatingVgws string[]

    A list of virtual gateways for propagation.

    routes RouteTableRoute[]

    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.

    tags {[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.

    tagsAll {[key: string]: string}

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    vpcId 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[RouteTableRouteArgs]

    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.

    tags 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.

    tags_all Mapping[str, str]

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    vpc_id str

    The VPC ID.

    arn String

    The ARN of the route table.

    ownerId String

    The ID of the AWS account that owns the route table.

    propagatingVgws 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.

    tags 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.

    tagsAll Map<String>

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    vpcId String

    The VPC ID.

    Supporting Types

    RouteTableRoute, RouteTableRouteArgs

    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.

    CidrBlock string

    The CIDR block of the route.

    CoreNetworkArn string

    The Amazon Resource Name (ARN) of a core network.

    DestinationPrefixListId string

    The ID of a managed prefix list destination of the route.

    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, virtual private gateway, or local. local routes cannot be created but can be adopted or imported. See the example above.

    Ipv6CidrBlock string

    The Ipv6 CIDR block of the 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.

    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.

    CidrBlock string

    The CIDR block of the route.

    CoreNetworkArn string

    The Amazon Resource Name (ARN) of a core network.

    DestinationPrefixListId string

    The ID of a managed prefix list destination of the route.

    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, virtual private gateway, or local. local routes cannot be created but can be adopted or imported. See the example above.

    Ipv6CidrBlock string

    The Ipv6 CIDR block of the 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.

    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.

    cidrBlock String

    The CIDR block of the route.

    coreNetworkArn String

    The Amazon Resource Name (ARN) of a core network.

    destinationPrefixListId String

    The ID of a managed prefix list destination of the route.

    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, virtual private gateway, or local. local routes cannot be created but can be adopted or imported. See the example above.

    ipv6CidrBlock String

    The Ipv6 CIDR block of the 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.

    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.

    cidrBlock string

    The CIDR block of the route.

    coreNetworkArn string

    The Amazon Resource Name (ARN) of a core network.

    destinationPrefixListId string

    The ID of a managed prefix list destination of the route.

    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, virtual private gateway, or local. local routes cannot be created but can be adopted or imported. See the example above.

    ipv6CidrBlock string

    The Ipv6 CIDR block of the 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.

    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.

    cidr_block str

    The CIDR block of the route.

    core_network_arn str

    The Amazon Resource Name (ARN) of a core network.

    destination_prefix_list_id str

    The ID of a managed prefix list destination of the route.

    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, virtual private gateway, or local. local routes cannot be created but can be adopted or imported. See the example above.

    ipv6_cidr_block str

    The Ipv6 CIDR block of the 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.

    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.

    cidrBlock String

    The CIDR block of the route.

    coreNetworkArn String

    The Amazon Resource Name (ARN) of a core network.

    destinationPrefixListId String

    The ID of a managed prefix list destination of the route.

    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, virtual private gateway, or local. local routes cannot be created but can be adopted or imported. See the example above.

    ipv6CidrBlock String

    The Ipv6 CIDR block of the 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.

    Import

    Using pulumi import, import Route Tables using the route table id. For example:

     $ pulumi import aws:ec2/routeTable:RouteTable public_rt rtb-4e616f6d69
    

    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

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.2.1 published on Friday, Sep 22, 2023 by Pulumi