Accept the id of a network interface, and the id of an elastic ip
    address, and associate the two of them, such that traffic sent to the
    elastic ip address will be forwarded (NATted) to this network interface.

    Optionally specify the private (10.x.x.x) IP address that traffic should
    be NATted to - useful if you have multiple IP addresses assigned to an
    interface.

def _associate_eip_with_interface(eni_id, eip_id, private_ip=None, vm_=None):
    '''
    Accept the id of a network interface, and the id of an elastic ip
    address, and associate the two of them, such that traffic sent to the
    elastic ip address will be forwarded (NATted) to this network interface.

    Optionally specify the private (10.x.x.x) IP address that traffic should
    be NATted to - useful if you have multiple IP addresses assigned to an
    interface.
    '''
    params = {'Action': 'AssociateAddress',
              'NetworkInterfaceId': eni_id,
              'AllocationId': eip_id}

    if private_ip:
        params['PrivateIpAddress'] = private_ip

    result = aws.query(params,
                       return_root=True,
                       location=get_location(vm_),
                       provider=get_provider(),
                       opts=__opts__,
                       sigver='4')

    if not result[2].get('associationId'):
        raise SaltCloudException(
            'Could not associate elastic ip address '
            '<{0}> with network interface <{1}>'.format(
                eip_id, eni_id
            )
        )

    log.debug(
        'Associated ElasticIP address %s with interface %s',
        eip_id, eni_id
    )

    return result[2].get('associationId')