Reputation: 501
I am trying to get all ec2 instance that have schedules events and filter by a tag name. But the filter by tag throws an error. I am trying the below command:
aws ec2 describe-instance-status --filters "Name=tag:Name,Values=*xyz*"
The above command throws:
An error occurred (InvalidParameterValue) when calling the DescribeInstanceStatus operation:
The filter 'tag:Name' is invalid
However when I run the same filer on describe-instances, it works fine:
aws ec2 describe-instances --filters "Name=tag:Name,Values=*xyz*"
The above command returns the ec2 instances as expected.
It happens on boto3 as well. Please help on this.
Upvotes: 5
Views: 8669
Reputation: 15472
The filters that are accepted by describe-instance-status are documented here. As can be seen, filtering by tag is not an option. You will probably need to firstly get the list of instance-ids using describe-instances and filtering by tag, and then for each of these instance-ids, find the instance status.
Upvotes: 4