Takes an identifier, either an InstanceId or Name Tag and returns whether the
instance exists in any state. The second instanceState allows specification
of the state the machine is in. Will also return false if an error is thrown
when given an invalid or non existent instance ID.

i.e
doesInstanceExist('i-456ae390', 'running')
Will only return true if that instance exists, and is in a running state.

@param ec2
@param {string} identifier Instance Name Tag or InstanceId
@param instanceState
@returns {*}
function doesInstanceExist (ec2, identifier, instanceState) {
  var params = buildParams(identifier, instanceState)

  function inspectError (err) {
    if (err.code === 'InvalidInstanceID.NotFound') {
      return false
    }

    return Bluebird.reject(err)
  }

  return ec2
    .describeInstancesPromised(params)
    .then(function checkResult (data) {
      return !isEmpty(data.Reservations)
    })
    .catch(inspectError)
}