

# Enabling auto-discovery in AWS Glue Data Catalog

AWS Glue Data Catalog can automatically index metadata from other AWS services, making it discoverable and available to annotate with business meaning. Participating AWS services prepare metadata about your resources so that it is ready for use in the Data Catalog. When you enable auto-discovery, that prepared metadata is made available as assets in the Data Catalog for your account.

You enable auto-discovery for all participating AWS services in the Data Catalog for each account and AWS Region. Metadata for resources you create in participating AWS services after you enable auto-discovery is made available in the Data Catalog without further action.

## Participating services
<a name="catalog-auto-discovery-participating-services"></a>

The following table lists participating services by category. For the asset types that each service publishes, see [Asset types for AWS services](aws-service-assets.md).


| Category | Services | 
| --- | --- | 
| Storage and analytics | Amazon S3 (including S3 Tables and S3 Vectors), AWS Glue, Amazon Redshift | 
| Databases | Amazon RDS, Amazon Aurora, Amazon DynamoDB, Amazon DocumentDB, Amazon Keyspaces, Amazon Neptune, Amazon ElastiCache, Amazon Timestream for InfluxDB ([limited Regions](aws-service-assets.md#aws-service-assets-timestream)) | 
| Streaming | Amazon MSK, Amazon Kinesis Data Streams, Amazon Data Firehose | 
| Search | Amazon OpenSearch Service | 
| AI and machine learning | Amazon SageMaker AI | 

## Permissions for enabling auto-discovery
<a name="catalog-auto-discovery-enable-permissions"></a>

To enable auto-discovery and view its status, you need the `aws-catalog:PutCatalogDiscovery` and `aws-catalog:GetCatalogDiscovery` permissions. These permissions are for high-privilege users and roles, such as account administrators, because enabling auto-discovery allows anyone in the account with permissions to search the catalog to find metadata from participating AWS services in the Data Catalog.

You can make assets from most participating services available to the Data Catalog in your account with the `aws-catalog:PutCatalogDiscovery` permission alone. AWS database services send their metadata through AWS Resource Explorer, so to find their assets, you need three additional permissions that let AWS Glue set up Resource Explorer in your account and Region:
+ `resource-explorer-2:CreateIndex`
+ `resource-explorer-2:CreateStreamingAccessForService`
+ `iam:CreateServiceLinkedRole`

The following example policy grants permissions to enable auto-discovery and view its status, and the permissions that AWS Glue needs to set up Resource Explorer for AWS database services.

```json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "aws-catalog:PutCatalogDiscovery",
                "aws-catalog:GetCatalogDiscovery"
            ],
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "resource-explorer-2:CreateIndex"
            ],
            "Resource": "arn:aws:resource-explorer-2:*:*:index/*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "resource-explorer-2:CreateStreamingAccessForService"
            ],
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "iam:CreateServiceLinkedRole"
            ],
            "Resource": "arn:aws:iam::*:role/aws-service-role/resource-explorer-2.amazonaws.com/AWSServiceRoleForResourceExplorer",
            "Condition": {
                "StringEquals": {
                    "iam:AWSServiceName": "resource-explorer-2.amazonaws.com"
                }
            }
        }
    ]
}
```

## Enabling auto-discovery
<a name="catalog-auto-discovery-enable"></a>

------
#### [ AWS Management Console ]

**To enable auto-discovery**

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

1. In the navigation pane, choose **Search**.

1. On the **Search** page, choose **Enable auto-discovery**.

------
#### [ AWS CLI ]

Call `PutCatalogDiscovery` with `Mode` set to `OPTED_IN`.

```bash
aws catalog put-catalog-discovery --mode OPTED_IN
```

------

Use the following API operations to enable and check the status of auto-discovery.


| Operation | Description | 
| --- | --- | 
| PutCatalogDiscovery | Enables or disables auto-discovery for an account and Region. | 
| GetCatalogDiscovery | Returns whether auto-discovery is enabled for an account and Region. | 

After you enable auto-discovery, most assets and changes to them appear in the catalog within minutes. Some assets can take up to a few days to appear.

You can search for assets on the **Search** page and view their details, including their technical metadata and any business context added to them, on the **Catalog explorer** page.

**Note**  
When you delete a resource in a participating service, its asset is no longer available in the Data Catalog. The catalog reflects only the resources that you currently have.

## Permissions for searching and adding business context
<a name="catalog-auto-discovery-asset-permissions"></a>

After you enable auto-discovery, AWS Glue IAM permissions control which users and roles can search for assets in the catalog and add business context to them. AWS Glue permissions don't grant access to the underlying resource or its data, which remains under the access controls of the service that owns it.

### Searching for assets
<a name="catalog-auto-discovery-search-permissions"></a>

Users and roles can search the catalog to find assets by what they contain or represent, with results ranked by semantic meaning instead of keyword matches.

Users and roles need the `glue:SearchAssets` and `glue:GetAsset` permissions to search for and view every asset in the catalog. To also see the names and data types of columns in tables and views, and the business context added to each column, users and roles need the `glue:ListIterableForms` and `glue:BatchGetIterableForms` permissions. For more information, see [Semantic search for AWS Glue Data Catalog](catalog-semantic-search.md).

The following example policy grants permissions to search for and view every asset in the catalog, including column details.

```json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "glue:SearchAssets",
                "glue:GetAsset",
                "glue:ListIterableForms",
                "glue:BatchGetIterableForms"
            ],
            "Resource": "*"
        }
    ]
}
```

### Adding business context
<a name="catalog-auto-discovery-business-context-permissions"></a>

Users and roles can also enrich assets with business context, such as glossary terms, metadata forms, and descriptions, so that they are easier to find and understand.

To add business context to every asset in the catalog, users and roles need the `glue:AssociateGlossaryTerms`, `glue:PutAttachment`, and `glue:PutAsset` permissions. To remove glossary terms and metadata forms, they need the `glue:DisassociateGlossaryTerms` and `glue:DeleteAttachment` permissions. For more information, see [Permissions](catalog-business-context.md#catalog-business-context-permissions).

The following example policy grants permissions to add and remove business context for every asset in the catalog.

```json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "glue:AssociateGlossaryTerms",
                "glue:DisassociateGlossaryTerms",
                "glue:PutAttachment",
                "glue:DeleteAttachment",
                "glue:PutAsset"
            ],
            "Resource": "*"
        }
    ]
}
```

## Disabling auto-discovery
<a name="catalog-auto-discovery-disable"></a>

When you disable auto-discovery, users and roles in your account and Region can no longer search for or add business context to assets from participating AWS services.

------
#### [ AWS Management Console ]

**To disable auto-discovery**

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

1. In the navigation pane, choose **Search**.

1. On the **Search** page, choose **Disable auto-discovery**.

------
#### [ AWS CLI ]

Call `PutCatalogDiscovery` with `Mode` set to `OPTED_OUT`.

```bash
aws catalog put-catalog-discovery --mode OPTED_OUT
```

------

You can re-enable auto-discovery at any time. When you do, assets from participating services become available in the catalog again and reflect the current state of your resources. If you re-enable auto-discovery within 90 days of disabling it, AWS Glue restores the associations between your business context and assets. After 90 days, AWS Glue permanently deletes these associations, and you need to reattach business context to the assets.

## Using auto-discovery with an encrypted catalog
<a name="catalog-auto-discovery-encryption"></a>

If you encrypt your Data Catalog with a customer managed AWS KMS key, AWS Glue uses the same key to encrypt your assets, business context, and the search index.

**Note**  
Search and business context aren't available for catalogs encrypted with the AWS managed key (`aws/glue`).

When you enable auto-discovery in the console, AWS Glue also creates an AWS KMS grant on your behalf that allows it to use the key. To create the grant with the API or the AWS CLI, call `PutDataCatalogEncryptionSettings` after you call `PutCatalogDiscovery`, and pass the settings that `GetDataCatalogEncryptionSettings` returns.

If you disable auto-discovery, keep your key enabled and accessible until AWS Glue finishes moving your data off the key. After that, AWS Glue no longer uses your key to encrypt or decrypt assets, business context, or the search index. When you re-enable auto-discovery, AWS Glue needs permission to use your key again.

For more information, including the required permissions and example commands, see [Encrypting your Data Catalog](encrypt-glue-data-catalog.md).