diff --git a/aws-experiment-launch/utils/utils.py b/aws-experiment-launch/utils/utils.py index ce10076dd..7a8c31ce5 100644 --- a/aws-experiment-launch/utils/utils.py +++ b/aws-experiment-launch/utils/utils.py @@ -32,11 +32,14 @@ def get_ip_list(response): else: return [] -def collect_public_ips(region_number, node_name_tag, region_config): - config = read_configuration_file(region_config) +def create_ec2_client(region_number, region_config): + config = read_region_config(region_config) region_name = config[region_number][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]}] response = ec2_client.describe_instances(Filters=filters) ip_list = []