title: Groovy Script Returns empty list for AWS ec2 describe-instances
body: <p>I am trying to fetch the ec2 instance id along with instance name(from ec2 tag 'Name' which mentioned the app name) and trying to return this combination separated with '_'. I am able to get this details quite fine from the AWS CLI on shell but when using the same aws cli command in Groovy Script, I am getting empty list</p>
  <p>Groovy Script</p>
  <pre><code>import java.util.logging.LogManager
  import java.util.logging.Level
  import jenkins.model.Jenkins
  
  def env = System.getenv()
  logger.log(Level.INFO,&quot;AWS Account is: &quot;+aws_account)
  logger.log(Level.INFO,&quot;Region is: &quot;+regions)
  def output = []
  
  try {
  logger.log(Level.INFO,&quot;Region is: &quot;+&quot;${regions}&quot;)
  def command = &quot;/usr/local/bin/aws ec2 describe-instances --profile ${aws_account} --region ${regions} --query [Reservations[*].Instances[*].{InstanceId:InstanceId,Tags:Tags[?Key == `Name`] | [0].Value}] --output text | tr '\t' '_'&quot;
  
  
  println(&quot;Command is: &quot;+command)
  def proc = command.execute()
  proc.waitFor()
  output = proc.in.text.tokenize()
  
  }
  catch(Exception e) {
    logger.log(Level.SEVERE, e.getMessage(), e)
  }
  if(output.size() == 0)
    throw new Exception(&quot;No instances found&quot;)
  
  return output
  </code></pre>
  <p>Output received from AWS CLI Command directly from shell</p>
  <pre><code>i-0XXXXXXXXXXXXXXX1_app-11
  i-0XXXXXXXXXXXXXXX2_app-21
  i-0XXXXXXXXXXXXXXX3_app-prd-11
  i-0XXXXXXXXXXXXXXX4_app-poc-11
  </code></pre>