Creates a route.

    If a nat gateway is specified, boto3 must be installed

    CLI Example:

    .. code-block:: bash

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

def create_route(route_table_id=None, destination_cidr_block=None,
                 route_table_name=None, gateway_id=None,
                 internet_gateway_name=None,
                 instance_id=None, interface_id=None,
                 vpc_peering_connection_id=None, vpc_peering_connection_name=None,
                 region=None, key=None, keyid=None, profile=None,
                 nat_gateway_id=None,
                 nat_gateway_subnet_name=None,
                 nat_gateway_subnet_id=None,
                 ):
    '''
    Creates a route.

    If a nat gateway is specified, boto3 must be installed

    CLI Example:

    .. code-block:: bash

        salt myminion boto_vpc.create_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 not _exactly_one((gateway_id, internet_gateway_name, instance_id, interface_id, vpc_peering_connection_id,
                         nat_gateway_id, nat_gateway_subnet_id, nat_gateway_subnet_name, vpc_peering_connection_name)):
        raise SaltInvocationError('Only one of gateway_id, internet_gateway_name, instance_id, '
                                  'interface_id, vpc_peering_connection_id, nat_gateway_id, '
                                  'nat_gateway_subnet_id, nat_gateway_subnet_name or vpc_peering_connection_name may 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 {'created': False,
                        'error': {'message': 'route table {0} does not exist.'.format(route_table_name)}}

        if internet_gateway_name:
            gateway_id = _get_resource_id('internet_gateway', internet_gateway_name,
                                          region=region, key=key,
                                          keyid=keyid, profile=profile)
            if not gateway_id:
                return {'created': False,
                        'error': {'message': 'internet gateway {0} does not exist.'.format(internet_gateway_name)}}

        if vpc_peering_connection_name:
            vpc_peering_connection_id = _get_resource_id('vpc_peering_connection', vpc_peering_connection_name,
                                                         region=region, key=key,
                                                         keyid=keyid, profile=profile)
            if not vpc_peering_connection_id:
                return {'created': False,
                        'error': {'message': 'VPC peering connection {0} does not exist.'.format(vpc_peering_connection_name)}}

        if nat_gateway_subnet_name:
            gws = describe_nat_gateways(subnet_name=nat_gateway_subnet_name,
                                     region=region, key=key, keyid=keyid, profile=profile)
            if not gws:
                return {'created': False,
                        'error': {'message': 'nat gateway for {0} does not exist.'.format(nat_gateway_subnet_name)}}
            nat_gateway_id = gws[0]['NatGatewayId']

        if nat_gateway_subnet_id:
            gws = describe_nat_gateways(subnet_id=nat_gateway_subnet_id,
                                     region=region, key=key, keyid=keyid, profile=profile)
            if not gws:
                return {'created': False,
                        'error': {'message': 'nat gateway for {0} does not exist.'.format(nat_gateway_subnet_id)}}
            nat_gateway_id = gws[0]['NatGatewayId']

    except BotoServerError as e:
        return {'created': False, 'error': __utils__['boto.get_error'](e)}

    if not nat_gateway_id:
        return _create_resource('route', route_table_id=route_table_id,
                            destination_cidr_block=destination_cidr_block,
                            gateway_id=gateway_id, instance_id=instance_id,
                            interface_id=interface_id, vpc_peering_connection_id=vpc_peering_connection_id,
                            region=region, key=key, keyid=keyid, profile=profile)
    # for nat gateway, boto3 is required
    try:
        conn3 = _get_conn3(region=region, key=key, keyid=keyid, profile=profile)
        ret = conn3.create_route(RouteTableId=route_table_id,
                       DestinationCidrBlock=destination_cidr_block,
                       NatGatewayId=nat_gateway_id)
        return {'created': True, 'id': ret.get('NatGatewayId')}
    except BotoServerError as e:
        return {'created': False, 'error': __utils__['boto.get_error'](e)}