update utils

pull/37/head
Minh Doan 6 years ago
parent 8cd1bd9134
commit b6f3e8f95c
  1. 9
      aws-experiment-launch/utils/utils.py

@ -32,11 +32,14 @@ def get_ip_list(response):
else: else:
return [] return []
def collect_public_ips(region_number, node_name_tag, region_config): def create_ec2_client(region_number, region_config):
config = read_configuration_file(region_config) config = read_region_config(region_config)
region_name = config[region_number][REGION_NAME] region_name = config[region_number][REGION_NAME]
session = boto3.Session(region_name=region_name) session = boto3.Session(region_name=region_name)
ec2_client = session.client('ec2') return session.client('ec2')
def collect_public_ips(region_number, node_name_tag, region_config):
ec2_client = create_ec2_client(region_number, region_config)
filters = [{'Name': 'tag:Name','Values': [node_name_tag]}] filters = [{'Name': 'tag:Name','Values': [node_name_tag]}]
response = ec2_client.describe_instances(Filters=filters) response = ec2_client.describe_instances(Filters=filters)
ip_list = [] ip_list = []

Loading…
Cancel
Save