本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
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 Access Grants 或 Amazon Redshift 叢集,啟用受信任身分傳播。
連線至 AWS Glue ETL 與 IAM Identity Center 所需的許可
建立 IAM 角色
建立 IAM Identity Center 連線的角色需要許可,才能在 AWS Glue 和 IAM Identity Center 中建立和修改應用程式組態,如下列內嵌政策所示。
{ "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 整合。
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "glue:GetGlueIdentityCenterConfiguration" ], "Resource": [ "*" ] } ] }
使用下列內嵌政策允許 IAM 角色更新與 IAM Identity Center 的 AWS Glue 整合。
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "glue:UpdateGlueIdentityCenterConfiguration", "sso:PutApplicationAccessScope", "sso:DeleteApplicationAccessScope" ], "Resource": [ "*" ] } ] }
使用下列內嵌政策,允許 IAM 角色刪除與 IAM Identity Center 的 AWS Glue 整合。
{ "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_write
、 redshift:connect
和 lakeformation: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)。若要進一步了解如何建立執行期角色,請參閱設定執行期角色。
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "glue.amazonaws.com" }, "Action": [ "sts:AssumeRole", "sts:SetContext" ] } ] }
此外,執行期角色需要下游 AWS 服務的許可,任務執行會使用使用者身分來擷取資料。請參閱以下連結來設定 Amazon S3 Access Grants 和 Lake Formation: