From 70ae7382e5f1385807bcffb72113f877e120d0be Mon Sep 17 00:00:00 2001 From: Will Thames Date: Wed, 18 Oct 2017 05:43:30 +1000 Subject: [PATCH] Allow AWS region to be detected from boto profiles (#31768) --- lib/ansible/module_utils/ec2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/ec2.py b/lib/ansible/module_utils/ec2.py index ac81c881f6..65cf245136 100644 --- a/lib/ansible/module_utils/ec2.py +++ b/lib/ansible/module_utils/ec2.py @@ -230,7 +230,7 @@ def get_aws_connection_info(module, boto3=False): module.fail_json(msg="boto is required for this module. Please install boto and try again") elif HAS_BOTO3: # here we don't need to make an additional call, will default to 'us-east-1' if the below evaluates to None. - region = botocore.session.get_session().get_config_variable('region') + region = botocore.session.Session(profile=profile_name).get_config_variable('region') else: module.fail_json(msg="Boto3 is required for this module. Please install boto3 and try again")