

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 檢閱 ETL 任務所需的 IAM 許可
<a name="getting-started-min-privs-job"></a>

當您使用 AWS Glue Studio 建立任務時，任務會承擔您在建立時指定之 IAM 角色的許可。此 IAM 角色必須具有從資料來源擷取資料、將資料寫入目標，以及存取 AWS Glue 資源的許可。

您為任務建立的角色名稱必須以字串 `AWSGlueServiceRole` 開頭，AWS Glue Studio 才能正確使用。例如，您可以將角色命名為 `AWSGlueServiceRole-FlightDataJob`。

## 資料來源和資料目標許可
<a name="getting-started-min-privs-data"></a>

對於您用於任務中的任何來源、目標、指令碼和臨時目錄，AWS Glue Studio 任務必須可以存取 Amazon S3。您可以建立政策，對特定 Amazon S3 資源提供精細存取。
+ 資料來源需要 `s3:ListBucket` 和 `s3:GetObject` 許可。
+ 資料目標需要 `s3:ListBucket`、`s3:PutObject` 和 `s3:DeleteObject` 許可。

**注意**  
 您的 IAM 政策需要允許 用於託管 AWS Glue 轉換`s3:GetObject`的特定儲存貯體。  
 下列儲存貯體為 AWS 服務帳戶所擁有，且可供全球讀取。這些儲存貯體做為與可透過 AWS Glue Studio 視覺化編輯器存取之轉換子集相關的原始程式碼的儲存庫。儲存貯體上的許可會設定為拒絕儲存貯體上的任何其他 API 動作。任何人都可以讀取我們為轉換提供的指令碼，但我們服務團隊以外的任何人都不能將任何內容「放入」其中。當您 AWS Glue 的任務執行時，會將該檔案提取為本機匯入，以便將檔案下載至本機容器。之後，就不會再與該帳戶進行通訊。

 區域：儲存貯體名稱 
+ af-south-1：aws-glue-studio-transforms-762339736633-prod-af-south-1
+ ap-east-1：aws-glue-studio-transforms-125979764932-prod-ap-east-1
+ ap-northeast-2：aws-glue-studio-transforms-673535381443-prod-ap-northeast-2
+ ap-northeast-3：aws-glue-studio-transforms-149976050262-prod-ap-northeast-3
+ ap-south-1：aws-glue-studio-transforms-584702181950-prod-ap-south-1
+ ap-south-2：aws-glue-studio-transforms-380279651983-prod-ap-south-2
+ ap-southeast-1：aws-glue-studio-transforms-737106620487-prod-ap-southeast-1
+ ap-southeast-2：aws-glue-studio-transforms-234881715811-prod-ap-southeast-2
+ ap-southeast-3：aws-glue-studio-transforms-151265630221-prod-ap-southeast-3
+ ap-southeast-4：aws-glue-studio-transforms-052235663858-prod-ap-southeast-4
+ ca-central-1：aws-glue-studio-transforms-622716468547-prod-ca-central-1
+ ca-west-1：aws-glue-studio-transforms-915795495192-prod-ca-west-1
+ eu-central-1：aws-glue-studio-transforms-560373232017-prod-eu-central-1
+ eu-central-2：aws-glue-studio-transforms-907358657121-prod-eu-central-2
+ eu-north-1：aws-glue-studio-transforms-312557305497-prod-eu-north-1
+ eu-south-1：aws-glue-studio-transforms-939684186351-prod-eu-south-1
+ eu-south-2：aws-glue-studio-transforms-239737454084-prod-eu-south-2
+ eu-west-1：aws-glue-studio-transforms-244479516193-prod-eu-west-1
+ eu-west-2：aws-glue-studio-transforms-804222392271-prod-eu-west-2
+ eu-west-3：aws-glue-studio-transforms-371299348807-prod-eu-west-3
+ il-central-1：aws-glue-studio-transforms-806964611811-prod-il-central-1
+ me-central-1：aws-glue-studio-transforms-733304270342-prod-me-central-1
+ me-south-1：aws-glue-studio-transforms-112120182341-prod-me-south-1
+ sa-east-1：aws-glue-studio-transforms-881619130292-prod-sa-east-1
+ us-east-1：aws-glue-studio-transforms-510798373988-prod-us-east-1
+ us-east-2：aws-glue-studio-transforms-251189692203-prod-us-east-2
+ us-west-1：aws-glue-studio-transforms-593230150239-prod-us-west-1
+ us-west-2：aws-glue-studio-transforms-818035625594-prod-us-west-2
+ ap-northeast-1：aws-glue-studio-transforms-200493242866-prod-ap-northeast-1
+ cn-north-1：aws-glue-studio-transforms-071033555442-prod-cn-north-1
+ cn-northwest-1：aws-glue-studio-transforms-070947029561-prod-cn-northwest-1
+ us-gov-west-1： aws-glue-studio-transforms-227493901923-prod-us-gov-west-1-2604
+ eusc-de-east-1：aws-glue-studio-transforms-780995497573-prod-eusc-de-east-1-555

