Skip to content

Commit 1b034ea

Browse files
committed
feat: Add region validation for cross-region deployment
1 parent 4eaf5d9 commit 1b034ea

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

  • modules/sagemaker/sagemaker-templates/templates/model_deploy/seed_code/deploy_app

modules/sagemaker/sagemaker-templates/templates/model_deploy/seed_code/deploy_app/app.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@
55
from deploy_app.pipeline_stack import PipelineStack
66

77
app = cdk.App()
8+
9+
# All deployment regions must match - cross-region endpoint deployment is not supported
10+
# because model packages contain region-specific container image URIs
11+
regions = {
12+
"dev": constants.DEV_REGION,
13+
"pre-prod": constants.PRE_PROD_REGION,
14+
"prod": constants.PROD_REGION,
15+
}
16+
mismatched = {k: v for k, v in regions.items() if v != constants.DEV_REGION}
17+
if mismatched:
18+
raise ValueError(f"All deployment regions must match dev region ({constants.DEV_REGION}). Mismatched: {mismatched}")
19+
820
PipelineStack(
921
app,
1022
f"{constants.PROJECT_NAME}-pipeline",

0 commit comments

Comments
 (0)