0

I want to embed following command in groovy.

aws ec2 describe-instances --output text --query "Reservations[].Instances[].{Name: Tags[?Key == 'Name'].Value|[0]}"

but nothing is working I tried escaping single quotes, double quotes in the main command but still groovy stuff not working.

My final groovy script is as shown below

def command = "aws ec2 describe-instances --output text --query \"Reservations[].Instances[].{Name: Tags[?Key == \'Name\'].Value|[0]}\" "
def proc = command.execute()
proc.waitFor()              
def instances = proc.in.text.readLines()
return instances
lepe
  • 24,677
  • 9
  • 99
  • 108
thinkingmonster
  • 5,063
  • 8
  • 35
  • 57

0 Answers0