Skip to content

Instantly share code, notes, and snippets.

@iandanforth
Created October 1, 2013 15:56
Show Gist options
  • Save iandanforth/6780739 to your computer and use it in GitHub Desktop.
Save iandanforth/6780739 to your computer and use it in GitHub Desktop.
########
### 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