From 063aac40c52740f5c082af062b3da2a19932c612 Mon Sep 17 00:00:00 2001 From: sudobangbang Date: Tue, 25 Apr 2023 12:13:33 -0700 Subject: [PATCH] handle mwaa forwarding for LF archive (#20) Co-authored-by: ranchodeluxe --- .../s3_event_bridge_to_sfn_execute/lambda_function.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/terraform/veda-wfs3/functions/s3_event_bridge_to_sfn_execute/lambda_function.py b/terraform/veda-wfs3/functions/s3_event_bridge_to_sfn_execute/lambda_function.py index 7a5c6ad..d524d83 100644 --- a/terraform/veda-wfs3/functions/s3_event_bridge_to_sfn_execute/lambda_function.py +++ b/terraform/veda-wfs3/functions/s3_event_bridge_to_sfn_execute/lambda_function.py @@ -20,6 +20,10 @@ def lambda_handler(event, context): s3_filename_no_ext = os.path.splitext(s3_filename_target)[0] print(f"[ S3 FILENAME NO EXT ]: {s3_filename_no_ext}") + bucket_key_prefix = "EIS/FEDSoutput/Snapshot/" + if s3_filename_no_ext.startswith("lf_"): + bucket_key_prefix = "EIS/FEDSoutput/LFArchive/" + # get web token mwaa_cli_token = client.create_cli_token( Name=mwaa_env_name @@ -28,7 +32,7 @@ def lambda_handler(event, context): serialized_args = json.dumps({ "discovery": "s3", "collection": s3_filename_no_ext, - "prefix": "EIS/FEDSoutput/Snapshot/", + "prefix": bucket_key_prefix, "bucket": "veda-data-store-staging", "filename_regex": f"^(.*){s3_filename_target}$", "vector": True