本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
設定 Glue Data Quality AWS 的 IAM 許可
本主題提供的資訊可協助您了解 IAM 管理員可在 Glue Data Quality 的 AWS Identity and Access Management (IAM) AWS 政策中使用的動作和資源。它還包括範例 IAM 政策,具有使用 AWS Glue Data Quality 與 AWS Glue Data Catalog 所需的最低許可。
如需 Glue AWS 中安全性的其他資訊,請參閱 中的安全性 AWS Glue。
Glue Data Quality AWS 的 IAM 許可
下表列出使用者執行特定 AWS Glue Data Quality 操作所需的許可。若要設定 Glue Data Quality AWS 的精細授權,您可以在 IAM 政策陳述式的 Action元素中指定這些動作。
| Action | 說明 | 資源類型 |
|---|---|---|
glue:CreateDataQualityRuleset |
准許建立資料品質規則集。 | ::dataQualityRuleset/<name> |
glue:DeleteDataQualityRuleset |
准許刪除資料品質規則集。 | ::dataQualityRuleset/<name> |
glue:GetDataQualityRuleset |
准許擷取資料品質規則集。 | ::dataQualityRuleset/<name> |
glue:ListDataQualityRulesets |
准許擷取所有資料品質規則集。 | ::dataQualityRuleset/* |
glue:UpdateDataQualityRuleset |
准許更新資料品質規則集。 | ::dataQualityRuleset/<name> |
glue:GetDataQualityResult |
准許擷取資料品質任務執行結果。此 IAM 動作也提供下列 APIS 的許可:
|
::dataQualityRuleset/<name> |
glue:ListDataQualityResults |
准許擷取所有資料品質任務執行結果。 | ::dataQualityRuleset/* |
glue:CancelDataQualityRuleRecommendationRun |
准許停止進行中的資料品質建議任務執行。 | ::dataQualityRuleset/* |
glue:GetDataQualityRuleRecommendationRun |
准許擷取資料品質建議任務執行。 | ::dataQualityRuleset/* |
glue:ListDataQualityRuleRecommendationRuns |
准許擷取所有資料品質建議任務執行。 | ::dataQualityRuleset/* |
glue:StartDataQualityRuleRecommendationRun |
准許啟動資料品質建議任務執行。 | ::dataQualityRuleset/* |
glue:CancelDataQualityRulesetEvaluationRun |
准許停止進行中的資料品質任務執行。 | ::dataQualityRuleset/* |
glue:GetDataQualityRulesetEvaluationRun |
准許擷取資料品質任務執行。 | ::dataQualityRuleset/* |
glue:ListDataQualityRulesetEvaluationRuns |
准許擷取所有資料品質任務執行。 | ::dataQualityRuleset/* |
glue:StartDataQualityRulesetEvaluationRun |
准許啟動資料品質任務執行。 | ::dataQualityRuleset/<name> |
glue:PublishDataQuality |
准許發布資料品質結果。 | ::dataQualityRuleset/<name> |
glue:GetDataQualityModel |
准許擷取資料品質模型。 | ::dataQualityRuleset/<name>,
::job/<name>
|
glue:GetDataQualityModelResult |
准許擷取資料品質模型結果。 | ::dataQualityRuleset/<name>,
::job/<name>
|
glue:PutDataQualityStatisticAnnotation |
准許將註釋新增至統計資料。此 IAM 動作也提供下列 APIS 的許可:
|
::dataQualityRuleset/<name>,
::job/<name>
|
glue:PutDataQualityProfileAnnotation |
准許將註釋放入設定檔中的所有統計資料。 | ::dataQualityRuleset/<name>,
::job/<name>
|
排程評估執行所需的 IAM 設定
IAM 許可
若要執行排程的資料品質評估執行,您必須將 IAM:PassRole 動作新增至許可政策。
| Action | 說明 | 資源類型 |
|---|---|---|
iam:PassRole |
授予 IAM 許可,以允許使用者傳遞核准的角色。 | 用於呼叫 StartDataQualityRulesetEvaluationRun 之角色的 ARN |
如果沒有這些許可,會發生下列錯誤:
"errorCode": "AccessDenied" "errorMessage": "User: arn:aws:sts::account_id:assumed-role/AWSGlueServiceRole is not authorized to perform: iam:PassRole on resource: arn:aws:iam::account_id:role/service-role/AWSGlueServiceRole because no identity-based policy allows the iam:PassRole action"
IAM 受信任的實體
Glue AWS 和 AWS EventBridge 排程器服務需要列在信任的實體中,才能建立和執行排定的 StartDataQualityEvaluationRun。
範例 IAM 政策
Glue Data Quality AWS 的 IAM 角色需要以下類型的許可:
-
Glue Data Quality AWS 操作的許可,讓您可以取得建議的資料品質規則,並針對 Glue Data Catalog AWS 中的資料表執行資料品質任務。本節中的範例 IAM 政策包含 Glue Data Quality AWS 操作所需的最低許可。
-
授予 Data Catalog 資料表和基礎資料存取權的許可。這些許可視乎您的使用案例而有所差異。例如,針對您在 Amazon S3 中編目的資料,許可應包括對 Amazon S3 的存取權。
注意
除了在本節中描述的許可之外,您還必須設定 Amazon S3 許可。
取得建議資料品質規則的最低許可
此範例政策包括產生建議資料品質規則所需的許可。
取得進階資料品質規則建議的最低許可
您必須擁有建議角色的iam:PassRole許可。角色不需要Amazon Bedrock許可。
信任政策
使用此信任政策可讓 AWS Glue 擔任來源資料表的建議角色。
將 aws:SourceArn 設定為完整來源資料表 ARN。使用 aws:SourceAccount 的 ARN 中的帳戶 ID。
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "glue.amazonaws.com" }, "Action": "sts:AssumeRole", "Condition": { "StringEquals": { "aws:SourceAccount": "111122223333" }, "ArnEquals": { "aws:SourceArn": "arn:aws:glue:us-east-1:111122223333:table/database-name/table-name" } } } ] }
許可政策
在第一次ADVANCED執行時, AWS Glue 會在您的帳戶中建立下列資源:
-
執行規則建議查詢的
glue-dataquality-samplingAthena 工作群組。 -
儲存查詢結果的
aws-glue-dataquality-sampling-Amazon S3 儲存貯體。account-id-region
對於後續執行, AWS Glue 會重複使用現有的工作群組和儲存貯體。如需詳細資訊,請參閱進階資料品質規則建議的資料保護。
將下列許可政策連接至您的建議角色。
{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowCatalogRead", "Effect": "Allow", "Action": [ "glue:GetDatabase", "glue:GetPartitions", "glue:GetTable" ], "Resource": [ "arn:aws:glue:us-east-1:111122223333:catalog", "arn:aws:glue:us-east-1:111122223333:database/database-name", "arn:aws:glue:us-east-1:111122223333:table/database-name/table-name" ] }, { "Sid": "AllowDataQualityRecommendationResults", "Effect": "Allow", "Action": "glue:PublishDataQuality", "Resource": "arn:aws:glue:us-east-1:111122223333:dataQualityRuleset/*" }, { "Sid": "AllowDataAccess", "Effect": "Allow", "Action": [ "athena:CreateWorkGroup", "athena:GetQueryExecution", "athena:GetQueryResults", "athena:StartQueryExecution" ], "Resource": "arn:aws:athena:us-east-1:111122223333:workgroup/glue-dataquality-sampling" }, { "Sid": "AllowSourceRead", "Effect": "Allow", "Action": [ "s3:GetBucketLocation", "s3:GetObject", "s3:ListBucket" ], "Resource": [ "arn:aws:s3:::source-bucket", "arn:aws:s3:::source-bucket/*" ] }, { "Sid": "AllowSamplingBucket", "Effect": "Allow", "Action": [ "s3:AbortMultipartUpload", "s3:CreateBucket", "s3:GetBucketLocation", "s3:GetObject", "s3:ListBucket", "s3:PutLifecycleConfiguration", "s3:PutObject" ], "Resource": [ "arn:aws:s3:::aws-glue-dataquality-sampling-111122223333-us-east-1", "arn:aws:s3:::aws-glue-dataquality-sampling-111122223333-us-east-1/athena-results/*" ] } ] }
注意
如果儲存貯體存在,您可以從此政策中移除 s3:CreateBucket 。如果您刪除儲存貯體, AWS Glue 會再次需要此許可。此政策中的所有其他許可仍是後續執行的必要許可。
額外許可
如果此清單中的條件適用,請將相關許可新增至您的建議角色。
-
如果 Lake Formation 控制資料表存取,請新增
lakeformation:GetDataAccess。在DESCRIBE資料庫和資料表DESCRIBESELECT上授予 角色。 -
如果您指定資料品質安全組態,請新增
glue:GetSecurityConfiguration許可。 -
如果您指定
CreatedRulesetName,請新增glue:CreateDataQualityRuleset許可。 -
如果您使用客戶受管金鑰指定資料品質安全組態,請為該金鑰新增下列陳述式。
{ "Sid": "AllowDataQualityEncryption", "Effect": "Allow", "Action": [ "kms:Decrypt", "kms:DescribeKey", "kms:GenerateDataKey", "kms:GenerateDataKeyWithoutPlaintext", "kms:ReEncrypt*" ], "Resource": "arn:aws:kms:us-east-1:111122223333:key/key-id" }您的建議角色需要這些動作,才能進行查詢結果加密和 AWS Glue Data Quality 資產加密。金鑰政策也必須為您的角色允許這些動作。如需詳細資訊,請參閱金鑰政策。
-
如果來源物件使用 SSE-KMS,請新增下列陳述式。
{ "Sid": "AllowSourceDataDecryption", "Effect": "Allow", "Action": "kms:Decrypt", "Resource": "arn:aws:kms:us-east-1:111122223333:key/source-key-id" }來源金鑰政策也必須允許建議角色解密來源物件。
執行資料品質任務的最低許可。
此範例政策包括執行資料品質評估任務所需的許可。
視乎您的使用案例,以下政策陳述式為選用:
-
AllowCloudWatchPutMetricDataToPublishTaskMetrics- 如果您想要將資料品質執行指標發佈至 Amazon CloudWatch,則為必要項目。 -
AllowS3PutObjectToWriteTaskResults- 如果您想要將資料品質執行結果寫入 Amazon S3,則為必要選項。
執行資料品質 ETL 任務的最低許可
此範例政策包括執行資料品質 ETL 任務所需的許可。