本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
設定爬蟲程式以使用 Lake Formation 登入資料
您可以設定爬蟲程式使用 AWS Lake Formation 登入資料來存取 Amazon S3 資料存放區,或具有相同 AWS 帳戶 或另一個 中基礎 Amazon S3 位置的資料目錄資料表 AWS 帳戶。如果爬蟲程式和資料型錄資料表位於同一帳戶中,您可以將現有的資料型錄資料表設定為爬蟲程式的目標。目前,使用 Data Catalog 資料表做為爬蟲程式的目標時,只允許具有單一目錄資料表的單一目錄目標。
將資料型錄資料表定義為爬蟲程式目標時,請確定資料型錄資料表的基礎位置是 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": ""
}
}'