From b770636c2ebdd5fd6745f525eb75468fc46a75f5 Mon Sep 17 00:00:00 2001 From: Niall Creech Date: Sat, 27 Feb 2016 04:23:58 +0000 Subject: [PATCH] Set boto3 to use aws profile session This change sets the default boto3 session to use the aws profile and credentials that we specify on the command line. Whenever we set the fabric env.aws we will now also change the boto3 default session to reflect that. --- bootstrap_cfn/fab_tasks.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bootstrap_cfn/fab_tasks.py b/bootstrap_cfn/fab_tasks.py index 27ef426..f57c5a9 100755 --- a/bootstrap_cfn/fab_tasks.py +++ b/bootstrap_cfn/fab_tasks.py @@ -6,6 +6,8 @@ import time import uuid +import boto3 + import dns.resolver from fabric.api import env, task @@ -58,6 +60,8 @@ def aws(profile_name): variable to """ env.aws = str(profile_name).lower() + # Setup boto so we actually use this environment + boto3.setup_default_session(profile_name=env.aws) @task