5

Trying to filter out only repos that start with name but always got empty collection back. I can see the values there when running without the starts_with option

aws ecr describe-repositories --query "repositories[?starts_with(repositoryName, 'test') == 'true'].repositoryName"
RVid
  • 1,207
  • 1
  • 14
  • 31

1 Answers1

14

You need to use Backticks for pattern matching.

aws ecr describe-repositories --query 'repositories[?starts_with(repositoryName, `stage`) == `true`]' 

or If you want just ARN or NAME then you can use


aws ecr describe-repositories --query 'repositories[?starts_with(repositoryName, `stage`) == `true`]|[].[repositoryName,repositoryUri]' 

Adiii
  • 54,482
  • 7
  • 145
  • 148