Get AWS EMR Cluster ID from Name

Question:

AWS CLI command aws emr list-clusters returns the following json. Is there a way through bash or groovy that I can use the Name to get the Id? I can’t just use the Id becauseI am deleting clusters and rebuilding them with only the same name. So I know the name of the cluster is “my-cluster” and I would like to use it somehow to get the Id of the cluster. End case is I actually want the Master public DNS of the cluster.

Answer:

You can use the query parameter to achieve what you are trying. The command will look like below:

You can find the complete documentation for the query parameter here.

Leave a Reply