

# Working with managed crawlers

When you turn on sync for a federated catalog, AWS Glue creates and runs a managed crawler that reads metadata from the source and writes it to the Data Catalog. You manage the crawler through the catalog. This topic describes what AWS Glue creates, how to run and monitor the crawler, and which operations aren't allowed on a managed crawler.

## What AWS Glue creates
<a name="catalog-external-catalogs-managed-crawlers-created"></a>

For each federated catalog that has sync turned on, AWS Glue creates one managed crawler for assets. If you turn on lineage sync, AWS Glue creates a second managed crawler for lineage. After AWS Glue provisions a crawler, the first crawl starts automatically. The following table describes the properties of the assets managed crawler.


**Assets managed crawler properties**  

| Property | Value | 
| --- | --- | 
| Name | catalog-sync-assets-{{id}}, where {{id}} is a system-generated hexadecimal identifier. | 
| Catalog | {{account-id}}:{{catalog-name}} | 
| Target | RestCatalogTargets with the catalog's connection. | 
| Role | The IAM role from the SyncConfiguration. | 
| Schedule | Set from RefreshIntervalMinutes on the catalog. Either a 24-hour interval (1440) or a 7-day interval (10080). | 
| Description | System-managed REST\_CATALOG crawler of federated catalog {{catalog-name}} | 

When lineage sync is turned on, the second managed crawler is named `catalog-sync-lineage-{{id}}`, where {{id}} is a system-generated hexadecimal identifier. Its target is `LineageTargets`, and its description identifies it as a `LINEAGE` crawler rather than a `REST_CATALOG` crawler.

## Find the crawler name from the ARN
<a name="catalog-external-catalogs-managed-crawlers-name"></a>

The `GetCatalog` operation returns the crawler Amazon Resource Name (ARN) in `ManagedCrawlerDetails`. The crawler operations take the crawler name, which is the part of the ARN after `crawler/`, not the full ARN. For example, in the ARN `arn:aws:glue:{{region}}:{{account-id}}:crawler/catalog-sync-assets-{{id}}`, the crawler name is `catalog-sync-assets-{{id}}`.

## Run or stop a sync on demand
<a name="catalog-external-catalogs-managed-crawlers-run"></a>

You can run a sync on demand instead of waiting for the next scheduled run, and you can stop a run that's in progress. The `StartCrawler` and `StopCrawler` operations are allowed on a managed crawler.

1. Start a run with the `start-crawler` command.

   ```bash
   aws glue start-crawler --name {{crawler-name}}
   ```

1. Stop a run that's in progress with the `stop-crawler` command.

   ```bash
   aws glue stop-crawler --name {{crawler-name}}
   ```

## View runs, metrics, and logs
<a name="catalog-external-catalogs-managed-crawlers-monitor"></a>

You can review the run history, metrics, and logs of a managed crawler the same way you review a crawler you create.

1. List the crawler runs with the `list-crawls` command.

   ```bash
   aws glue list-crawls --crawler-name {{crawler-name}}
   ```

1. Get the crawler metrics with the `get-crawler-metrics` command.

   ```bash
   aws glue get-crawler-metrics --crawler-name-list {{crawler-name}}
   ```

1. Read the crawler logs from the `/aws-glue/crawlers` log group in CloudWatch Logs. Each crawler writes to a log stream named after the crawler.

   ```bash
   aws logs get-log-events \
       --log-group-name /aws-glue/crawlers \
       --log-stream-name {{crawler-name}}
   ```

## Operations that aren't allowed on managed crawlers
<a name="catalog-external-catalogs-managed-crawlers-blocked"></a>

A managed crawler doesn't allow the following operations. Each one returns an `InvalidInputException` with HTTP status 400.
+ `UpdateCrawler`
+ `DeleteCrawler`
+ `StartCrawlerSchedule`
+ `StopCrawlerSchedule`
+ `UpdateCrawlerSchedule`

The error text names the operation you called, as in the following example.

```
System-managed crawlers cannot be modified through UpdateCrawler. Manage synchronization through the Glue Catalog APIs (UpdateCatalog or DeleteCatalog) instead.
```

To change the schedule, update `RefreshIntervalMinutes` on the catalog with the `UpdateCatalog` operation. To remove the crawler, turn off sync or delete the catalog with the `DeleteCatalog` operation. You can't create a managed crawler yourself. Only AWS Glue creates the managed crawler for a federated catalog.