如何通过AWS CLI或Terraform启用SageMaker域的Projects与JumpStart?
通过AWS CLI/Terraform配置SageMaker域的Projects和JumpStart设置
一、AWS CLI 实现方式
使用update-domain命令修改SageMaker域的Studio设置,核心是指定UserSettings内的SageMakerProjectSettings和JumpStartSettings参数:
启用双功能的命令示例
aws sagemaker update-domain \ --domain-id <你的域ID> \ --user-settings '{ "SageMakerProjectSettings": { "Enabled": true, "ProjectTemplateSettings": { "ProjectTemplates": [ { "TemplateArn": "arn:aws:sagemaker:<区域>:aws:project-template/eks-sagemaker-kubeflow-pipelines" }, { "TemplateArn": "arn:aws:sagemaker:<区域>:aws:project-template/sagemaker-model-building-pipeline" } ] } }, "JumpStartSettings": { "Enabled": true } }'
- 替换
<你的域ID>和<区域>为实际值 - 仅需启用单一功能时,保留对应配置块即可
二、Terraform 实现方式
使用AWS Provider的aws_sagemaker_domain资源,在user_settings块中配置对应参数:
示例配置代码
resource "aws_sagemaker_domain" "example" { domain_name = "your-domain-name" auth_mode = "IAM" vpc_id = aws_vpc.example.id subnet_ids = [aws_subnet.example.id] user_settings { sagemaker_project_settings { enabled = true project_template_settings { project_templates { template_arn = "arn:aws:sagemaker:us-east-1:aws:project-template/sagemaker-model-building-pipeline" } project_templates { template_arn = "arn:aws:sagemaker:us-east-1:aws:project-template/eks-sagemaker-kubeflow-pipelines" } } } jump_start_settings { enabled = true } } }
- 按需调整区域、VPC/子网等基础配置
- 无需特定项目模板时,可省略
project_template_settings块
三、控制台启用时的后台操作细节
在控制台开启这些选项时,AWS会自动完成以下操作:
- IAM角色配置:自动创建
AmazonSageMakerServiceCatalogProductsLaunchRole角色,附加AmazonSageMakerServiceCatalogProductsLaunchRolePolicy托管策略,用于SageMaker Projects启动Service Catalog产品;同时为域执行角色附加访问JumpStart模型、项目模板的必要权限 - Service Catalog配置:为你的账户启用SageMaker项目对应的官方Service Catalog产品组合,包含模型构建流水线、Kubeflow流水线等模板
- 域设置更新:修改SageMaker域底层配置,开启Studio界面中Projects和JumpStart的功能入口
- 权限同步:确保域内用户的IAM权限与启用功能匹配,允许用户执行创建项目、调用JumpStart API等操作
内容的提问来源于stack exchange,提问作者RubenLaguna
相关产品推荐
相关产品推荐

