| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
Creates a new route in a route table within a VPC. The route's target can be either a gateway attached to the VPC or a NAT instance in the VPC.
{
"Type" : "AWS::EC2::Route",
"Properties" : {
"DestinationCidrBlock" : String,
"GatewayId" : String,
"InstanceId" : String,
"NetworkInterfaceId" : String,
"RouteTableId" : String
} The CIDR address block used for the destination match. For example, "0.0.0.0/0".
Routing decisions are based on the most specific match.
Required: Yes
Type: String
The ID of a gateway attached to your VPC. For example: "igw-eaad4883".
Required: Conditional. You must provide
only one of the following: a GatewayID,
InstanceID, or NetworkInterfaceId.
Type: String
The ID of a NAT instance in your VPC. For example, "i-1a2b3c4d".
Required: Conditional. You must provide
only one of the following: a GatewayID,
InstanceID, or NetworkInterfaceId.
Type: String
Allows the routing of network interface IDs.
Required: Conditional. You must provide
only one of the following: a GatewayID,
InstanceID, or NetworkInterfaceId.
Type: String
The ID of the route table where the route will be added.
Required: Yes
Type: String
When the logical ID of this resource is provided to the Ref intrinsic
function, it returns the resource name.
For more information about using the Ref function, see Ref.
Example Route with Gateway ID
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Resources" : {
"myRoute" : {
"Type" : "AWS::EC2::Route",
"Properties" : {
"RouteTableId" : { "Ref" : "myRouteTable" },
"DestinationCidrBlock" : "0.0.0.0/0",
"GatewayId" : { "Ref" : "myInternetGateway" }
}
}
}
} Example Route with Instance ID
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Resources" : {
"myRoute" : {
"Type" : "AWS::EC2::Route",
"Properties" : {
"RouteTableId" : { "Ref" : "myRouteTable" },
"DestinationCidrBlock" : "0.0.0.0/0",
"InstanceId" : { "Ref" : "myInstance" }
}
}
}
} Example Route with Network Interface ID.
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Resources" : {
"myRoute" : {
"Type" : "AWS::EC2::Route",
"Properties" : {
"RouteTableId" : { "Ref" : "myRouteTable" },
"DestinationCidrBlock" : "0.0.0.0/0",
"NetworkInterfaceId" : { "Ref" : "eni-1a2b3c4d" }
}
}
}
} CreateRoute in the Amazon Elastic Compute Cloud API Reference
Route Tables in the Amazon Virtual Private Cloud User Guide.