Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CreateRouteCommand

Creates a route in a route table within a VPC.

You must specify either a destination CIDR block or a prefix list ID. You must also specify exactly one of the resources from the parameter list.

When determining how to route traffic, we use the route with the most specific match. For example, traffic is destined for the IPv4 address 192.0.2.3, and the route table includes the following two IPv4 routes:

  • 192.0.2.0/24 (goes to some target A)

  • 192.0.2.0/28 (goes to some target B)

Both routes apply to the traffic destined for 192.0.2.3. However, the second route in the list covers a smaller number of IP addresses and is therefore more specific, so we use that route to determine where to target the traffic.

For more information about route tables, see Route tables in the Amazon Virtual Private Cloud User Guide.

example

Use a bare-bones client and the command you need to make an API call.

import { EC2Client, CreateRouteCommand } from "@aws-sdk/client-ec2"; // ES Modules import
// const { EC2Client, CreateRouteCommand } = require("@aws-sdk/client-ec2"); // CommonJS import
const client = new EC2Client(config);
const command = new CreateRouteCommand(input);
const response = await client.send(command);
see

CreateRouteCommandInput for command's input shape.

see

CreateRouteCommandOutput for command's response shape.

see

config for EC2Client's config shape.

Hierarchy

Implements

Index

Constructors

constructor

Properties

Readonly input

input: CreateRouteCommandInput

Readonly middlewareStack

middlewareStack: IMiddlewareStack<CreateRouteCommandInput, CreateRouteCommandOutput>

Methods

Static getEndpointParameterInstructions