Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(data-warehouse): scope warehouse S3 egress-proxy bypass to our bucket (#76016)

Tom Owers41a60d3e8798
diff --git a/posthog/settings/data_warehouse.py b/posthog/settings/data_warehouse.py
index 88a3780f88d8..02792a306046 100644
--- a/posthog/settings/data_warehouse.py
+++ b/posthog/settings/data_warehouse.py
@@ -19,6 +19,12 @@ USE_LOCAL_SETUP = TEST or (DEBUG and len(os.getenv("OBJECT_STORAGE_ENDPOINT", "h
PYARROW_DEBUG_LOGGING = get_from_env("PYARROW_DEBUG_LOGGING", False, type_cast=str_to_bool)
+# Region hosting BUCKET_URL. Only used to build the bucket's virtual-hosted hostname for the
+# egress-proxy bypass in products/data_warehouse/backend/s3_proxy.py; the AWS clients resolve their
+# own region as before. Falls back to the ambient AWS_REGION, and an empty value leaves the bypass
+# off (the bypass itself is gated by a feature flag, not by a setting).
+DATA_WAREHOUSE_S3_REGION: str = os.getenv("DATA_WAREHOUSE_S3_REGION", os.getenv("AWS_REGION", ""))
+
# Rollback-only escape hatch: restores the legacy delta-rs unsafe-rename S3 backend,
# which has no commit-conflict detection. Default (false) keeps conditional-put commits.
DATA_WAREHOUSE_DELTA_S3_ALLOW_UNSAFE_RENAME = get_from_env(
diff --git a/products/data_warehouse/backend/facade/api.py b/products/data_warehouse/backend/facade/api.py
index 58866497493a..490b3b654817 100644
--- a/products/data_warehouse/backend/facade/api.py
+++ b/products/data_warehouse/backend/facade/api.py
@@ -96,6 +96,7 @@ _LAZY = {
"ensure_bucket_exists": "s3",
"get_s3_client": "s3",
"get_size_of_folder": "s3",
+ "delta_proxy_storage_options": "s3_proxy",
}
__all__ = sorted(_LAZY)
diff --git a/products/data_warehouse/backend/s3.py b/products/data_warehouse/backend/s3.py
index 1d82e520a860..db1d3be936da 100644
--- a/products/data_warehouse/backend/s3.py
+++ b/products/data_warehouse/backend/s3.py
@@ -9,8 +9,10 @@ import boto3
import botocore
import botocore.exceptions
+from products.data_warehouse.backend.s3_proxy import boto_proxy_config_kwargs
-def get_s3_client():
+
+def get_s3_client(*, endpoint_url: Optional[str] = None):
# Defaults for localhost dev and test suites
if settings.USE_LOCAL_SETUP:
return s3fs.S3FileSystem(
@@ -23,11 +25,16 @@ def get_s3_client():
skip_instance_cache=True,
)
- return s3fs.S3FileSystem()
+ # config_kwargs reaches botocore's Config; see s3_proxy for why these clients skip the proxy, and
+ # why a caller-supplied endpoint_url keeps its traffic on it. endpoint_url is only forwarded when
+ # set: fsspec's instance cache keys on the literal kwargs, so passing endpoint_url=None explicitly
+ # would split the shared cached client into a second instance.
+ extra = {"endpoint_url": endpoint_url} if endpoint_url is not None else {}
+ return s3fs.S3FileSystem(config_kwargs=boto_proxy_config_kwargs(endpoint_url=endpoint_url), **extra)
@contextlib.asynccontextmanager
-async def aget_s3_client(*, fresh_instance: bool = False):
+async def aget_s3_client(*, fresh_instance: bool = False, endpoint_url: Optional[str] = None):
# fresh_instance=True bypasses the fsspec instance cache: a new S3FileSystem bound to the current
# event loop, closed on context exit. The cached default hands every caller the same instance
# regardless of loop, so async_to_sync-driven code (each call runs on a fresh, short-lived loop)
@@ -48,7 +55,15 @@ async def aget_s3_client(*, fresh_instance: bool = False):
asynchronous=True,
)
else:
- s3 = s3fs.S3FileSystem(asynchronous=True, skip_instance_cache=fresh_instance)
+ # endpoint_url only forwarded when set, so the shared cached client isn't split; see
+ # get_s3_client and s3_proxy for the proxy-bypass reasoning.
+ extra = {"endpoint_url": endpoint_url} if endpoint_url is not None else {}
+ s3 = s3fs.S3FileSystem(
+ asynchronous=True,
+ skip_instance_cache=fresh_instance,
+ config_kwargs=boto_proxy_config_kwargs(endpoint_url=endpoint_url),
+ **extra,
+ )
await s3.set_session()
diff --git a/products/data_warehouse/backend/s3_proxy.py b/products/data_warehouse/backend/s3_proxy.py
new file mode 100644
index 000000000000..53dc88b55214
--- /dev/null
+++ b/products/data_warehouse/backend/s3_proxy.py
@@ -0,0 +1,175 @@
+"""Scoped egress-proxy bypass for the warehouse's own S3 traffic.
+
+Where HTTP_PROXY/HTTPS_PROXY point at an egress proxy, every S3 request becomes a CONNECT tunnel:
+two tracked connections on the proxy host (client side and server side) instead of one, each held in
+the kernel's connection table for a couple of minutes after close. delta-rs speaks HTTP/1.1 only, so
+there is no multiplexing to amortize them either, and request concurrency maps 1:1 onto connections.
+A busy warehouse can therefore exhaust connection tracking on hosts it doesn't even run on. Where the
+network can already reach S3 directly, that hop buys nothing.
+
+The bypass is deliberately scoped to *this bucket's hostname*, not carved out of the process-wide
+NO_PROXY. Egress to customer-controlled destinations (source APIs, customer databases, and a
+customer-configured source that happens to point at S3) has to keep going through the proxy.
+
+That scoping is why virtual-hosted addressing is forced: delta-rs addresses S3 path-style by default
+(``s3.<region>.amazonaws.com/<bucket>``), which leaves the bucket out of the hostname, so no
+host-based rule can distinguish our traffic from anyone else's. Virtual-hosted addressing
+(``<bucket>.s3.<region>.amazonaws.com``) puts it back in.
+
+These options reach deltalite too, without it needing to know about any of this: the write path hands
+it the same dict, and ``DeltaLiteTable.open`` passes it to ``DeltaTableBuilder::with_storage_options``.
+
+The two clients need different mechanisms:
+
+- delta-rs/object_store has no per-client "ignore the proxy" switch, but reqwest stops consulting
+ the environment as soon as a proxy is set explicitly (``ClientBuilder::proxy`` clears
+ ``auto_sys_proxy``). So we hand it the same proxy the environment would have given it, plus an
+ exclusion for our bucket host.
+- botocore takes ``proxies={}`` per client, which overrides the environment directly. Those clients
+ only ever address this bucket, so no host-level exclusion is needed.
+
+Every failure mode here is fail-safe: unknown region, missing bucket, absent proxy env or a
+hostname that doesn't match what the client actually dials all leave the traffic on the proxy,
+exactly as it is today.
+"""
+
+import os
+import time
+from functools import lru_cache
+from urllib.parse import urlparse
+
+from django.conf import settings
+
+import posthoganalytics
+
+from posthog.utils import get_instance_region, get_machine_id
+
+# Read at call time rather than reconstructed: the URL can carry per-process auth that whatever
+# injected it has already expanded.
+_PROXY_ENV_VARS = ("HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy")
+_NO_PROXY_ENV_VARS = ("NO_PROXY", "no_proxy")
+
+WAREHOUSE_S3_PROXY_BYPASS_FLAG = "data-warehouse-s3-proxy-bypass"
+
+# Evaluated per process, not per team: which route a pod's S3 packets take is a property of where the
+# pod runs. The flag is keyed on the machine id so a percentage rollout ramps whole pods at a time,
+# which is also what makes a canary meaningful, because half a pod's requests taking each route would
+# tell us nothing. Re-read on this interval so the flag stays a live kill switch: storage options are
+# rebuilt constantly, but warehouse activities can run for hours, so caching for the process lifetime
+# would mean a flip only lands on the next restart.
+_FLAG_CACHE_SECONDS = 60
+
+
+def _proxy_url() -> str | None:
+ for var in _PROXY_ENV_VARS:
+ value = os.environ.get(var)
+ if value:
+ return value
+ return None
+
+
+def _no_proxy() -> str | None:
+ for var in _NO_PROXY_ENV_VARS:
+ value = os.environ.get(var)
+ if value:
+ return value
+ return None
+
+
+def warehouse_bucket_host() -> str | None:
+ """Virtual-hosted hostname for the warehouse bucket, or None when it can't be determined.
+
+ Derived from BUCKET_URL rather than DATAWAREHOUSE_BUCKET so it always names the bucket the Delta
+ tables actually live in.
+ """
+ bucket = urlparse(settings.BUCKET_URL).netloc
+ region = settings.DATA_WAREHOUSE_S3_REGION
+ if not bucket or not region:
+ return None
+ return f"{bucket}.s3.{region}.amazonaws.com"
+
+
+@lru_cache(maxsize=4)
+def _flag_enabled(_interval: int) -> bool:
+ """Evaluate the rollout flag, keyed on a time bucket so the cache expires on its own.
+
+ Any evaluation failure returns False (fail closed, as in ``is_deltalite_write_enabled``): a flags
+ -service blip leaves traffic on the proxy rather than silently rerouting it.
+ """
+ try:
+ return bool(
+ posthoganalytics.feature_enabled(
+ WAREHOUSE_S3_PROXY_BYPASS_FLAG,
+ get_machine_id(),
+ # Surfaced so release conditions can scope the flag to the warehouse workers in a
+ # given cloud region, rather than every pod that shares this project token (web,
+ # celery, and self-hosted installs all evaluate the same flag). Both values are the
+ # ones posthog/apps.py already stamps onto super_properties.
+ person_properties={
+ "region": get_instance_region() or "",
+ "service": settings.OTEL_SERVICE_NAME or "",
+ },
+ only_evaluate_locally=False,
+ send_feature_flag_events=False,
+ )
+ )
+ except Exception:
+ return False
+
+
+def _bypass_enabled() -> bool:
+ # Local dev and tests talk to MinIO/SeaweedFS over an explicit endpoint with no proxy in front.
+ if settings.USE_LOCAL_SETUP:
+ return False
+ return _flag_enabled(int(time.monotonic() // _FLAG_CACHE_SECONDS))
+
+
+def delta_proxy_storage_options() -> dict[str, str]:
+ """delta-rs storage options that keep this bucket's traffic off the egress proxy.
+
+ Empty when the bypass is off or anything it depends on is missing, so callers can merge it
+ unconditionally.
+ """
+ if not _bypass_enabled():
+ return {}
+
+ proxy_url = _proxy_url()
+ host = warehouse_bucket_host()
+ if not proxy_url or not host:
+ return {}
+
+ # Setting proxy_url explicitly stops reqwest consulting the environment, which drops the
+ # environment's own NO_PROXY along with its proxy. Fold that list back in so hosts the cluster
+ # already exempts (IMDS/link-local, in-cluster services, VPC endpoints) keep going direct exactly
+ # as they do today, rather than being forced onto the proxy. NoProxy::from_string parses a
+ # comma-separated list, CIDRs included.
+ excludes = ",".join(filter(None, [host, _no_proxy()]))
+
+ return {
+ "proxy_url": proxy_url,
+ "proxy_excludes": excludes,
+ # Two spellings of the same thing, because two libraries read these options. deltalake-aws
+ # parses AWS_S3_ADDRESSING_STYLE; object_store's own S3 builder only knows
+ # virtual_hosted_style_request. Which one applies depends on whether the AWS storage handler
+ # is registered, and deltalite (rust/deltalite, which passes this dict straight to
+ # DeltaTableBuilder) links its own delta-rs build. Setting both means the bucket ends up in
+ # the hostname either way; they agree, so neither can contradict the other.
+ "AWS_S3_ADDRESSING_STYLE": "virtual",
+ "virtual_hosted_style_request": "true",
+ }
+
+
+def boto_proxy_config_kwargs(*, endpoint_url: str | None = None) -> dict[str, object]:
+ """botocore config overrides that keep the warehouse S3 clients off the egress proxy.
+
+ Empty when the bypass is off, so callers can merge it unconditionally.
+
+ Gated on the absence of a caller-supplied endpoint_url. Without one the client can only reach
+ ``*.s3.<region>.amazonaws.com`` (bucket names can't escape the amazonaws.com zone), so dropping
+ the proxy leaves nothing for its private-IP block to catch. An endpoint_url puts the hostname
+ under the caller's control (a customer S3-compatible source could point at a private address), so
+ the bypass is withheld and that traffic keeps going through the proxy.
+ """
+ if not _bypass_enabled() or endpoint_url:
+ return {}
+ return {"proxies": {}}
diff --git a/products/data_warehouse/backend/tests/test_s3_proxy.py b/products/data_warehouse/backend/tests/test_s3_proxy.py
new file mode 100644
index 000000000000..f8ea024cdd13
--- /dev/null
+++ b/products/data_warehouse/backend/tests/test_s3_proxy.py
@@ -0,0 +1,135 @@
+import os
+
+from unittest.mock import patch
+
+from django.test import SimpleTestCase, override_settings
+
+from parameterized import parameterized
+
+from products.data_warehouse.backend import s3_proxy
+from products.data_warehouse.backend.s3_proxy import (
+ boto_proxy_config_kwargs,
+ delta_proxy_storage_options,
+ warehouse_bucket_host,
+)
+
+PROXY = "http://pod-name:[email protected]:4750/"
+PROXY_ENV_VARS = ("HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy")
+NO_PROXY_ENV_VARS = ("NO_PROXY", "no_proxy")
+
+BYPASS_ON = {
+ "USE_LOCAL_SETUP": False,
+ "BUCKET_URL": "s3://posthog-s3-datawarehouse-us-east-1/dlt",
+ "DATA_WAREHOUSE_S3_REGION": "us-east-1",
+}
+
+
+def proxy_env(url: str | None, no_proxy: str | None = None) -> dict[str, str]:
+ # Clear NO_PROXY too so the ambient env can't leak into proxy_excludes and make cases flaky.
+ env = {**dict.fromkeys(PROXY_ENV_VARS, ""), **dict.fromkeys(NO_PROXY_ENV_VARS, "")}
+ if url is not None:
+ env["HTTPS_PROXY"] = url
+ if no_proxy is not None:
+ env["NO_PROXY"] = no_proxy
+ return env
+
+
+def flag(enabled: bool):
+ return patch.object(s3_proxy.posthoganalytics, "feature_enabled", return_value=enabled)
+
+
+class TestWarehouseS3ProxyBypass(SimpleTestCase):
+ def setUp(self) -> None:
+ # The flag result is cached per time bucket, so it has to be dropped between cases.
+ s3_proxy._flag_enabled.cache_clear()
+
+ @override_settings(**BYPASS_ON)
+ def test_scopes_the_bypass_to_the_warehouse_bucket_host(self) -> None:
+ with flag(True), patch.dict(os.environ, proxy_env(PROXY)):
+ options = delta_proxy_storage_options()
+
+ assert options["proxy_excludes"] == "posthog-s3-datawarehouse-us-east-1.s3.us-east-1.amazonaws.com"
+ assert options["proxy_url"] == PROXY
+ # Without virtual-hosted addressing the bucket isn't in the hostname, so the exclusion above
+ # would have to name the shared regional endpoint, bypassing the proxy for all of S3. Both
+ # spellings are set because delta-rs and object_store read different ones.
+ assert options["AWS_S3_ADDRESSING_STYLE"] == "virtual"
+ assert options["virtual_hosted_style_request"] == "true"
+
+ @override_settings(**BYPASS_ON)
+ def test_folds_the_environments_no_proxy_into_the_exclusions(self) -> None:
+ # Setting proxy_url stops reqwest reading the env, dropping its NO_PROXY with it, so the
+ # cluster's existing exemptions (here IMDS and in-cluster services) have to be carried over
+ # or they would start transiting the proxy the moment the bypass turns on.
+ with flag(True), patch.dict(os.environ, proxy_env(PROXY, no_proxy="169.254.169.254,.svc.cluster.local")):
+ options = delta_proxy_storage_options()
+
+ assert (
+ options["proxy_excludes"]
+ == "posthog-s3-datawarehouse-us-east-1.s3.us-east-1.amazonaws.com,169.254.169.254,.svc.cluster.local"
+ )
+
+ @override_settings(**BYPASS_ON)
+ def test_bucket_host_follows_the_bucket_the_delta_tables_live_in(self) -> None:
+ with override_settings(BUCKET_URL="s3://some-other-bucket/dlt", DATA_WAREHOUSE_S3_REGION="eu-central-1"):
+ assert warehouse_bucket_host() == "some-other-bucket.s3.eu-central-1.amazonaws.com"
+
+ @parameterized.expand(
+ [
+ ("local_setup", {"USE_LOCAL_SETUP": True}, True, PROXY),
+ ("flag_off", {}, False, PROXY),
+ ("region_unknown", {"DATA_WAREHOUSE_S3_REGION": ""}, True, PROXY),
+ ("bucket_unknown", {"BUCKET_URL": ""}, True, PROXY),
+ ("no_proxy_in_environment", {}, True, None),
+ ]
+ )
+ def test_delta_options_are_empty_unless_everything_is_known(
+ self, _name: str, settings_override: dict[str, object], flag_enabled: bool, proxy_url: str | None
+ ) -> None:
+ with (
+ override_settings(**{**BYPASS_ON, **settings_override}),
+ flag(flag_enabled),
+ patch.dict(os.environ, proxy_env(proxy_url)),
+ ):
+ assert delta_proxy_storage_options() == {}
+
+ @parameterized.expand(
+ [
+ ("enabled", {}, True, {"proxies": {}}),
+ ("flag_off", {}, False, {}),
+ ("local_setup", {"USE_LOCAL_SETUP": True}, True, {}),
+ ]
+ )
+ def test_boto_clients_drop_the_proxy_only_when_the_bypass_is_on(
+ self, _name: str, settings_override: dict[str, object], flag_enabled: bool, expected: dict[str, object]
+ ) -> None:
+ with override_settings(**{**BYPASS_ON, **settings_override}), flag(flag_enabled):
+ assert boto_proxy_config_kwargs() == expected
+
+ @override_settings(**BYPASS_ON)
+ def test_boto_bypass_is_withheld_when_the_caller_supplies_an_endpoint(self) -> None:
+ # A caller-supplied endpoint puts the host under the caller's control, so the proxy must stay
+ # in front of it even with the bypass on, or a private-address S3-compatible source would be
+ # dialed direct.
+ with flag(True):
+ assert boto_proxy_config_kwargs() == {"proxies": {}}
+ assert boto_proxy_config_kwargs(endpoint_url="http://10.0.0.5/") == {}
+
+ # A flags-service outage must not reroute production traffic on its own.
+ @override_settings(**BYPASS_ON)
+ def test_flag_evaluation_failure_leaves_traffic_on_the_proxy(self) -> None:
+ with (
+ patch.object(s3_proxy.posthoganalytics, "feature_enabled", side_effect=Exception("flags down")),
+ patch.dict(os.environ, proxy_env(PROXY)),
+ ):
+ assert delta_proxy_storage_options() == {}
+
+ # The options are rebuilt on every table open; evaluating the flag each time would put a network
+ # call on that path.
+ @override_settings(**BYPASS_ON)
+ def test_flag_is_evaluated_once_per_interval_not_per_call(self) -> None:
+ with flag(True) as evaluate, patch.dict(os.environ, proxy_env(PROXY)):
+ for _ in range(5):
+ delta_proxy_storage_options()
+
+ assert evaluate.call_count == 1
diff --git a/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta_table_helper.py b/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta_table_helper.py
index 86ebcf34993d..e8e6058dd3de 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta_table_helper.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta_table_helper.py
@@ -10,7 +10,7 @@ from structlog.types import FilteringBoundLogger
from posthog.exceptions_capture import capture_exception
from posthog.sync import database_sync_to_async_pool
-from products.data_warehouse.backend.facade.api import aget_s3_client, ensure_bucket_exists
+from products.data_warehouse.backend.facade.api import aget_s3_client, delta_proxy_storage_options, ensure_bucket_exists
from products.warehouse_sources.backend.models.external_data_job import ExternalDataJob
from products.warehouse_sources.backend.temporal.data_imports.naming_convention import NamingConvention
from products.warehouse_sources.backend.temporal.data_imports.pipelines.core.arrow_utils import (
@@ -97,7 +97,7 @@ def delta_storage_options() -> dict[str, str]:
"AWS_ALLOW_HTTP": "true",
}
else:
- options = {}
+ options = dict(delta_proxy_storage_options())
# Conditional puts make a clashing concurrent commit fail loudly instead of
# clobbering _delta_log; set explicitly so a library default change can't undo it.
diff --git a/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/test/test_delta_table_helper.py b/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/test/test_delta_table_helper.py
index c542e63c1beb..631eaef98e6c 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/test/test_delta_table_helper.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/test/test_delta_table_helper.py
@@ -92,6 +92,33 @@ class TestStorageOptionsCommitSafety:
assert options["conditional_put"] == "etag"
assert ("AWS_S3_ALLOW_UNSAFE_RENAME" in options) is allow_unsafe
+ # The proxy bypass and the commit-safety options are assembled in the same dict; dropping either
+ # while editing the other is silent (S3 traffic quietly returns to the egress proxy, or commits
+ # lose conflict detection).
+ def test_proxy_bypass_options_merge_with_commit_safety(self) -> None:
+ helper = DeltaTableHelper(resource_name="t", job=MagicMock(), logger=_make_logger())
+
+ # Patch the facade seam get_storage_options calls, so this stays a merge-point test and does
+ # not reach into another product's internals. What the bypass dict itself contains is covered
+ # by products/data_warehouse/backend/tests/test_s3_proxy.py.
+ proxy_options = {
+ "proxy_url": "http://egress-proxy.test:4750",
+ "proxy_excludes": "posthog-s3-datawarehouse-us-east-1.s3.us-east-1.amazonaws.com",
+ "AWS_S3_ADDRESSING_STYLE": "virtual",
+ "virtual_hosted_style_request": "true",
+ }
+ with (
+ override_settings(USE_LOCAL_SETUP=False),
+ patch(
+ "products.warehouse_sources.backend.temporal.data_imports.pipelines.core.delta_table_helper.delta_proxy_storage_options",
+ return_value=proxy_options,
+ ),
+ ):
+ options = helper.get_storage_options()
+
+ assert options["conditional_put"] == "etag"
+ assert options["proxy_excludes"] == "posthog-s3-datawarehouse-us-east-1.s3.us-east-1.amazonaws.com"
+
class TestGetDeltaTableUnrecoverableErrors:
# (case_name, error_message, expect_heal) — heal = wipe the table and fall back to first-sync mode
diff --git a/products/warehouse_sources/backend/temporal/data_imports/pipelines/pipeline_v3/duckgres/backfill_snapshot.py b/products/warehouse_sources/backend/temporal/data_imports/pipelines/pipeline_v3/duckgres/backfill_snapshot.py
index 5e6c73071621..447d63c93ea1 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/pipelines/pipeline_v3/duckgres/backfill_snapshot.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/pipelines/pipeline_v3/duckgres/backfill_snapshot.py
@@ -16,6 +16,7 @@ from urllib.parse import unquote
from django.conf import settings
+from products.data_warehouse.backend.facade.api import delta_proxy_storage_options
from products.warehouse_sources.backend.models import ExternalDataSchema
from products.warehouse_sources.backend.temporal.data_imports.naming_convention import NamingConvention
@@ -74,8 +75,9 @@ def _delta_table_folder(schema: ExternalDataSchema) -> str:
def _delta_storage_options() -> dict[str, str]:
"""Storage options for metadata-only Delta log reads from the consumer pod.
- Prod: empty — deltalake's object_store resolves the pod's ambient AWS
- credential chain (IRSA/env) itself. Local dev: MinIO endpoint + keys.
+ Production credentials come from the pod's ambient AWS chain (IRSA/env), which
+ deltalake's object_store resolves itself. The only production option is the scoped
+ proxy bypass for the warehouse bucket. Local development uses MinIO endpoint and keys.
(products.managed_warehouse.backend.storage.get_deltalake_storage_options is NOT usable
here: it requires DuckLake RDS env that consumer pods do not carry.)
"""
@@ -87,7 +89,7 @@ def _delta_storage_options() -> dict[str, str]:
"AWS_ALLOW_HTTP": "true",
"AWS_REGION": "us-east-1",
}
- return {}
+ return dict(delta_proxy_storage_options())
def resolve_snapshot_chunks(schema: ExternalDataSchema, version: int | None = None) -> tuple[int, list[BackfillChunk]]: