本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
設定爬行者程式以使用 Lake Formation 認證
您可以將爬蟲設定為使用 AWS Lake Formation 登入資料存取 Amazon S3 資料存放區或資料目錄表格,其中的基礎 Amazon S3 位置位於相同 AWS 帳戶 或另一個 AWS 帳戶位置。如果爬蟲程式和資料型錄資料表位於同一帳戶中,您可以將現有的資料型錄資料表設定為爬蟲程式的目標。目前,使用資料型錄資料表作為爬蟲程式的目標時,僅允許具有單一型錄資料表的單一型錄目標。
將資料型錄資料表定義為爬蟲程式目標時,請確定資料型錄資料表的基礎位置是 Amazon S3 位置。使用 Lake Formation 憑證的爬蟲程式僅支援具有基礎 Amazon S3 位置的資料型錄目標。
當爬蟲程式和已註冊的 Amazon S3 位置或資料型錄資料表位於同一帳戶 (帳戶內網路爬取) 時,需要進行設定
若要允許爬蟲程式使用 Lake Formation 憑證存取資料存放區或資料型錄資料表,您需要向 Lake Formation 註冊資料位置。此外,爬行者程式的IAM角色必須具有從註冊 Amazon S3 儲存貯體的目的地讀取資料的權限。
您可以使用 AWS Management Console 或 AWS Command Line Interface (AWS CLI) 完成下列組態步驟。
- AWS Management Console
-
- 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://crawl-testbucket"
}
]
},
"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": ""
}
}'