aws-alfred-workflow
aws-alfred-workflow copied to clipboard
EC2 instance lookup "State:running" filter isn't working
When I do a lookup on my existing ec2 instances by name after a re-deployment, the results list includes the terminated instances and the new running instances. As a result I have to quick look into each one to determine which one is running and which one is not.
As a quick fix I edited find_ec2() in aws.py to include the instance state in the results returned to alfred:
title = '%s (%s) (%s)' % (instance['Tag:Name'], instance['InstanceId'], instance['State']['Name'])
however, I would like to see terminated instances filtered out, or only running instances returned.
What do you think?
That probably makes a whole lot of sense.
You should be able to change line 17 from:
response = client.describe_instances(MaxResults=1000, **next_token)
to:
response = client.describe_instances(MaxResults=1000, Filters=[{
'Name': 'instance-state-name',
'Values': ['running'],
}], **next_token)
Fix implemented in pull request: #12