Created
October 1, 2013 15:56
-
-
Save iandanforth/6780739 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######## | |
### Assuming Tag Key == 'params' and Tag Value = 'frontend:foo:bar:numenta' | |
tag = 'params' | |
filters = {} | |
if tag: | |
filters["tag-key"] = tag | |
# Stupid EC2 wrapper needs to be removed | |
reservations = ec2Conn.get_all_instances(filters=filters) | |
instances = [] | |
for res in reservations: | |
for instance in res.instances: | |
# Search | |
for tagName, tagValue in instance.tags.iteritems(): | |
print tagName, tagValue | |
if ':numenta:' in tagValue and instance not in instances: | |
instances.append(instance) | |
######## | |
### Assuming Tag Key == 'params:frontend:foo:bar:numenta' and Tag Value = 'None' | |
# OMIT THE TAG HERE AND FROM boto-config.yaml | |
tag = None | |
filters = {} | |
if tag: | |
filters["tag-key"] = tag | |
# Stupid EC2 wrapper needs to be removed | |
reservations = ec2Conn.get_all_instances(filters=filters) | |
instances = [] | |
for res in reservations: | |
for instance in res.instances: | |
# Search | |
for tagName, tagValue in instance.tags.iteritems(): | |
print tagName, tagValue | |
if ':numenta:' in tagName and instance not in instances: | |
instances.append(instance) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment