How do I perform a "regex" type match on a start of a string in jmespath?
aws emr list-clusters --active --query 'Clusters[?Name==`My-Cluster`].Id' --output text
I was looking at the answers in AWS CLI EMR get Master node Instance ID and tag it and I can use most of the solution. However the my cluster name is variable (based on time it was built). So i need to edit the Name=='My-Cluster'
to be able to search with a wild card at the end of the name. This way I can find My-Cluser-082022 then next month find MY-Cluster-092022 next month.
You could probably use starts_with()
.
It would be something like:
Clusters[starts_with(Name, 'My-Cluster')].Id
Some good resources: