Associate an Elastic IP address with a currently running instance or a network interface.
    This requires exactly one of either 'public_ip' or 'allocation_id', depending
    on whether you’re associating a VPC address or a plain EC2 address.

    instance_id
        (string) – ID of the instance to associate with (exclusive with 'instance_name')
    instance_name
        (string) – Name tag of the instance to associate with (exclusive with 'instance_id')
    public_ip
        (string) – Public IP address, for standard EC2 based allocations.
    allocation_id
        (string) – Allocation ID for a VPC-based EIP.
    network_interface_id
        (string) - ID of the network interface to associate the EIP with
    network_interface_name
        (string) - Name of the network interface to associate the EIP with
    private_ip_address
        (string) – The primary or secondary private IP address to associate with the Elastic IP address.
    allow_reassociation
        (bool)   – Allow a currently associated EIP to be re-associated with the new instance or interface.

    returns
        (bool)   - True on success, False on failure.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_ec2.associate_eip_address instance_name=bubba.ho.tep allocation_id=eipalloc-ef382c8a

    .. versionadded:: 2016.3.0

def associate_eip_address(instance_id=None, instance_name=None, public_ip=None,
                          allocation_id=None, network_interface_id=None,
                          network_interface_name=None, private_ip_address=None,
                          allow_reassociation=False, region=None, key=None,
                          keyid=None, profile=None):
    '''
    Associate an Elastic IP address with a currently running instance or a network interface.
    This requires exactly one of either 'public_ip' or 'allocation_id', depending
    on whether you’re associating a VPC address or a plain EC2 address.

    instance_id
        (string) – ID of the instance to associate with (exclusive with 'instance_name')
    instance_name
        (string) – Name tag of the instance to associate with (exclusive with 'instance_id')
    public_ip
        (string) – Public IP address, for standard EC2 based allocations.
    allocation_id
        (string) – Allocation ID for a VPC-based EIP.
    network_interface_id
        (string) - ID of the network interface to associate the EIP with
    network_interface_name
        (string) - Name of the network interface to associate the EIP with
    private_ip_address
        (string) – The primary or secondary private IP address to associate with the Elastic IP address.
    allow_reassociation
        (bool)   – Allow a currently associated EIP to be re-associated with the new instance or interface.

    returns
        (bool)   - True on success, False on failure.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_ec2.associate_eip_address instance_name=bubba.ho.tep allocation_id=eipalloc-ef382c8a

    .. versionadded:: 2016.3.0
    '''
    if not salt.utils.data.exactly_one((instance_id, instance_name,
                                        network_interface_id,
                                        network_interface_name)):
        raise SaltInvocationError("Exactly one of 'instance_id', "
                                  "'instance_name', 'network_interface_id', "
                                  "'network_interface_name' must be provided")

    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    if instance_name:
        try:
            instance_id = get_id(name=instance_name, region=region, key=key,
                                 keyid=keyid, profile=profile)
        except boto.exception.BotoServerError as e:
            log.error(e)
            return False
        if not instance_id:
            log.error(
                "Given instance_name '%s' cannot be mapped to an instance_id",
                instance_name
            )
            return False

    if network_interface_name:
        try:
            network_interface_id = get_network_interface_id(
                network_interface_name, region=region, key=key, keyid=keyid,
                profile=profile)
        except boto.exception.BotoServerError as e:
            log.error(e)
            return False
        if not network_interface_id:
            log.error("Given network_interface_name '%s' cannot be mapped to "
                      "an network_interface_id", network_interface_name)
            return False

    try:
        return conn.associate_address(instance_id=instance_id,
                                      public_ip=public_ip,
                                      allocation_id=allocation_id,
                                      network_interface_id=network_interface_id,
                                      private_ip_address=private_ip_address,
                                      allow_reassociation=allow_reassociation)
    except boto.exception.BotoServerError as e:
        log.error(e)
        return False