DeleteRouteCommand

Deletes the specified route from the specified route table.

Example Syntax

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

import { EC2Client, DeleteRouteCommand } from "@aws-sdk/client-ec2"; // ES Modules import
// const { EC2Client, DeleteRouteCommand } = require("@aws-sdk/client-ec2"); // CommonJS import
const client = new EC2Client(config);
const input = { // DeleteRouteRequest
  DestinationPrefixListId: "STRING_VALUE",
  DryRun: true || false,
  RouteTableId: "STRING_VALUE", // required
  DestinationCidrBlock: "STRING_VALUE",
  DestinationIpv6CidrBlock: "STRING_VALUE",
};
const command = new DeleteRouteCommand(input);
const response = await client.send(command);
// {};

Example Usage

 Loading code editor

DeleteRouteCommand Input

See DeleteRouteCommandInput for more details

Parameter
Type
Description
RouteTableId
Required
string | undefined

The ID of the route table.

DestinationCidrBlock
string | undefined

The IPv4 CIDR range for the route. The value you specify must match the CIDR for the route exactly.

DestinationIpv6CidrBlock
string | undefined

The IPv6 CIDR range for the route. The value you specify must match the CIDR for the route exactly.

DestinationPrefixListId
string | undefined

The ID of the prefix list for the route.

DryRun
boolean | undefined

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

DeleteRouteCommand Output

See DeleteRouteCommandOutput for details

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.

Throws

Name
Fault
Details
EC2ServiceException
Base exception class for all service exceptions from EC2 service.