I'm currently working on a cloudformation script that requires a lot of MSK configuration details to run. I am working on a makefile that runs the command
@aws kafka list-clusters
This returns a json-like structure that can be found here . Most of the details I require are in that structure, is there a way to retrieve each of them without having to save the output and then parse through the structure..? All of this would be done within the makefile, so that it can be plugged directly into the cloudformation and wouldn't require manual input/hardcoded values.
I hope I'm not missing something simple, Thanks!
Right, seems it was as simple as using a --query. So let's say I wanted to get the ARN of the cluster (if there is only one on the region which there is in my case) I'd call
CLUSTER_ARN = @aws kafka list-clusters --query 'ClusterInfoList[0].ClusterArn'
This will call the Shell command to list only the first kafka cluster, and return the ClusterArn value and store it in CLUSTER_ARN to be used throughout the Makefile.
Please read here to see more about filtering :)