如果您選擇 Amazon Redshift 做為資料來源，您可以為叢集許可提供 角色。針對 Amazon Redshift 叢集執行的任務會發出使用臨時登入資料存取 Amazon S3 進行暫時儲存的命令。如果您的任務執行超過一小時，這些憑證將會過期，導致任務失敗。若要避免此問題，您可以將角色指派給 Amazon Redshift 叢集本身，可將必要的許可授予使用臨時憑證的任務。如需詳細資訊，請參閱 *AWS Glue 開發人員指南*中的[將資料移入及移出 Amazon Redshift](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-redshift.html)。

如果任務使用 Amazon S3 以外的資料來源或目標，則必須將必要的許可連接到任務所使用的 IAM 角色以存取這些資料來源和目標。如需詳細資訊，請參閱 *AWS Glue 開發人員指南*中的[設定您的環境，以存取資料存放區](https://docs.aws.amazon.com/glue/latest/dg/start-connecting.html)。

如果您為資料存放區使用連接器和連線，則需要其他許可，如[使用連接器所需的許可](#getting-started-min-privs-connectors)中所述。

## 刪除任務所需的許可
<a name="getting-started-min-privs-delete-job"></a>

在 AWS Glue Studio 中，您可以在主控台中選取多個任務來刪除。若要執行此動作，您必須具有 `glue:BatchDeleteJob` 許可。這有別於 AWS Glue 主控台，在此處需要 `glue:DeleteJob` 許可才能刪除任務。

## AWS Key Management Service 許可
<a name="getting-started-min-privs-kms"></a>

如果您計劃存取使用伺服器端加密搭配 AWS Key Management Service (AWS KMS) 的 Amazon S3 來源和目標，請將政策連接至任務所使用的AWS Glue Studio角色，讓任務能夠解密資料。任務角色需要 `kms:ReEncrypt`、`kms:GenerateDataKey` 以及 `kms:DescribeKey` 許可。此外，任務角色需要 `kms:Decrypt`許可，才能上傳或下載使用 AWS KMS 客戶主金鑰 (CMK) 加密的 Amazon S3 物件。

使用 AWS KMS CMKs 需支付額外費用。如需詳細資訊，請參閱 *AWS Key Management Service 開發人員指南*中的 [AWS Key Management Service 概念 - 客戶主金鑰 (CMK)](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#master_keys)和 [AWS Key Management Service 定價](https://aws.amazon.com/kms/pricing)。

## 使用連接器所需的許可
<a name="getting-started-min-privs-connectors"></a>

如果您使用 AWS Glue Custom Connector 和連線來存取資料存放區，則用於執行 AWS Glue ETL 任務的角色需要連接額外的許可：
+ 用於存取從中購買連接器`AmazonEC2ContainerRegistryReadOnly`的 AWS 受管政策 AWS Marketplace。
+ `glue:GetJob` 和 `glue:GetJobs` 許可。
+ AWS Secrets Manager 存取與連線搭配使用之秘密的許可。請參閱 [Example: Permission to retrieve secret values](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#auth-and-access_examples_read) (範例：擷取秘密值的許可) 以了解 IAM 政策範例。

如果您的 AWS Glue ETL 任務在執行 Amazon VPC 的 VPC 內執行，則必須按照[為您的 ETL 任務設定 VPC](getting-started-vpc-config.md)所述設定 VPC。