# SageMaker Unified Studio Quick-Setup Example This example aims to closely mirror the [AWS Console quick-setup experience](https://docs.aws.amazon.com/sagemaker-unified-studio/latest/userguide/quick-setup.html) for Amazon SageMaker Unified Studio as closely as possible using Terraform resources. ## What This Example Deploys ### Root Module (Domain) - A SageMaker Unified Studio **domain** with the **Tooling blueprint** enabled - All required **IAM roles** (domain execution, manage access, provisioning) - **Model governance resources** (Bedrock model management and consumption roles) - An **S3 bucket** for tooling environment storage ### Blueprint Module - Enables the necessary **environment blueprints** based on which capabilities are toggled on (e.g. LakehouseCatalog, MLExperiments, RedshiftServerless, Bedrock blueprints, and more) ### Project Profile Module - Creates the three default **project profiles** that mirror the console quick-setup: - **SQL Analytics** — Analyze data in SageMaker Lakehouse using SQL - **Generative AI Application Development** — Build generative AI applications powered by Amazon Bedrock - **All Capabilities** — Full suite including analytics, ML, and generative AI ### Project Module - Deploys a basic **project** using the first available project profile from the ones created above ### Policy Grant Module - Creates a `CREATE_PROJECT_FROM_PROJECT_PROFILE` **policy grant** so users can create projects from the enabled project profiles. In this quick-setup, the grants are scoped to all users in the domain ### Project Membership Module - Wires up **project memberships** from the `project_owners` and `project_contributors` variables. Each principal set accepts any combination of SSO users, SSO groups, IAM users, and IAM roles. Owners are granted `PROJECT_OWNER`, contributors `PROJECT_CONTRIBUTOR`. ## Prerequisites 1. **AWS CLI** configured with appropriate permissions 2. **Terraform** >= 1.7 installed 3. **AWS Account** with SageMaker Unified Studio available in your region ## Quick Start 1. Review and update `terraform.tfvars` with your desired configuration (domain name, region, tags, etc.) 2. Initialize and apply: ```bash terraform init terraform apply ``` By default all three project profiles (SQL Analytics, Generative AI, All Capabilities) are enabled. You can toggle them individually via the `enable_sql_analytics`, `enable_generative_ai`, and `enable_all_capabilities` variables. ## Using the Sub-Modules Independently This example is intended as a reference implementation. For production use cases, consume the individual sub-modules directly and compose them to fit your needs: | Module | Path | Purpose | |---|---|---| | Domain (root) | `../..` | Domain, Tooling blueprint, IAM roles, S3 bucket, model governance | | Blueprint | `../../modules/blueprint` | Enable a single environment blueprint on a domain | | Project Profile | `../../modules/project-profile` | Compose blueprints into a deployable project profile | | Project | `../../modules/project` | Create a project from a project profile | | Policy Grant (create project) | `../../modules/policy-grant-create-project` | Grant `CREATE_PROJECT_FROM_PROJECT_PROFILE` on project profiles | | Project Membership | `../../modules/project-membership` | Add an owner or contributor member to a project | For example, if you only need SQL Analytics you can invoke the domain module, enable just the relevant blueprints, and create a single project profile — no need to deploy the full quick-setup. ## Known Issues ### Policy-grant error on subsequent `terraform apply` The `awscc_datazone_policy_grant` resource has a known issue where updating a policy grant that shares the same domain unit and principal as an existing grant will successfully replace the policy content but then return an `AlreadyExists` error. One policy grant is used to grant access to multiple project profiles. We are actively working with the service team to resolve this behavior. **Workaround**: Remove any existing CREATE\_PROJECT\_FROM\_PROJECT\_PROFILE policy grants that share the same domain unit and principal before running the `policy-grant-create-project` module. You can do this via the AWS Console or CLI: ```bash aws datazone delete-policy-grant \ --domain-identifier \ --entity-type DOMAIN_UNIT \ --entity-identifier \ --policy-type CREATE_PROJECT_FROM_PROJECT_PROFILE \ --principal ``` Then re-run `terraform apply` to recreate the grants cleanly. ## Requirements | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.7 | | [aws](#requirement\_aws) | >= 6.51.0 | | [awscc](#requirement\_awscc) | >= 1.89.0 | | [random](#requirement\_random) | >= 3.8.1 | | [time](#requirement\_time) | >= 0.13.1 | ## Providers | Name | Version | |------|---------| | [aws](#provider\_aws) | >= 6.51.0 | | [random](#provider\_random) | >= 3.8.1 | ## Modules | Name | Source | Version | |------|--------|---------| | [all\_capabilities\_project\_profile](#module\_all\_capabilities\_project\_profile) | ../../modules/project-profile | n/a | | [blueprints](#module\_blueprints) | ../../modules/blueprint | n/a | | [create\_project\_from\_project\_profile\_grant](#module\_create\_project\_from\_project\_profile\_grant) | ../../modules/policy-grant-create-project | n/a | | [domain](#module\_domain) | ../.. | n/a | | [generative\_ai\_project\_profile](#module\_generative\_ai\_project\_profile) | ../../modules/project-profile | n/a | | [project](#module\_project) | ../../modules/project | n/a | | [project\_membership](#module\_project\_membership) | ../../modules/project-membership | n/a | | [sql\_analytics\_project\_profile](#module\_sql\_analytics\_project\_profile) | ../../modules/project-profile | n/a | ## Resources | Name | Type | |------|------| | [random_id.project_suffix](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/id) | resource | | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | | [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source | | [aws_subnets.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnets) | data source | | [aws_vpc.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | data source | ## Inputs | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | [aws\_region](#input\_aws\_region) | AWS region where the domain will be created | `string` | `"us-east-1"` | no | | [domain\_description](#input\_domain\_description) | Description of the SageMaker Unified Studio domain | `string` | `"SageMaker Unified Studio domain with modular blueprint and profile setup"` | no | | [domain\_name](#input\_domain\_name) | Name of the SageMaker Unified Studio domain | `string` | `"terraform-quick-setup-domain"` | no | | [enable\_all\_capabilities](#input\_enable\_all\_capabilities) | Enable the All capabilities default project profile. Enabling this will create the project profile and enable the selected blueprints. | `bool` | `true` | no | | [enable\_generative\_ai](#input\_enable\_generative\_ai) | Enable the Generative AI application development default project profile. Enabling this will create the project profile and enable the selected blueprints. | `bool` | `true` | no | | [enable\_sql\_analytics](#input\_enable\_sql\_analytics) | Enable the SQL analytics default project profile. Enabling this will create the project profile and enable the selected blueprints. | `bool` | `true` | no | | [enable\_sso](#input\_enable\_sso) | Enable single sign on (SSO) using the default IAM Identity Center instance for the region | `bool` | `false` | no | | [environment](#input\_environment) | Environment name (e.g., dev, staging, prod) | `string` | `"test"` | no | | [owner](#input\_owner) | Owner of the domain (for tagging purposes) | `string` | `"terraform-quick-setup"` | no | | [project\_contributors](#input\_project\_contributors) | Principals to add to the created project as PROJECT\_CONTRIBUTOR. |
object({
sso_users = optional(list(string), [])
sso_groups = optional(list(string), [])
iam_users = optional(list(string), [])
iam_roles = optional(list(string), [])
})
| `{}` | no | | [project\_description](#input\_project\_description) | Description of the project | `string` | `"Quick-setup project created with Terraform for SageMaker Unified Studio"` | no | | [project\_name](#input\_project\_name) | Name of the project to create | `string` | `"terraform-quick-setup-project"` | no | | [project\_owners](#input\_project\_owners) | Principals to add to the created project as PROJECT\_OWNER. |
object({
sso_users = optional(list(string), [])
sso_groups = optional(list(string), [])
iam_users = optional(list(string), [])
iam_roles = optional(list(string), [])
})
| `{}` | no | | [s3\_bucket\_name](#input\_s3\_bucket\_name) | Existing S3 bucket name for Tooling blueprint storage. If null, a dedicated bucket is created by the domain module. | `string` | `null` | no | | [subnet\_ids](#input\_subnet\_ids) | Subnet IDs for blueprint regional parameters. If null, subnets from the default VPC are used. | `list(string)` | `null` | no | | [tags](#input\_tags) | Additional tags to apply to all resources | `map(string)` | `{}` | no | | [user\_role\_policy\_arns](#input\_user\_role\_policy\_arns) | List of IAM policy ARNs to apply as user role policies on the Tooling blueprint | `list(string)` | `null` | no | | [vpc\_id](#input\_vpc\_id) | VPC ID for blueprint regional parameters. If null, the default VPC is used. | `string` | `null` | no | ## Outputs | Name | Description | |------|-------------| | [account\_id](#output\_account\_id) | AWS account ID where resources are created | | [blueprint\_ids](#output\_blueprint\_ids) | Map of blueprint logical names to their resolved blueprint IDs | | [blueprint\_names](#output\_blueprint\_names) | Map of blueprint logical names to their blueprint names | | [domain\_arn](#output\_domain\_arn) | ARN of the created SageMaker Unified Studio domain | | [domain\_execution\_role\_arn](#output\_domain\_execution\_role\_arn) | ARN of the domain execution role | | [domain\_id](#output\_domain\_id) | ID of the created SageMaker Unified Studio domain | | [domain\_name](#output\_domain\_name) | Name of the created SageMaker Unified Studio domain | | [domain\_root\_unit\_id](#output\_domain\_root\_unit\_id) | Root domain unit ID of the domain | | [domain\_service\_role\_arn](#output\_domain\_service\_role\_arn) | ARN of the domain service role | | [domain\_url](#output\_domain\_url) | Portal URL for accessing the SageMaker Unified Studio domain | | [manage\_access\_role\_arn](#output\_manage\_access\_role\_arn) | ARN of the manage access role (from domain module) | | [project\_id](#output\_project\_id) | ID of the created project | | [project\_name](#output\_project\_name) | Name of the created project | | [project\_profile\_ids](#output\_project\_profile\_ids) | List of all enabled project profile IDs | | [project\_url](#output\_project\_url) | URL to access the project in SageMaker Unified Studio | | [provisioning\_role\_arn](#output\_provisioning\_role\_arn) | ARN of the provisioning role (from domain module) | | [region](#output\_region) | AWS region where resources are created | | [s3\_bucket\_name](#output\_s3\_bucket\_name) | S3 bucket name used by the domain | | [subnet\_ids](#output\_subnet\_ids) | Subnet IDs used for blueprint configurations | | [tooling\_blueprint\_id](#output\_tooling\_blueprint\_id) | ID of the Tooling blueprint (created by the domain module) | | [vpc\_id](#output\_vpc\_id) | VPC ID used for blueprint configurations |