View a markdown version of this page

Managing an external catalog integration - AWS Glue

Managing an external catalog integration

After you turn on sync for a federated catalog, you manage it through the catalog with the UpdateCatalog and GetCatalog operations. This topic shows how to read the sync status and change how often the sync runs. It also shows how to turn sync off, turn on lineage sync for Snowflake and Databricks, and delete a federated catalog. For instructions on creating a federated catalog and turning on sync, see Integrating with Databricks Unity Catalog and Integrating with Snowflake Horizon Catalog.

SyncConfiguration reference

You turn on and configure sync by adding a SyncConfiguration to the FederatedCatalog of a catalog. The following example shows the shape of a SyncConfiguration:

"SyncConfiguration": { "RoleArn": "arn:aws:iam::account-id:role/role-name", "AssetsSyncConfiguration": { "Status": "ENABLED", "RefreshIntervalMinutes": 1440 }, "LineageSyncConfiguration": { "Status": "DISABLED" } }

The following table describes the fields and the rules for each one.

SyncConfiguration fields
Field Rule
RoleArn Required. The Amazon Resource Name (ARN) of the IAM role that the managed crawler runs as. The role must be in your account, and AWS Glue must be able to assume it for this catalog.
Status Either ENABLED or DISABLED. Appears in both AssetsSyncConfiguration and LineageSyncConfiguration.
RefreshIntervalMinutes Required when the status is ENABLED. Sets how often the managed crawler runs. Use 1440 for a 24-hour interval or 10080 for a 7-day interval.
ManagedCrawlerDetails Set by AWS Glue and read-only. Holds the crawler ARN, the status (PROVISIONING, PROVISIONED, or FAILED), and any error. You can't set this field.
LineageSyncConfiguration Optional. Turns on lineage sync. Supported for both Snowflake and Databricks catalogs. For more information, see Turn on lineage sync.

Sync works only for the DATABRICKS and SNOWFLAKE connection types. Whenever you send a CatalogInput, always include CreateTableDefaultPermissions and CreateDatabaseDefaultPermissions as empty lists.

View sync status

The GetCatalog operation returns the full catalog, including the managed crawler details. To read the status of the assets managed crawler, run get-catalog and narrow the output with the --query parameter.

  1. Create a request file named get-catalog.json.

    { "CatalogId": "account-id:catalog-name" }
  2. Run the get-catalog command.

    aws glue get-catalog \ --cli-input-json file://get-catalog.json \ --query 'Catalog.FederatedCatalog.SyncConfiguration.AssetsSyncConfiguration.ManagedCrawlerDetails'

    The command returns the crawler ARN and status.

    { "CrawlerArn": "arn:aws:glue:region:account-id:crawler/catalog-sync-assets-id", "Status": "PROVISIONED" }

The managed crawler takes about 20 seconds to reach PROVISIONED after you turn on sync. After the crawler reaches PROVISIONED, the first crawl starts automatically. The GetCatalogs operation lists your catalogs but leaves out the managed crawler status, so use GetCatalog for one catalog when you need the crawler status.

Change the refresh interval

The refresh interval sets how often the managed crawler runs. To change it, update RefreshIntervalMinutes on the catalog with the UpdateCatalog operation. Use 1440 for a 24-hour interval or 10080 for a 7-day interval.

  1. Create a request file named update-interval.json. Include ConnectionName and ConnectionType so that the update keeps the federated catalog settings.

    { "CatalogId": "account-id:catalog-name", "CatalogInput": { "CreateTableDefaultPermissions": [], "CreateDatabaseDefaultPermissions": [], "FederatedCatalog": { "ConnectionName": "connection-name", "ConnectionType": "DATABRICKS", "SyncConfiguration": { "RoleArn": "role-arn", "AssetsSyncConfiguration": { "Status": "ENABLED", "RefreshIntervalMinutes": 10080 } } } } }
  2. Run the update-catalog command.

    aws glue update-catalog --cli-input-json file://update-interval.json

Turn sync off

To turn off metadata sync, set the Status of AssetsSyncConfiguration to DISABLED with the UpdateCatalog operation. AWS Glue removes the managed crawler, and GetCatalog no longer returns the managed crawler details while the Status is DISABLED.

  1. Create a request file named disable-sync.json.

    { "CatalogId": "account-id:catalog-name", "CatalogInput": { "CreateTableDefaultPermissions": [], "CreateDatabaseDefaultPermissions": [], "FederatedCatalog": { "ConnectionName": "connection-name", "ConnectionType": "DATABRICKS", "SyncConfiguration": { "RoleArn": "role-arn", "AssetsSyncConfiguration": { "Status": "DISABLED" } } } } }
  2. Run the update-catalog command.

    aws glue update-catalog --cli-input-json file://disable-sync.json

Rules for updating a federated catalog

When you update a federated catalog, follow these rules so that the update keeps the catalog valid.

  • Always include ConnectionName and ConnectionType in the FederatedCatalog.

  • If you leave out SyncConfiguration, the current sync settings stay in place.

  • Always send CreateTableDefaultPermissions and CreateDatabaseDefaultPermissions as empty lists.

Turn on lineage sync

For a Snowflake or Databricks federated catalog, you can turn on lineage sync by adding a LineageSyncConfiguration to the SyncConfiguration. When lineage sync is on, AWS Glue creates a second managed crawler for lineage. For a Snowflake catalog, the connection must use a host in the orgname-accountname.snowflakecomputing.com format. A Snowflake connection that uses the account locator host is rejected for lineage. For more information about what lineage captures and how to read it, see Lineage from Snowflake and Lineage from Databricks Unity Catalog.

  1. Create a request file named enable-lineage.json. The following example uses a Snowflake catalog. For a Databricks catalog, set ConnectionType to DATABRICKS.

    { "CatalogId": "account-id:catalog-name", "CatalogInput": { "CreateTableDefaultPermissions": [], "CreateDatabaseDefaultPermissions": [], "FederatedCatalog": { "ConnectionName": "connection-name", "ConnectionType": "SNOWFLAKE", "SyncConfiguration": { "RoleArn": "role-arn", "AssetsSyncConfiguration": { "Status": "ENABLED", "RefreshIntervalMinutes": 1440 }, "LineageSyncConfiguration": { "Status": "ENABLED" } } } } }
  2. Run the update-catalog command.

    aws glue update-catalog --cli-input-json file://enable-lineage.json
  3. Read the status of the lineage managed crawler with the get-catalog command.

    aws glue get-catalog \ --cli-input-json file://get-catalog.json \ --query 'Catalog.FederatedCatalog.SyncConfiguration.LineageSyncConfiguration.ManagedCrawlerDetails'

Delete a federated catalog and clean up resources

To remove a federated catalog and the resources you created for it, delete the resources in the following order. Deregister the connection from Lake Formation before you delete the connection.

  1. Delete the catalog. This also removes the managed crawler.

    aws glue delete-catalog \ --catalog-id account-id:catalog-name
  2. Deregister the connection from Lake Formation.

    aws lakeformation deregister-resource \ --resource-arn connection-arn
  3. Delete the connection.

    aws glue delete-connection \ --catalog-id account-id \ --connection-name connection-name
  4. Delete the Secrets Manager secret. Deleting a connection doesn't delete its secret.

    aws secretsmanager delete-secret \ --secret-id secret-arn