本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
設定編目程式以使用 Lake Formation 憑證
您可以將爬蟲程式設定為使用 AWS Lake Formation 憑證,來存取 Amazon S3 資料存放區,或在相同 AWS 帳戶 或其他 AWS 帳戶 中具有基礎 Amazon S3 位置的資料型錄資料表。如果爬蟲程式和資料型錄資料表位於同一帳戶中,您可以將現有的資料型錄資料表設定為爬蟲程式的目標。目前,使用 Data Catalog 資料表作為編目程式的目標時,僅允許具有單一型錄資料表的單一型錄目標。
將資料型錄資料表定義為爬蟲程式目標時,請確定資料型錄資料表的基礎位置是 Amazon S3 位置。使用 Lake Formation 憑證的爬蟲程式僅支援具有基礎 Amazon S3 位置的資料型錄目標。
當爬蟲程式和已註冊的 Amazon S3 位置或資料型錄資料表位於同一帳戶 (帳戶內網路爬取) 時,需要進行設定
若要允許爬蟲程式使用 Lake Formation 憑證存取資料存放區或資料型錄資料表,您需要向 Lake Formation 註冊資料位置。此外,爬蟲程式的 IAM 角色必須具備從 Amazon S3 儲存貯體註冊所在的目的地讀取資料的許可。
您可以使用 AWS 管理主控台 或 AWS Command Line Interface (AWS CLI) 完成下列設定步驟。
- AWS 管理主控台
-
- AWS CLI
-
aws glue --profile demo create-crawler --debug --cli-input-json '{
"Name": "prod-test-crawler",
"Role": "arn:aws:iam::111122223333:role/service-role/AWSGlueServiceRole-prod-test-run-role",
"DatabaseName": "prod-run-db",
"Description": "",
"Targets": {
"S3Targets":[
{
"Path": "s3://amzn-s3-demo-bucket"
}
]
},
"SchemaChangePolicy": {
"UpdateBehavior": "LOG",
"DeleteBehavior": "LOG"
},
"RecrawlPolicy": {
"RecrawlBehavior": "CRAWL_EVERYTHING"
},
"LineageConfiguration": {
"CrawlerLineageSettings": "DISABLE"
},
"LakeFormationConfiguration": {
"UseLakeFormationCredentials": true,
"AccountId": "111122223333"
},
"Configuration": {
"Version": 1.0,
"CrawlerOutput": {
"Partitions": { "AddOrUpdateBehavior": "InheritFromTable" },
"Tables": {"AddOrUpdateBehavior": "MergeNewColumns" }
},
"Grouping": { "TableGroupingPolicy": "CombineCompatibleSchemas" }
},
"CrawlerSecurityConfiguration": "",
"Tags": {
"KeyName": ""
}
}'