AWS Glue ETL 中的信任身分傳播入門 - AWS Glue

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

AWS Glue ETL 中的信任身分傳播入門

本節可協助您使用互動式工作階段設定 AWS Glue 應用程式,以與 IAM Identity Center 整合,並啟用受信任身分傳播

先決條件

  • 您要建立啟用 AWS Glue 信任身分傳播之互動式工作階段 AWS 的區域中的 Identity Center 執行個體。Identity Center 執行個體只能存在於 AWS 帳戶的單一區域中。如需詳細資訊,請參閱啟用 IAM Identity Center將身分來源中的使用者和群組佈建至 IAM Identity Center

  • 針對 Lake Formation、Amazon S3 存取授權或 Amazon Redshift 叢集等下游服務啟用受信任的身分傳播,互動式工作負載可與這些服務互動來存取資料。

連線至 AWS Glue ETL 與 IAM Identity Center 所需的許可

建立 IAM 角色

建立 IAM Identity Center 連線的角色需要許可,才能在 AWS Glue 和 IAM Identity Center 中建立和修改應用程式組態,如下列內嵌政策所示。

JSON
{ "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "glue:CreateGlueIdentityCenterConfiguration", "sso:CreateApplication", "sso:PutApplicationAssignmentConfiguration", "sso:PutApplicationAuthenticationMethod", "sso:PutApplicationGrant", "sso:PutApplicationAccessScope", "sso:ListInstances" ], "Resource": [ "*" ] } ] }

下列內嵌政策包含檢視、更新和刪除與 IAM Identity Center 整合的 AWS Glue 屬性所需的特定許可。

使用下列內嵌政策,允許 IAM 角色檢視與 IAM Identity Center 的 AWS Glue 整合。

JSON
{ "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "glue:GetGlueIdentityCenterConfiguration" ], "Resource": [ "*" ] } ] }

使用下列內嵌政策,允許 IAM 角色更新與 IAM Identity Center 的 AWS Glue 整合。

JSON
{ "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "glue:UpdateGlueIdentityCenterConfiguration", "sso:PutApplicationAccessScope", "sso:DeleteApplicationAccessScope" ], "Resource": [ "*" ] } ] }

使用下列內嵌政策,允許 IAM 角色刪除與 IAM Identity Center 的 AWS Glue 整合。

JSON
{ "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "glue:DeleteGlueIdentityCenterConfiguration", "sso:DeleteApplication" ], "Resource": [ "*" ] } ] }

許可說明

  • glue:CreateGlueIdentityCenterConfiguration – 准許建立 AWS Glue IdC 組態。

  • glue:GetGlueIdentityCenterConfiguration – 准許取得現有 IdC 組態。

  • glue:DeleteGlueIdentityCenterConfiguration – 准許刪除現有的 AWS Glue IdC 組態。

  • glue:UpdateGlueIdentityCenterConfiguration – 准許更新現有的 AWS Glue IdC 組態。

  • sso:CreateApplication – 准許建立 AWS Glue 受管 IAM Identity Center 應用程式。

  • sso:DescribeApplication - 准許描述 AWS Glue 受管 IAM Identity Center 應用程式。

  • sso:DeleteApplication – 准許刪除 AWS Glue 受管 IAM Identity Center 應用程式。

  • sso:UpdateApplication – 准許更新 AWS Glue 受管 IAM Identity Center 應用程式。

  • sso:PutApplicationGrant – 准許在 IdC 應用程式中套用 token-exchange、introspectToken、refreshToken 和 RevokeToken 授權。

  • sso:PutApplicationAuthenticationMethod – 准許在 AWS Glue 受管 IdC 應用程式上放置 authenticationMethod,以允許 AWS Glue 服務主體與 IdC 應用程式互動。

  • sso:PutApplicationAccessScope – 准許在 AWS Glue 受管 IdC 應用程式中新增或更新授權的下游服務範圍清單。

  • sso:DeleteApplicationAccessScope - 准許在 AWS Glue 受管 IdC 應用程式移除範圍時刪除下游範圍。

  • sso:PutApplicationAssignmentConfiguration – 准許在 IdC 應用程式中設定 "User-assignment-not-required"。

  • sso:ListInstances – 准許列出執行個體,並驗證您在 identity-center-configuration 參數中指定的 IdC InstanceArn。

AWS Glue 與 IAM Identity Center 連線

當 AWS Glue 連接到 IAM Identity Center 時,它會為每個帳戶建立單一受管 IdC 應用程式。下列範例顯示如何 AWS Glue 與 IAM Identity Center 連線:

aws glue create-glue-identity-center-configuration \ --instance-arn arn:aws:sso:::instance/ssoins-123456789 \ --scopes '["s3:access_grants:read_write", "redshift:connect","lakeformation:query"]'

若要更新受管應用程式的範圍 (通常用來傳播到更多下游服務),可以使用:

aws glue update-glue-identity-center-configuration \ --scopes '["s3:access_grants:read_write", "redshift:connect","lakeformation:query"]'

範圍參數是選用的,如果未提供,則會新增所有範圍。支援的值為 s3:access_grants:read_writeredshift:connectlakeformation:query

若要取得組態的詳細資訊,可以使用:

aws glue get-glue-identity-center-configuration

您可以使用下列命令刪除 AWS Glue 與 IAM Identity Center 之間的連線:

aws glue delete-glue-identity-center-configuration
注意

AWS Glue 會在您的帳戶中建立服務受管 Identity Center 應用程式,服務會利用該應用程式將身分驗證和身分傳播到下游服務。 AWS Glue 建立的受管 Identity Center 應用程式會與您帳戶中所有trusted-identity-propagation工作階段共用。

警告:請勿手動修改受管 Identity Center 應用程式中的設定。任何變更都可能會影響您帳戶中所有啟用trusted-identity-propagation的 AWS Glue 互動式工作階段。

建立啟用信任身分傳播的 AWS Glue 互動式工作階段

AWS Glue 與 IAM Identity Center 連線後,您可以使用身分增強型角色登入資料來建立 AWS Glue 互動式工作階段。建立 5.0 AWS Glue 工作階段時,您不需要傳遞其他參數。由於 AWS Glue 與 IAM 身分中心連線,如果 AWS Glue 偵測到 identity-enhanced-role-credentials,它會自動將身分資訊傳播到下游服務,而下游服務稱為 陳述式的一部分。不過,工作階段的執行時期角色需要具有 sts:SetContext 許可,如下所示。

傳播身分的執行時期角色許可

當 AWS Glue 工作階段利用身分增強憑證將身分傳播到下游 AWS 服務時,其執行時間角色的信任政策需要有額外的許可sts:SetContext,以允許身分傳播到下游服務 (Amazon S3 Access-grant、Lake Formation、Amazon Redshift)。若要進一步了解如何建立執行時期角色,請參閱設定執行時期角色

JSON
{ "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "glue.amazonaws.com" }, "Action": [ "sts:AssumeRole", "sts:SetContext" ] } ] }

此外,執行期角色需要下游 AWS 服務的許可,任務執行會使用使用者身分來擷取資料。請參閱以下連結來設定 Amazon S3 存取授權和 Lake Formation: