AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Replaces an existing route within a route table in 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, or reset the local route to its default target.

For more information, see Route tables in the Amazon VPC User Guide.

Note:

For .NET Core this operation is only available in asynchronous form. Please refer to ReplaceRouteAsync.

Namespace: Amazon.EC2
Assembly: AWSSDK.EC2.dll
Version: 3.x.y.z

Syntax

C#
public virtual ReplaceRouteResponse ReplaceRoute(
         ReplaceRouteRequest request
)

Parameters

request
Type: Amazon.EC2.Model.ReplaceRouteRequest

Container for the necessary parameters to execute the ReplaceRoute service method.

Return Value


The response from the ReplaceRoute service method, as returned by EC2.

Examples

This example replaces the specified route in the specified table table. The new route matches the specified CIDR and sends the traffic to the specified virtual private gateway.

To replace a route


var client = new AmazonEC2Client();
var response = client.ReplaceRoute(new ReplaceRouteRequest 
{
    DestinationCidrBlock = "10.0.0.0/16",
    GatewayId = "vgw-9a4cacf3",
    RouteTableId = "rtb-22574640"
});


            

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5

See Also