

# Set up catalog

Before users can find and use AI assets in the catalog, an administrator must turn on cataloging for the AWS account. For instructions, see [Turn on cataloging](#catalog-assets-set-up-turn-on). After you turn it on, Amazon SageMaker AI registers existing and new AI assets to the AWS Glue Data Catalog for the account. You turn on cataloging once for each AWS account.

To set up the catalog, complete the following tasks:

1. Complete the [Prerequisites](#catalog-assets-set-up-prereqs).

1. [Turn on cataloging](#catalog-assets-set-up-turn-on).

1. [Grant users access to the catalog](#catalog-assets-set-up-permissions).

1. (Optional) [Configure encryption](#catalog-assets-set-up-encryption).

1. (Optional) Add business context with [Glossary terms](catalog-assets-business-metadata.md#catalog-assets-business-metadata-glossary) and [Metadata forms](catalog-assets-business-metadata.md#catalog-assets-business-metadata-forms).

## Prerequisites
<a name="catalog-assets-set-up-prereqs"></a>

Before you begin, make sure that you have the following:
+ An AWS account in a Region where cataloging is available. For more information, see [Supported Regions and quotas](https://docs.aws.amazon.com/sagemaker/latest/dg/regions-quotas.html).
+ An IAM principal that you can use to configure catalog permissions. For the required permissions, see [Setting up IAM permissions for AWS Glue](https://docs.aws.amazon.com/glue/latest/dg/set-up-iam.html).
+ An Amazon SageMaker AI domain to use the catalog in Amazon SageMaker AI Studio. For more information, see [Domain overview](https://docs.aws.amazon.com/sagemaker/latest/dg/gs-studio-onboard.html).

## Turn on cataloging
<a name="catalog-assets-set-up-turn-on"></a>

You can turn on cataloging in the AWS Glue console. For more information, see [Automatic asset discovery in AWS Glue](https://docs.aws.amazon.com/glue/latest/dg/catalog-and-crawler.html).

### Console
<a name="catalog-assets-set-up-turn-on-console"></a>

1. Open the [AWS Glue console](https://console.aws.amazon.com/glue/).

1. In the navigation pane, under **Data Catalog**, turn on **Auto-discovery**.

## Grant users access to the catalog
<a name="catalog-assets-set-up-permissions"></a>

You control access to the catalog with AWS Identity and Access Management (IAM). Attach the permissions to the IAM role or user that each person uses.

### Browse catalog
<a name="catalog-assets-set-up-permissions-readonly"></a>

Users can browse catalogs, databases, tables, and crawler status; search assets; view asset details, lineage, metadata forms, glossaries, and terms; view data quality rulesets, results, and schedules; view model packages and hub content; and browse Amazon S3 buckets. Users cannot create or change any resource.

Attach the [`AmazonSageMakerReadOnly`](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonSageMakerReadOnly.html) and [`AmazonEventBridgeSchedulerReadOnlyAccess`](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonEventBridgeSchedulerReadOnlyAccess.html) managed policies, and the following inline policy:

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "GlueDataCatalogRead",
      "Effect": "Allow",
      "Action": [
        "glue:GetCatalog",
        "glue:GetCatalogs",
        "glue:GetDataCatalogEncryptionSettings",
        "glue:GetDatabases",
        "glue:GetTable",
        "glue:GetTables",
        "glue:GetCrawler",
        "glue:ListCrawlers",
        "glue:ListCrawls",
        "glue:GetDataQualityRuleset",
        "glue:ListDataQualityRulesets",
        "glue:GetDataQualityRulesetEvaluationRun",
        "glue:ListDataQualityRulesetEvaluationRuns",
        "glue:BatchGetDataQualityResult"
      ],
      "Resource": "*"
    },
    {
      "Sid": "GlueCatalogDiscoveryRead",
      "Effect": "Allow",
      "Action": [
        "glue:SearchAssets",
        "glue:GetAsset",
        "glue:ListIterableForms",
        "glue:BatchGetIterableForms",
        "glue:GetFormType",
        "glue:ListFormTypes",
        "glue:ListGlossaries",
        "glue:GetGlossaryTerm",
        "glue:ListGlossaryTerms",
        "glue:QueryGraph",
        "glue:GetLineageNode"
      ],
      "Resource": "*"
    },
    {
      "Sid": "CatalogDiscoveryStatusRead",
      "Effect": "Allow",
      "Action": "aws-catalog:GetCatalogDiscovery",
      "Resource": "*"
    },
    {
      "Sid": "S3BrowseBuckets",
      "Effect": "Allow",
      "Action": [
        "s3:ListAllMyBuckets",
        "s3:ListBucket",
        "s3:GetBucketLocation"
      ],
      "Resource": "*"
    },
    {
      "Sid": "S3ObjectReadSageMakerBuckets",
      "Effect": "Allow",
      "Action": "s3:GetObject",
      "Resource": [
        "arn:aws:s3:::*SageMaker*/*",
        "arn:aws:s3:::*Sagemaker*/*",
        "arn:aws:s3:::*sagemaker*/*",
        "arn:aws:s3:::*aws-glue*/*"
      ]
    },
    {
      "Sid": "S3ObjectReadSageMakerTagged",
      "Effect": "Allow",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::*/*",
      "Condition": {
        "StringEqualsIgnoreCase": {
          "s3:ExistingObjectTag/SageMaker": "true"
        }
      }
    },
    {
      "Sid": "EvaluatorCodeFromLambda",
      "Effect": "Allow",
      "Action": "lambda:GetFunction",
      "Resource": "arn:aws:lambda:*:*:function:*"
    }
  ]
}
```

### ReadWrite
<a name="catalog-assets-set-up-permissions-readwrite"></a>

The ReadWrite persona includes everything in Browse catalog, plus authoring. These users can create, edit, and delete metadata forms, glossaries, terms, and attachments, and assign terms to assets; create, edit, delete, and run data quality rulesets; create, change, and delete the data quality schedules that the **Catalogs** page creates (`sagemaker-studio-*`); run queries in the **Query** tab; create databases and tables; resync a federated catalog; register and deploy models; and upload and delete files in `*sagemaker*` and `*aws-glue*` buckets. A ReadWrite user cannot delete databases and tables.

Attach the [`AmazonSageMakerFullAccess`](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonSageMakerFullAccess.html) managed policy, and the following inline policy:

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "GlueDataCatalogRead",
      "Effect": "Allow",
      "Action": [
        "glue:GetCatalog",
        "glue:GetCatalogs",
        "glue:GetDataCatalogEncryptionSettings",
        "glue:GetDatabases",
        "glue:GetTable",
        "glue:GetTables",
        "glue:GetCrawler",
        "glue:ListCrawlers",
        "glue:ListCrawls",
        "glue:GetDataQualityRuleset",
        "glue:ListDataQualityRulesets",
        "glue:GetDataQualityRulesetEvaluationRun",
        "glue:ListDataQualityRulesetEvaluationRuns",
        "glue:BatchGetDataQualityResult"
      ],
      "Resource": "*"
    },
    {
      "Sid": "GlueDataCatalogWrite",
      "Effect": "Allow",
      "Action": [
        "glue:CreateDatabase",
        "glue:CreateTable",
        "glue:CreateDataQualityRuleset",
        "glue:UpdateDataQualityRuleset",
        "glue:DeleteDataQualityRuleset",
        "glue:StartDataQualityRulesetEvaluationRun",
        "glue:StartCrawler"
      ],
      "Resource": "*"
    },
    {
      "Sid": "GlueCatalogDiscoveryRead",
      "Effect": "Allow",
      "Action": [
        "glue:SearchAssets",
        "glue:GetAsset",
        "glue:ListIterableForms",
        "glue:BatchGetIterableForms",
        "glue:GetFormType",
        "glue:ListFormTypes",
        "glue:ListGlossaries",
        "glue:GetGlossaryTerm",
        "glue:ListGlossaryTerms",
        "glue:QueryGraph",
        "glue:GetLineageNode"
      ],
      "Resource": "*"
    },
    {
      "Sid": "GlueCatalogDiscoveryWrite",
      "Effect": "Allow",
      "Action": [
        "glue:CreateGlossary",
        "glue:UpdateGlossary",
        "glue:DeleteGlossary",
        "glue:CreateGlossaryTerm",
        "glue:UpdateGlossaryTerm",
        "glue:DeleteGlossaryTerm",
        "glue:AssociateGlossaryTerms",
        "glue:DisassociateGlossaryTerms",
        "glue:PutFormType",
        "glue:DeleteFormType",
        "glue:PutAttachment",
        "glue:DeleteAttachment"
      ],
      "Resource": "*"
    },
    {
      "Sid": "CatalogDiscoveryStatusRead",
      "Effect": "Allow",
      "Action": "aws-catalog:GetCatalogDiscovery",
      "Resource": "*"
    },
    {
      "Sid": "GlueTagOnCreate",
      "Effect": "Allow",
      "Action": "glue:TagResource",
      "Resource": "*",
      "Condition": {
        "StringEquals": {
          "aws:RequestTag/CreatedBy": "SageMakerAI"
        },
        "ForAllValues:StringEquals": {
          "aws:TagKeys": [
            "CreatedBy"
          ]
        }
      }
    },
    {
      "Sid": "PassGlueServiceRoleToGlue",
      "Effect": "Allow",
      "Action": "iam:PassRole",
      "Resource": [
        "arn:aws:iam::*:role/AWSGlueServiceRole*",
        "arn:aws:iam::*:role/service-role/AWSGlueServiceRole*"
      ],
      "Condition": {
        "StringEquals": {
          "iam:PassedToService": "glue.amazonaws.com"
        }
      }
    },
    {
      "Sid": "LakeFormationDataAccess",
      "Effect": "Allow",
      "Action": "lakeformation:GetDataAccess",
      "Resource": "*"
    },
    {
      "Sid": "DataQualityScheduleManage",
      "Effect": "Allow",
      "Action": [
        "scheduler:CreateSchedule",
        "scheduler:UpdateSchedule",
        "scheduler:DeleteSchedule"
      ],
      "Resource": "arn:aws:scheduler:*:*:schedule/default/sagemaker-studio-*"
    },
    {
      "Sid": "DataQualityScheduleRead",
      "Effect": "Allow",
      "Action": "scheduler:GetSchedule",
      "Resource": "arn:aws:scheduler:*:*:schedule/default/*"
    },
    {
      "Sid": "PassScheduleRoleToScheduler",
      "Effect": "Allow",
      "Action": "iam:PassRole",
      "Resource": [
        "arn:aws:iam::*:role/sagemaker-studio-*",
        "arn:aws:iam::*:role/service-role/sagemaker-studio-*"
      ],
      "Condition": {
        "StringEquals": {
          "iam:PassedToService": "scheduler.amazonaws.com"
        }
      }
    },
    {
      "Sid": "StudioAthenaWorkgroupManage",
      "Effect": "Allow",
      "Action": [
        "athena:GetWorkGroup",
        "athena:CreateWorkGroup",
        "athena:UpdateWorkGroup",
        "athena:GetQueryRuntimeStatistics"
      ],
      "Resource": "arn:aws:athena:*:*:workgroup/sagemaker-studio-workgroup-*"
    },
    {
      "Sid": "StudioAthenaWorkgroupTagOnCreate",
      "Effect": "Allow",
      "Action": "athena:TagResource",
      "Resource": "arn:aws:athena:*:*:workgroup/sagemaker-studio-workgroup-*",
      "Condition": {
        "StringEquals": {
          "aws:RequestTag/CreatedBy": "SageMakerAI"
        },
        "ForAllValues:StringEquals": {
          "aws:TagKeys": [
            "CreatedBy"
          ]
        }
      }
    },
    {
      "Sid": "AthenaWorkgroupList",
      "Effect": "Allow",
      "Action": "athena:ListWorkGroups",
      "Resource": "*"
    },
    {
      "Sid": "EvaluatorCodeFromLambda",
      "Effect": "Allow",
      "Action": "lambda:GetFunction",
      "Resource": "arn:aws:lambda:*:*:function:*"
    },
    {
      "Sid": "SqlWorkbenchQueryTab",
      "Effect": "Allow",
      "Action": [
        "sqlworkbench:CreateConnection",
        "sqlworkbench:DriverExecute"
      ],
      "Resource": "*"
    },
    {
      "Sid": "SqlWorkbenchSetContext",
      "Effect": "Allow",
      "Action": "sts:SetContext",
      "Resource": "arn:aws:sts::*:self",
      "Condition": {
        "ForAnyValue:StringEquals": {
          "aws:CalledVia": [
            "sqlworkbench.amazonaws.com"
          ]
        }
      }
    }
  ]
}
```

### FullAccess
<a name="catalog-assets-set-up-permissions-fullaccess"></a>

The FullAccess persona includes everything in ReadWrite, plus deleting databases and tables.

Attach the [`AmazonSageMakerFullAccess`](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonSageMakerFullAccess.html) managed policy, and the following inline policy:

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "GlueDataCatalogRead",
      "Effect": "Allow",
      "Action": [
        "glue:GetCatalog",
        "glue:GetCatalogs",
        "glue:GetDataCatalogEncryptionSettings",
        "glue:GetDatabases",
        "glue:GetTable",
        "glue:GetTables",
        "glue:GetCrawler",
        "glue:ListCrawlers",
        "glue:ListCrawls",
        "glue:GetDataQualityRuleset",
        "glue:ListDataQualityRulesets",
        "glue:GetDataQualityRulesetEvaluationRun",
        "glue:ListDataQualityRulesetEvaluationRuns",
        "glue:BatchGetDataQualityResult"
      ],
      "Resource": "*"
    },
    {
      "Sid": "GlueDataCatalogWrite",
      "Effect": "Allow",
      "Action": [
        "glue:CreateDatabase",
        "glue:CreateTable",
        "glue:CreateDataQualityRuleset",
        "glue:UpdateDataQualityRuleset",
        "glue:DeleteDataQualityRuleset",
        "glue:StartDataQualityRulesetEvaluationRun",
        "glue:StartCrawler"
      ],
      "Resource": "*"
    },
    {
      "Sid": "GlueCatalogDiscoveryRead",
      "Effect": "Allow",
      "Action": [
        "glue:SearchAssets",
        "glue:GetAsset",
        "glue:ListIterableForms",
        "glue:BatchGetIterableForms",
        "glue:GetFormType",
        "glue:ListFormTypes",
        "glue:ListGlossaries",
        "glue:GetGlossaryTerm",
        "glue:ListGlossaryTerms",
        "glue:QueryGraph",
        "glue:GetLineageNode"
      ],
      "Resource": "*"
    },
    {
      "Sid": "GlueCatalogDiscoveryWrite",
      "Effect": "Allow",
      "Action": [
        "glue:CreateGlossary",
        "glue:UpdateGlossary",
        "glue:DeleteGlossary",
        "glue:CreateGlossaryTerm",
        "glue:UpdateGlossaryTerm",
        "glue:DeleteGlossaryTerm",
        "glue:AssociateGlossaryTerms",
        "glue:DisassociateGlossaryTerms",
        "glue:PutFormType",
        "glue:DeleteFormType",
        "glue:PutAttachment",
        "glue:DeleteAttachment"
      ],
      "Resource": "*"
    },
    {
      "Sid": "CatalogDiscoveryStatusRead",
      "Effect": "Allow",
      "Action": "aws-catalog:GetCatalogDiscovery",
      "Resource": "*"
    },
    {
      "Sid": "GlueTagOnCreate",
      "Effect": "Allow",
      "Action": "glue:TagResource",
      "Resource": "*",
      "Condition": {
        "StringEquals": {
          "aws:RequestTag/CreatedBy": "SageMakerAI"
        },
        "ForAllValues:StringEquals": {
          "aws:TagKeys": [
            "CreatedBy"
          ]
        }
      }
    },
    {
      "Sid": "PassGlueServiceRoleToGlue",
      "Effect": "Allow",
      "Action": "iam:PassRole",
      "Resource": [
        "arn:aws:iam::*:role/AWSGlueServiceRole*",
        "arn:aws:iam::*:role/service-role/AWSGlueServiceRole*"
      ],
      "Condition": {
        "StringEquals": {
          "iam:PassedToService": "glue.amazonaws.com"
        }
      }
    },
    {
      "Sid": "LakeFormationDataAccess",
      "Effect": "Allow",
      "Action": "lakeformation:GetDataAccess",
      "Resource": "*"
    },
    {
      "Sid": "DataQualityScheduleManage",
      "Effect": "Allow",
      "Action": [
        "scheduler:CreateSchedule",
        "scheduler:UpdateSchedule",
        "scheduler:DeleteSchedule"
      ],
      "Resource": "arn:aws:scheduler:*:*:schedule/default/sagemaker-studio-*"
    },
    {
      "Sid": "DataQualityScheduleRead",
      "Effect": "Allow",
      "Action": "scheduler:GetSchedule",
      "Resource": "arn:aws:scheduler:*:*:schedule/default/*"
    },
    {
      "Sid": "PassScheduleRoleToScheduler",
      "Effect": "Allow",
      "Action": "iam:PassRole",
      "Resource": [
        "arn:aws:iam::*:role/sagemaker-studio-*",
        "arn:aws:iam::*:role/service-role/sagemaker-studio-*"
      ],
      "Condition": {
        "StringEquals": {
          "iam:PassedToService": "scheduler.amazonaws.com"
        }
      }
    },
    {
      "Sid": "StudioAthenaWorkgroupManage",
      "Effect": "Allow",
      "Action": [
        "athena:GetWorkGroup",
        "athena:CreateWorkGroup",
        "athena:UpdateWorkGroup",
        "athena:GetQueryRuntimeStatistics"
      ],
      "Resource": "arn:aws:athena:*:*:workgroup/sagemaker-studio-workgroup-*"
    },
    {
      "Sid": "StudioAthenaWorkgroupTagOnCreate",
      "Effect": "Allow",
      "Action": "athena:TagResource",
      "Resource": "arn:aws:athena:*:*:workgroup/sagemaker-studio-workgroup-*",
      "Condition": {
        "StringEquals": {
          "aws:RequestTag/CreatedBy": "SageMakerAI"
        },
        "ForAllValues:StringEquals": {
          "aws:TagKeys": [
            "CreatedBy"
          ]
        }
      }
    },
    {
      "Sid": "AthenaWorkgroupList",
      "Effect": "Allow",
      "Action": "athena:ListWorkGroups",
      "Resource": "*"
    },
    {
      "Sid": "EvaluatorCodeFromLambda",
      "Effect": "Allow",
      "Action": "lambda:GetFunction",
      "Resource": "arn:aws:lambda:*:*:function:*"
    },
    {
      "Sid": "GlueDatabaseTableDelete",
      "Effect": "Allow",
      "Action": [
        "glue:DeleteDatabase",
        "glue:DeleteTable"
      ],
      "Resource": "*"
    },
    {
      "Sid": "S3TablesCreateCatalog",
      "Effect": "Allow",
      "Action": [
        "s3tables:CreateTableBucket",
        "s3tables:CreateNamespace"
      ],
      "Resource": "arn:aws:s3tables:*:*:bucket/*"
    },
    {
      "Sid": "SqlWorkbenchQueryTab",
      "Effect": "Allow",
      "Action": [
        "sqlworkbench:CreateConnection",
        "sqlworkbench:DriverExecute"
      ],
      "Resource": "*"
    },
    {
      "Sid": "SqlWorkbenchSetContext",
      "Effect": "Allow",
      "Action": "sts:SetContext",
      "Resource": "arn:aws:sts::*:self",
      "Condition": {
        "ForAnyValue:StringEquals": {
          "aws:CalledVia": [
            "sqlworkbench.amazonaws.com"
          ]
        }
      }
    }
  ]
}
```

## Configure encryption
<a name="catalog-assets-set-up-encryption"></a>

Configure the encryption settings in AWS Glue Data Catalog. For more information, see [Encrypting your Data Catalog](https://docs.aws.amazon.com/glue/latest/dg/encrypt-glue-data-catalog.html).