Replaces a route.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_vpc.replace_route 'rtb-1f382e7d' '10.0.0.0/16' gateway_id='vgw-a1b2c3'

def replace_route(route_table_id=None, destination_cidr_block=None,
                  route_table_name=None, gateway_id=None,
                  instance_id=None, interface_id=None,
                  region=None, key=None, keyid=None, profile=None,
                  vpc_peering_connection_id=None):
    '''
    Replaces a route.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_vpc.replace_route 'rtb-1f382e7d' '10.0.0.0/16' gateway_id='vgw-a1b2c3'

    '''

    if not _exactly_one((route_table_name, route_table_id)):
        raise SaltInvocationError('One (but not both) of route_table_id or route_table_name '
                                  'must be provided.')

    if destination_cidr_block is None:
        raise SaltInvocationError('destination_cidr_block is required.')

    try:
        if route_table_name:
            route_table_id = _get_resource_id('route_table', route_table_name,
                                              region=region, key=key,
                                              keyid=keyid, profile=profile)
            if not route_table_id:
                return {'replaced': False,
                        'error': {'message': 'route table {0} does not exist.'.format(route_table_name)}}
        conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

        if conn.replace_route(route_table_id, destination_cidr_block,
                              gateway_id=gateway_id, instance_id=instance_id,
                              interface_id=interface_id, vpc_peering_connection_id=vpc_peering_connection_id):
            log.info(
                'Route with cidr block %s on route table %s was replaced',
                route_table_id, destination_cidr_block
            )
            return {'replaced': True}
        else:
            log.warning(
                'Route with cidr block %s on route table %s was not replaced',
                route_table_id, destination_cidr_block
            )
            return {'replaced': False}
    except BotoServerError as e:
        return {'replaced': False, 'error': __utils__['boto.get_error'](e)}