Closed taraspos closed 6 years ago
Hello,
The --ids
flag in awless list
is a shortcut to display all ids and names of resources (perhaps badly named...). It is for example used for completion.
If you want to get only alarms ARNs, you can run:
awless list alarms --columns=id --format=tsv --no-headers
However, for now, --columns=
flag is not compatible with --filter=
flag on different columns. So you can not directly filter on name and keep only ARNs.
However, as a quick fix you might want to do:
awless list alarms --filter Name=testalarm --columns=Arn,Name --format=tsv --no-headers | grep "TaskFailAlarm" | cut -f
Errata on the second command line above. It should be --columns=arn
and not --columns=id
such as:
awless list alarms --columns=arn --format=tsv --no-headers
What is not obvious indeed is that we can select column name (i.e. Arn) that are not visible but part of the awless Alarm object model (i.e. in awless an Alarm has an Arn also it is just not displayed for more clarity).
Also --filter
only work on columns that are going to be displayed.
So to complete what @fxaguessy said and to get a one-liner that get the Arn of some alarm filtering on name
you can do:
awless ls alarms --columns=arn,name --filter name=TaskFailAlarm --no-headers
I am closing this. Re-open if needed.
Hey. I'm using awless to get the arn of some alarm, to do so, I'm filtering alarms by name and getting ids. But getting the next result:
Somehow instead of getting just Arn, I'm getting the alarm name in the new line as well.