AWS Training
Modules Listen Certification

← SageMaker Unified Studio Foundations — The AWS Homework

Starts this lesson and continues through 14 more to the end of the course.

The Terraform module for a multi-team domain

Why this one gets read line by line

H2 is the only homework document you can run. One terraform apply creates a domain, IAM roles, up to sixteen enabled blueprints, three project profiles and a project. It is eight days old; the code was last released in August. The blog describes the module; the tag is what runs. Where they differ, the tag wins.

H2 is the 11 Nov 2026 blog; "the repo" is aws-ia/terraform-aws-sagemaker-unified-studio. Repo citations are files fetched from main (verified 2026-11-19). I read the code; I did not run it. Concepts (blueprint, profile, ON_CREATE) are in lesson 3; the roles are in lesson 2.

What H2 builds

One domain, three teams, "three purpose-built project profiles, one for each team, on a shared domain, plus an initial project" (H2, intro).

Team (H2) Profile Toggle
Data Analytics SQL Analytics enable_sql_analytics
Machine Learning All Capabilities enable_all_capabilities
Generative AI Generative AI enable_generative_ai

"Team isolation is achieved by assigning users or groups to projects created from the appropriate project profile" (H2). Isolation is project membership, not separate domains.

H2's Figure 1 shows one account: a Domain feeding "Default Blueprints", a Project Profile, a Project with "Auto-Created Environments", IAM and Identity Center principals pointing at the Project, and an IAM box holding five roles: Service, Domain Execution, Manage Access, Provisioning, Query Execution.

The repo, as of today

Fact Value Source (verified 2026-11-19)
Registry address aws-ia/sagemaker-unified-studio/aws Registry API
Latest version 0.2.1, published 2026-08-17; earlier 0.1.0, 0.2.0 (both 2026-07-02) Registry API; releases
Registry verified flag false; 6,132 downloads Registry API
main vs tag Last commit on main is the v0.2.1 merge, 2026-08-17. examples/quick-setup/main.tf is byte-identical on main and v0.2.1 commits API; cmp of both raw files
License Apache-2.0 repo API
Terraform >= 1.7 (H2 says the same) versions.tf
Providers hashicorp/aws >= 6.51.0, hashicorp/awscc >= 1.89.0, random >= 3.8.1, time >= 0.13.1 versions.tf
Newest providers aws 6.73.0, awscc 1.110.0, both published 2026-11-11 aws, awscc

"Dual provider: Uses both the AWS provider and AWS Cloud Control (AWSCC) provider" (H2). In the code the domain and blueprint configuration use aws_datazone_domain and aws_datazone_environment_blueprint_configuration; profiles, projects, memberships and policy grants use awscc_datazone_project_profile, awscc_datazone_project, awscc_datazone_project_membership and awscc_datazone_policy_grant.

Our read: the constraints are lower bounds, the module is pre-1.0, and H2's snippets give source with no version. Pin the module and both providers.

⚠️ The root README says: "The most tested deployment path is the quick-setup example" (README).

The four layers — and the two H2 does not count

Layer (H2) Module source What it does in code API underneath
1. Domain root module V2 domain, Tooling blueprint, roles, S3 bucket, model governance project CreateDomain with domainVersion V2
2. Blueprint //modules/blueprint, one call per blueprint via for_each Enables one blueprint; grants CREATE_ENVIRONMENT_FROM_BLUEPRINT on the root domain unit by default aws datazone put-environment-blueprint-configuration
3. Project profile //modules/project-profile One profile per call. Tooling is added automatically, first (deployment_order = 0) aws datazone create-project-profile
4. Project + membership //modules/project, //modules/project-membership One project; one membership per principal aws datazone create-project-membership
not counted //modules/policy-grant-create-project Grants CREATE_PROJECT_FROM_PROJECT_PROFILE; quick-setup sets all_users = true aws datazone add-policy-grant
not counted //modules/blueprint-bootstrap Creates the Provisioning and Manage Access roles; the root module calls it IAM

(CLI names verified in the CLI reference, 2026-11-19.) H2 never mentions two more sub-modules: default-project-profile (enables ToolingLite, S3Bucket, S3TableCatalog for bring-your-own-role projects) and domain-management-portal (a singleton ADMIN project), or the second example, examples/domain-management-and-bring-your-own-role.

The root module requires only vpc_id and subnet_ids. Role creation is a "3-tier resolution: user-provided ARN → pre-existing role discovered in AWS → Terraform-managed role" (README).

What terraform apply creates in the domain layer

⚠️ Roles: H2 contradicts itself and the code. H2 Step 3 says "Three IAM roles will be created (domain execution, manage access, provisioning)". H2's own Figure 1 draws five. The code creates five (main.tf, bootstrap main.tf):

