Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon aws cli query starts_with

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"
like image 579
RVid Avatar asked Jul 16 '26 01:07

RVid


1 Answers

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]' 

like image 67
Adiii Avatar answered Jul 17 '26 17:07

Adiii



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!