EC2.Client.
replace_route
(**kwargs)¶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 Virtual Private Cloud User Guide .
See also: AWS API Documentation
Request Syntax
response = client.replace_route(
DestinationCidrBlock='string',
DestinationIpv6CidrBlock='string',
DestinationPrefixListId='string',
DryRun=True|False,
VpcEndpointId='string',
EgressOnlyInternetGatewayId='string',
GatewayId='string',
InstanceId='string',
LocalTarget=True|False,
NatGatewayId='string',
TransitGatewayId='string',
LocalGatewayId='string',
CarrierGatewayId='string',
NetworkInterfaceId='string',
RouteTableId='string',
VpcPeeringConnectionId='string',
CoreNetworkArn='string'
)
DryRunOperation
. Otherwise, it is UnauthorizedOperation
.local
).[REQUIRED]
The ID of the route table.
None
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.
response = client.replace_route(
DestinationCidrBlock='10.0.0.0/16',
GatewayId='vgw-9a4cacf3',
RouteTableId='rtb-22574640',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}