1 Answer
- Newest
- Most votes
- Most comments
0
I think I found a solution to query the inventory without listing the terminated instances IDs.
Bellow is my one liner.
aws ssm get-inventory --filters '[{"Key":"AWS:Tag.Key","Values":["OS"],"Type":"Equal"},{"Key":"AWS:Tag.Value","Values":["windows"],"Type":"Equal"},{"Key":"AWS:InstanceInformation.InstanceStatus","Values":["terminated"],"Type":"NotEqual"}]'| grep -i instanceid | awk '{print $2}' | sed 's/."(.)"[^"]*$/\1/'
Now it is only showing the running instances.
Cheers
Norbert
answered 3 years ago
Relevant content
- Accepted Answerasked 2 years ago
- asked a year ago
- asked 8 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated a month ago