lib/plugins/aws/customResources/resources/cognitoUserPool/lib/userPool.js/findUserPoolByName
function findUserPoolByName(config) {
  const { userPoolName, region } = config;
  const cognito = new CognitoIdentityServiceProvider({ region });

  const params = {
    MaxResults: 60,
  };

  function recursiveFind(nextToken) {
    if (nextToken) params.NextToken = nextToken;
    return cognito
      .listUserPools(params)
      .promise()
      .then(result => {
        const matches = result.UserPools.filter(pool => pool.Name === userPoolName);
        if (matches.length) {
          return matches.shift();
        }
        if (result.NextToken) return recursiveFind(result.NextToken);
        return null;
      });
  }

  return recursiveFind();
}