Menu
AWS CloudFormation
User Guide (API Version 2010-05-15)

AWS::EC2::RouteTable

Creates a new route table within a VPC. After you create a new route table, you can add routes and associate the table with a subnet.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON


{
   "Type" : "AWS::EC2::RouteTable",
   "Properties" : {
      "VpcId" : String,
      "Tags" : [ Resource Tag, ... ]
   }
}     

YAML


Type: "AWS::EC2::RouteTable"
Properties: 
  VpcId: String
  Tags:
    - Resource Tag

Properties

VpcId

The ID of the VPC where the route table will be created.

Example: vpc-11ad4878

Required: Yes

Type: String

Update requires: Replacement

Tags

An arbitrary set of tags (key–value pairs) for this route table.

Required: No

Type: AWS CloudFormation Resource Tags

Update requires: No interruption.

Return Values

Ref

When you specify an AWS::EC2::RouteTable type as an argument to the Ref function, AWS CloudFormation returns the route table ID, such as rtb-12a34567.

For more information about using the Ref function, see Ref.

Examples

The following example snippet uses the VPC ID from a VPC named myVPC that was declared elsewhere in the same template.

JSON


{
   "AWSTemplateFormatVersion" : "2010-09-09",
   "Resources" : {
      "myRouteTable" : {
         "Type" : "AWS::EC2::RouteTable",
         "Properties" : {
            "VpcId" : { "Ref" : "myVPC" },
            "Tags" : [ { "Key" : "foo", "Value" : "bar" } ]
         }
      }
   }
}        

YAML

AWSTemplateFormatVersion: '2010-09-09'
Resources:
  myRouteTable:
    Type: AWS::EC2::RouteTable
    Properties:
      VpcId:
        Ref: myVPC
      Tags:
      - Key: foo
        Value: bar

See Also