Role name in code Managed policy attached
AmazonSageMakerDomainExecution<8-char suffix> SageMakerStudioDomainExecutionRolePolicy
AmazonSageMakerDomainService<suffix> SageMakerStudioDomainServiceRolePolicy
AmazonSageMakerQueryExecution<suffix> SageMakerStudioQueryExecutionRolePolicy
AmazonSageMakerProvisioning-<account_id>-<domain_id> SageMakerStudioProjectProvisioningRolePolicy
AmazonSageMakerManageAccess-<region>-<domain_id> AmazonDataZoneSageMakerManageAccessRolePolicy, AmazonDataZoneGlueManageAccessRolePolicy, AmazonDataZoneRedshiftManageAccessRolePolicy, plus a custom Redshift secret policy

All trust datazone.amazonaws.com. Manage Access is the role that grants on Glue and Redshift data — see SM0 lesson 5.

Bucket. sagemaker-studio-<account_id>-<region>-<suffix>, public access blocked, AES256 or aws:kms if kms_key_identifier is set. ⚠️ H1's clean-up names amazon-datazone-AWSACCOUNTID-AWSREGION-DOMAINID; do not search for that pattern after a Terraform deploy.

⚠️ kms_key_identifier is a root-module input; the quick-setup example neither declares nor passes it.

Model governance project. "The domain module automatically provisions a model governance project … Members of the project can enable or disable specific models accessible in the domain" (H2). The code creates a profile named Generative AI model governance and a project named GenerativeAIModelGovernanceProject, with no condition. ⚠️ The README calls these "(optional)" and the quick-setup README describes them as "Bedrock model management and consumption roles"; neither matches main.tf, which creates no such roles. The admin guide uses the same project name and says models "are published to the domain as model assets through the GenerativeAIModelGovernanceProject project" (Amazon Bedrock, verified 2026-11-19).

Every quick-setup variable

From examples/quick-setup/variables.tf. Eighteen, none required.

Variable Default Note
aws_region us-east-1 Validated against 15 Regions — the same 15 as the supported Regions page today
domain_name, domain_description terraform-quick-setup-domain, fixed string Name: 1–64 chars, alphanumeric and hyphens
vpc_id, subnet_ids null null = default VPC and all its subnets
s3_bucket_name null null = create one
user_role_policy_arns null Root default is SageMakerStudioProjectUserRolePolicy
enable_generative_ai, enable_sql_analytics, enable_all_capabilities true See next table
project_name, project_description terraform-quick-setup-project, fixed string A 6-hex-character suffix is appended to the name
enable_sso false The one-way door, below
project_owners, project_contributors {} Objects with sso_users, sso_groups, iam_users, iam_roles
environment test Only dev, staging, prod, test
owner, tags terraform-quick-setup, {} Tags only

⚠️ terraform.tfvars.example is not the defaults. It sets aws_region = "us-west-2", enable_all_capabilities = false and enable_sso = true. H2 Step 2 says copy it and edit.

⚠️ H2's tfvars has a variable the tag does not declare. H2 shows a top-level sso_users = ["admin@example.com"]. variables.tf at v0.2.1 has no sso_users. H2's Layer 4 snippet also has depends_on on aws_datazone_user_profile.sso_users, aws_datazone_user_profile.iam_users and awscc_datazone_group_profile.sso_groups; those resources are not in the quick-setup example (they are in the bring-your-own-role example). PR #42, merged 2026-08-11, removed them: "Adding a user to a project automatically adds the user to the domain." H2's snippets appear to come from different code than the published tag.

⚠️ Network auto-discovery is in the example, not the module, and it picks the default VPC, which "comes with a public subnet in each Availability Zone" (VPC guide). The admin guide asks for "at least 3 subnets in different Availability Zones" and says "Private subnets are recommended, not all functionality is available when selecting public subnets" (SQL analytics, verified 2026-11-19). The module validates only "At least one subnet ID required".

Toggle → blueprints

H2's table, corrected against examples/quick-setup/main.tf:

Toggle Blueprints enabled (exact blueprint_name) Profile created (exact name)
enable_generative_ai AmazonBedrockChatAgent, AmazonBedrockEvaluation, AmazonBedrockFlow, AmazonBedrockFunction, AmazonBedrockGuardrail, AmazonBedrockKnowledgeBase, AmazonBedrockPrompt Generative AI application development
enable_sql_analytics DataLake, LakehouseCatalog, RedshiftServerless, QuickSight SQL analytics
enable_all_capabilities All eleven above + EmrServerless, EmrOnEc2, MLExperiments, Workflows All capabilities

Four deltas from H2:

