From 34a2a1a431eb17da4096a828a320fa9dac20eaf2 Mon Sep 17 00:00:00 2001 From: Loren Gordon Date: Wed, 16 Oct 2019 07:43:21 -0700 Subject: [PATCH] Adds comments on boto cache dir usage --- new-account-trust-policy.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/new-account-trust-policy.py b/new-account-trust-policy.py index 972f29cb..f1fbccdd 100644 --- a/new-account-trust-policy.py +++ b/new-account-trust-policy.py @@ -14,6 +14,10 @@ import boto3 import botocore +# Allow user to override the boto cache dir using the env `BOTOCORE_CACHE_DIR` +# References: +# * +# * BOTOCORE_CACHE_DIR = os.environ.get('BOTOCORE_CACHE_DIR') DEFAULT_LOG_LEVEL = logging.INFO @@ -190,6 +194,9 @@ def lambda_handler(event, context): update_role_name = os.environ['UPDATE_ROLE_NAME'] role_arn = f'arn:{partition}:iam::{account_id}:role/{assume_role_name}' trust_policy = os.environ['TRUST_POLICY'] + + # In lambda, override the default boto cache dir because only `/tmp/` + # is writeable botocore_cache_dir = BOTOCORE_CACHE_DIR or '/tmp/.aws/boto/cache' # Assume the role and update the role trust policy