Skip to content

Commit

Permalink
added aws key/secret to boto init
Browse files Browse the repository at this point in the history
  • Loading branch information
mikery committed May 4, 2012
1 parent aaa877d commit f52fd63
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fabric_ec2/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from boto import ec2


def get_instances_for_tags(tags, ec2_regions=None):
def get_instances_for_tags(tags, ec2_regions=None, aws_key=None, aws_secret=None):
""" Returns a list of hosts, matching the given tags/ec2_regions.
"""
# Use default regions (taken from boto) if user didn't specify a list
Expand All @@ -18,7 +18,9 @@ def get_instances_for_tags(tags, ec2_regions=None):

host_list = []
for region in ec2_regions:
conn = ec2.connect_to_region(region)
conn = ec2.connect_to_region(region,
aws_access_key_id=aws_key,
aws_secret_access_key=aws_secret)
reservations = conn.get_all_instances(None, tag_filter)
for res in reservations:
for instance in res.instances:
Expand Down

0 comments on commit f52fd63

Please sign in to comment.