Menu
Amazon Elastic Compute Cloud
API Reference (API Version 2016-11-15)

ReplaceRoute

Replaces an existing route within a route table in a VPC. You must provide only one of the following: Internet gateway or virtual private gateway, NAT instance, NAT gateway, VPC peering connection, network interface, or egress-only Internet gateway.

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

Request Parameters

The following parameters are for this specific action. For more information about required and optional parameters that are common to all actions, see Common Query Parameters.

DestinationCidrBlock

The IPv4 CIDR address block used for the destination match. The value you provide must match the CIDR of an existing route in the table.

Type: String

Required: No

DestinationIpv6CidrBlock

The IPv6 CIDR address block used for the destination match. The value you provide must match the CIDR of an existing route in the table.

Type: String

Required: No

DryRun

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.

Type: Boolean

Required: No

EgressOnlyInternetGatewayId

[IPv6 traffic only] The ID of an egress-only Internet gateway.

Type: String

Required: No

GatewayId

The ID of an Internet gateway or virtual private gateway.

Type: String

Required: No

InstanceId

The ID of a NAT instance in your VPC.

Type: String

Required: No

NatGatewayId

[IPv4 traffic only] The ID of a NAT gateway.

Type: String

Required: No

NetworkInterfaceId

The ID of a network interface.

Type: String

Required: No

RouteTableId

The ID of the route table.

Type: String

Required: Yes

VpcPeeringConnectionId

The ID of a VPC peering connection.

Type: String

Required: No

Response Elements

The following elements are returned by the service.

requestId

The ID of the request.

Type: String

return

Is true if the request succeeds, and an error otherwise.

Type: Boolean

Errors

For information about the errors that are common to all actions, see Common Client Errors.

Example

Example

This example replaces a route in the specified route table. The new route matches the IPv4 CIDR 10.0.0.0/8 and sends the traffic to the virtual private gateway with the ID vgw-1d00376e.

Sample Request

https://ec2.amazonaws.com/?Action=ReplaceRoute &RouteTableId=rtb-e4ad488d &DestinationCidrBlock=10.0.0.0/8 &GatewayId=vgw-1d00376e &AUTHPARAMS

Sample Response

<ReplaceRouteResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/"> <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> <return>true</return> </ReplaceRouteResponse>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: