77import boto3
88
99
10- _PROFILE = (
11- "AWS_STATIC_SITE_PROFILE"
12- )
1310_CFDIST = (
1411 "CF_DIST_ID_STATIC_LO"
1512)
@@ -31,8 +28,7 @@ def get_env_var(env):
3128
3229def build_lambda_arn (function_name ) -> str :
3330 """ Get the latest version for the function """
34- profile = get_env_var (_PROFILE )
35- session = boto3 .Session (profile_name = profile )
31+ session = boto3 .Session ()
3632 client = session .client ('lambda' , 'us-east-1' )
3733 versions = client .list_versions_by_function (FunctionName = function_name )["Versions" ]
3834 # Find the highest version number
@@ -61,8 +57,7 @@ def get_lambda_arn() -> str:
6157def is_function_attached ():
6258 """ Is the function attached to the distribution? """
6359 func = get_lambda_arn ()
64- profile = get_env_var (_PROFILE )
65- session = boto3 .Session (profile_name = profile )
60+ session = boto3 .Session ()
6661 cf_client = session .client ('cloudfront' , 'us-east-1' )
6762 config = cf_client .get_distribution_config (
6863 Id = get_env_var (_CFDIST )
@@ -88,8 +83,7 @@ def attach_function():
8883 "EventType" : "origin-response" ,
8984 "LambdaFunctionARN" : func
9085 }
91- profile = get_env_var (_PROFILE )
92- session = boto3 .Session (profile_name = profile )
86+ session = boto3 .Session ()
9387 cf_client = session .client ('cloudfront' , 'us-east-1' )
9488 config = cf_client .get_distribution_config (
9589 Id = get_env_var (_CFDIST )
0 commit comments