From aac0fd644e31976bc2e0a0010c1ce8920c989417 Mon Sep 17 00:00:00 2001 From: Solomon Negusse Date: Fri, 12 Jul 2024 13:05:24 +0300 Subject: [PATCH 1/3] give ecs task s3 read access - needed for titiler dynamic tiling --- terraform/main.tf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/terraform/main.tf b/terraform/main.tf index a1f11feb..729ff3c7 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -46,7 +46,8 @@ module "orchestration" { security_group_ids = [data.terraform_remote_state.core.outputs.postgresql_security_group_id] task_role_policies = [ module.lambda_raster_tiler.lambda_invoke_policy_arn, - module.storage.s3_write_tiles_arn + module.storage.s3_write_tiles_arn, + "arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess" ] task_execution_role_policies = [ data.terraform_remote_state.core.outputs.secrets_postgresql-reader_policy_arn, From f47bb729da101e432e0c2f7a24e8f67239336442 Mon Sep 17 00:00:00 2001 From: Solomon Negusse Date: Fri, 12 Jul 2024 13:06:29 +0300 Subject: [PATCH 2/3] fix issue with redirect failing when dataset is not in the query string --- .../redirect_latest_tile_cache/src/lambda_function.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/modules/content_delivery_network/lambda_functions/redirect_latest_tile_cache/src/lambda_function.py b/terraform/modules/content_delivery_network/lambda_functions/redirect_latest_tile_cache/src/lambda_function.py index efb2199e..a1ab652b 100644 --- a/terraform/modules/content_delivery_network/lambda_functions/redirect_latest_tile_cache/src/lambda_function.py +++ b/terraform/modules/content_delivery_network/lambda_functions/redirect_latest_tile_cache/src/lambda_function.py @@ -53,7 +53,7 @@ def handler(event, context): dataset = path_items[1] if dataset == "cog": query_params = parse_qs(query_string) - dataset = query_params.get("dataset", [None])[0] + dataset = query_params.get("dataset", ["cog"])[0] version = query_params.get("version", [None])[0] else: version = path_items[2] @@ -61,7 +61,7 @@ def handler(event, context): latest_versions = get_latest_versions(f"https://{host}/_latest") for latest_version in latest_versions: - if latest_version["dataset"] == dataset: + if latest_version["dataset"] == dataset or dataset == "cog": if "cog" in path_items: if version != "latest": From fb0b2b8030d2d8d289be15682a16add2d898baf4 Mon Sep 17 00:00:00 2001 From: Solomon Negusse Date: Tue, 16 Jul 2024 15:18:29 +0300 Subject: [PATCH 3/3] add clarifying comment for cog asset latest redirect --- .../redirect_latest_tile_cache/src/lambda_function.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/terraform/modules/content_delivery_network/lambda_functions/redirect_latest_tile_cache/src/lambda_function.py b/terraform/modules/content_delivery_network/lambda_functions/redirect_latest_tile_cache/src/lambda_function.py index a1ab652b..ddbd7752 100644 --- a/terraform/modules/content_delivery_network/lambda_functions/redirect_latest_tile_cache/src/lambda_function.py +++ b/terraform/modules/content_delivery_network/lambda_functions/redirect_latest_tile_cache/src/lambda_function.py @@ -53,6 +53,9 @@ def handler(event, context): dataset = path_items[1] if dataset == "cog": query_params = parse_qs(query_string) + # in the case of cog assets, we look for optional + # `dataset` (if url to external cog isn't specified) in query + # parameter setting the default to "cog" instead of `None` for clarity in later steps dataset = query_params.get("dataset", ["cog"])[0] version = query_params.get("version", [None])[0] else: @@ -64,6 +67,7 @@ def handler(event, context): if latest_version["dataset"] == dataset or dataset == "cog": if "cog" in path_items: + if version != "latest": return request