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
  • 23,582
  • 9
  • 92
  • 102
thinkingmonster
  • 4,633
  • 6
  • 34
  • 53

0 Answers0