What deploys on create. In both the SQL analytics and All capabilities profiles, two configurations are ON_CREATE: DataLake (glueDbName = glue_db, editable) and RedshiftServerless (redshiftDbName = dev, connectToRMSCatalog = true, redshiftMaxCapacity = 512, the last two not editable). Everything else — Workflows (environmentClass = mw1.micro), MLExperiments (mlflowTrackingServerSize = Small), both EMR on EC2 variants (emr-7.5.0), EMR Serverless, the RMS catalog, a second Redshift workgroup, Quick Sight, all Bedrock — is ON_DEMAND. The Generative AI profile is entirely ON_DEMAND.

⚠️ H2's override snippet omits the required blueprint attribute and uses the key "RedshiftServerless", which exists only in the All capabilities local; in the SQL analytics local the key is "Redshift Serverless". Its value = "1024": the Redshift guide says base capacity above 512 RPUs is available only in listed Regions (capacity).

The initial project uses "the first available profile", in the order All capabilities, SQL analytics, Generative AI. Our read, from the code plus H1's definition of on create: unless only Generative AI is enabled, the first apply itself provisions a Glue database and a Redshift Serverless workgroup. H2's "minimal ongoing costs" covers the domain, roles and bucket only.

Outputs

Twenty-one in the example. H2 uses eight: domain_url, project_url, blueprint_ids, project_profile_ids, domain_execution_role_arn, manage_access_role_arn, provisioning_role_arn, s3_bucket_name. Also useful: domain_id, domain_root_unit_id, domain_service_role_arn, tooling_blueprint_id, blueprint_names, project_id.

project_profile_ids is a list in the fixed order All capabilities, SQL analytics, Generative AI. project_url is built as https://<domain_id>.datazone.<region>.on.aws/projects/<project_id>; domain_url is the provider's portal_url, which H2's Figure 3 shows as https://dzd-….sagemaker.us-west-2.on.aws. ⚠️ Two host patterns; I could not verify both resolve — check after a sandbox apply.

Membership: four principal types

"SSO users", "SSO groups", "IAM users", "IAM roles" (H2). The module maps sso_users and iam_users to member.user_identifier, and sso_groups and iam_roles to member.group_identifier (membership main.tf). That matches the admin guide: "When an IAM role is added to the domain, a group profile is created" (user management, verified 2026-11-19).

Rule Detail Source
Designations used PROJECT_OWNER, PROJECT_CONTRIBUTOR module; the API also lists PROJECT_CATALOG_VIEWER, PROJECT_CATALOG_CONSUMER, PROJECT_CATALOG_STEWARD, USER_CREATED_DESIGNATION
Same principal in both sets "ownership wins" membership README
Changing a designation Destroy then create: "memberships have no update API" membership README
Validation sso_groups must be an identity store group UUID; IAM ARNs must be under the matching key variables.tf
Limit "a maximum of 100 user profiles and 20 group profiles" per project user guide
Caller "The AWS caller identity that runs this Terraform code is added as a project owner" H2; no explicit resource in the code

IAM roles and SSO groups share the limit of 20. ⚠️ H2's use-case table labels arn:aws:iam::123456789012:user/etl-service-account as an "IAM Role"; the module would reject a user ARN under iam_roles. ⚠️ The membership README still says SSO users "must already have a DataZone user profile"; main.tf at v0.2.1 has no such check (PR #42).

SageMakerStudioUserIAMConsolePolicy. IAM roles and users "must have the AWS managed SageMakerStudioUserIAMConsolePolicy (or equivalent) attached to access the Amazon SageMaker Unified Studio interface … The module doesn't automatically attach this policy" (H2). ARN arn:aws:iam::aws:policy/SageMakerStudioUserIAMConsolePolicy, version v10; it allows, among others, datazone:GetIamPortalLoginUrl, datazone:CreateProject and datazone:DeleteProject (policy reference, verified 2026-11-19). ⚠️ H1 says "you can't use IAM roles to log in"; H2 and the current user guide say an "IAM user or role can sign into Amazon SageMaker Unified Studio". H1 is out of date.

The one-way door. enable_sso = true sets single_sign_on to type = "IAM_IDC", user_assignment = "AUTOMATIC", using "the default IAM IDC instance that is enabled for the account within the same region as the domain"; false sets DISABLED. H2: "This is a one way door decision. If you change this later on the domain and all dependent resources need to be destroyed and recreated." The console procedure agrees — "These settings cannot be changed once you save them" (Identity Center-based domains). ⚠️ The UpdateDomain request body does list singleSignOn, and the console page lets you configure SSO on "an existing" domain. I could not verify which transitions are really blocked. Treat both directions as destroy-and-recreate until AWS says otherwise.

Same-account limitation. "Currently, only IAM principals within the same AWS account as the domain can access the Amazon SageMaker Unified Studio portal. Cross-account IAM role access might be limited" (H2).

Environments, cost, clean-up

