File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -491,10 +491,16 @@ def lambda_handler(event, context):
491
491
exit (1 )
492
492
s3_bucket = event ['bucket' ]
493
493
494
- if 'region' not in event :
495
- LOG .error ("No bucket region has been provided . Exiting." )
494
+ if 'region' not in event . keys () and 'AWS_DEFAULT_REGION' not in os . environ . keys () :
495
+ LOG .error ("Unable to determine AWS region code . Exiting." )
496
496
exit (1 )
497
- s3_region = event ['region' ]
497
+ else :
498
+ if 'region' not in event .keys ():
499
+ LOG .warning ("Using local environment to determine AWS region code." )
500
+ s3_region = os .environ ['AWS_DEFAULT_REGION' ]
501
+ LOG .warning ("Local region set to '{0}'." .format (s3_region ))
502
+ else :
503
+ s3_region = event ['region' ]
498
504
499
505
if 'defaultkey' not in event :
500
506
LOG .info ("No default KMS key provided, defaulting to 'AES256'." )
You can’t perform that action at this time.
0 commit comments