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.

fix(batch-imports): use ambient region for the hop-1 STS assume in role chaining (#75712)

Nick Best1932f5206be6
diff --git a/rust/batch-import-worker/src/job/config.rs b/rust/batch-import-worker/src/job/config.rs
index 349c9c87c09c..a0553a27756e 100644
--- a/rust/batch-import-worker/src/job/config.rs
+++ b/rust/batch-import-worker/src/job/config.rs
@@ -563,9 +563,15 @@ impl S3SourceConfig {
)));
};
+ // This hop must use the pod's ambient region, not the customer bucket's: the
+ // managed-migrations role's trust policy only allows assumes arriving through the
+ // workload VPC's STS endpoint (aws:SourceVpce), and that endpoint only serves the
+ // local region's STS hostname. Calling a cross-region STS endpoint here would
+ // egress publicly and be denied. The customer hop below keeps the bucket region.
+ let ambient_config = aws_config::defaults(BehaviorVersion::latest()).load().await;
let intermediate = aws_config::sts::AssumeRoleProvider::builder(intermediate_arn)
.session_name("posthog-batch-import")
- .region(Region::new(self.region.clone()))
+ .configure(&ambient_config)
.build()
.await;
// An unassumable intermediate role is a PostHog deployment problem, so surface the