Stages. H2: "deploy separate domains for development, staging, and production using Terraform workspaces or separate state files". ⚠️ H3 separates stages by account. The module cannot do that yet: issue #40, "FEAT: Multi-Account Support", is open, and an add_cross_account branch sits 124 commits behind main. H2's conclusion nonetheless says you can add "accounts by extending the same Terraform configuration". ⚠️ "Only one IAM-based domain is available per AWS Account"; I could not verify whether a module domain with enable_sso = false counts as one — check domains.

Cost (H2). Redshift Serverless "per RPU-hour when queries are running"; EMR Serverless "per vCPU and memory per second"; Bedrock "per input and output token"; S3 standard storage. H2 quotes no prices; see lesson 6.

Clean-up. Empty the bucket, then destroy:

terraform output s3_bucket_name
aws s3 rm s3://BUCKET_NAME --recursive
terraform destroy

"The bucket has force_destroy disabled intentionally"; skip the first step and "the destroy will fail on the S3 bucket resource" (README). H2's warning: "This deletes all resources including the domain, projects, and any data stored in the S3 bucket. Additionally, extra resources created manually within the console won't be affected by this terraform destroy." The admin guide adds that deleting a domain "is final" and "Subscription grants will NOT be removed" (delete domains).

What the repo says that H2 does not

Evidence for an issue or support case: module and provider versions, terraform version, Region, domain_id, the failing resource address, the full error text.

Questions you should be able to answer as the SME

  1. What are the four layers? Domain, blueprint, project profile, project plus membership (H2).
  2. Which providers and versions? hashicorp/aws >= 6.51.0 and hashicorp/awscc >= 1.89.0, Terraform >= 1.7 (versions.tf).
  3. How many IAM roles does the domain layer create? Five in code; H2's text says three (main.tf).
  4. Which blueprints does enable_sql_analytics enable? DataLake, LakehouseCatalog, RedshiftServerless, and in the tag also QuickSight (quick-setup main.tf).
  5. Which profile does the initial project use? The first enabled of All capabilities, SQL analytics, Generative AI (quick-setup main.tf).
  6. What deploys when a SQL analytics project is created? Tooling, a Glue database and a Redshift Serverless workgroup (quick-setup main.tf).
  7. Which principal types are groups? Of SSO users, SSO groups, IAM users and IAM roles: SSO groups and IAM roles go to group_identifier (membership main.tf).
  8. What must an IAM role have to open the portal? SageMakerStudioUserIAMConsolePolicy or equivalent; the module does not attach it (H2).
  9. What is irreversible? enable_sso: changing it means destroying the domain and its dependents (H2, Step 2).
  10. Can a cross-account role use the portal? Not "currently": same-account principals only (H2).
  11. What is the model governance project? GenerativeAIModelGovernanceProject; its members enable or disable models for the domain (H2; main.tf).
  12. What must you do before terraform destroy? Empty the tooling bucket; force_destroy is off (README).

What to ask AWS next

  1. "Which module version produced the blog's snippets and Figure 3?" H2 uses a sso_users variable and profile resources that v0.2.1 does not have, and Figure 3 lacks quicksight.
  2. "Is enabling SSO later truly destroy-and-recreate?" H2 says yes; UpdateDomain accepts singleSignOn.
  3. "Is a domain created with enable_sso = false an IAM-based domain, limited to one per account?" It decides whether dev and prod domains can share an account.
  4. "When does multi-account support land?" Issue #40 is open; H3 assumes separate accounts.
  5. "What happens to the QuickSight blueprint when our Quick Sight account is not on Identity Center?" The tag enables it unconditionally.

Check yourself

  1. H2 says three IAM roles. Why do you tell your security reviewer five?
  2. You copy terraform.tfvars.example unchanged. Which profiles are created, and from which is the project built?
  3. A colleague adds a deploy role under iam_users. What happens, and why does the module care?
  4. You want Redshift capped lower than 512 for SQL analytics projects. Which key do you edit?
  5. terraform destroy fails. What is the most likely cause?
Answers
  1. Root main.tf creates domain execution, domain service and query execution; the bootstrap sub-module adds provisioning and manage access. H2's Figure 1 draws all five.
  2. SQL analytics and Generative AI — the file sets enable_all_capabilities = false. The project takes the first available profile, so SQL analytics.
  3. Validation fails: a role ARN is rejected under iam_users. Users map to user_identifier, roles to group_identifier, because the service gives a role a group profile.
  4. redshiftMaxCapacity under the "Redshift Serverless" key in sql_analytics_blueprint_config, keeping the blueprint = "RedshiftServerless" attribute. H2's snippet shows the All capabilities key and omits blueprint.
  5. The tooling bucket is not empty; force_destroy is disabled. Empty it and re-run.

Teaching this section

← PreviousBlueprints, project profiles, projects and authorizationNext →The Guidance — multi-account AIOps, and what the sample code really builds