Amazon Redshift 與 Amazon S3 存取授權整合 - Amazon Redshift

Amazon Redshift 自 2025 年 11 月 1 日起不再支援建立新的 Python UDF。如果您想要使用 Python UDF,請在該日期之前建立 UDF。現有 Python UDF 將繼續正常運作。如需詳細資訊,請參閱部落格文章

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

Amazon Redshift 與 Amazon S3 存取授權整合

使用與 Amazon S3 存取授權的整合,即可順利地傳播您的 IAM Identity Center 身分,以控制對 Amazon S3 資料的存取權。此整合可讓您根據 IAM Identity Center 使用者和群組授權 Amazon S3 資料存取。

如需有關 Amazon S3 存取授權的詳細資訊,請參閱使用 S3 存取授權管理存取權

使用 Amazon S3 存取授權可為您的應用程式帶來以下優點:

  • 根據 IAM Identity Center 身分精細控制 Amazon S3 資料的存取權。

  • 在 Amazon Redshift 和 Amazon S3 之間集中管理 IAM Identity Center 身分。

  • 您可以避免針對 Amazon S3 存取管理個別 IAM 許可。

運作方式

若要將您的應用程式與 Amazon S3 存取授權整合,請執行下列操作:

  • 首先,您將 Amazon Redshift 設定為使用 AWS 管理主控台或 與 Amazon S3 Access Grants 整合AWS CLI。

  • 接著,具有 IdC 管理員權限的使用者會使用 Amazon S3 存取授權服務,對特定 IdC 使用者/群組授予 Amazon S3 儲存貯體或字首存取權。如需詳細資訊,請參閱在 S3 存取授權中使用授權

  • 當通過 Redshift 身分驗證的 IdC 使用者執行存取 S3 的查詢時 (例如 COPY、UNLOAD 或 Spectrum 操作),Amazon Redshift 會從 Amazon S3 存取授權服務擷取範圍限定於該 IdC 身分的臨時 S3 存取憑證。

  • 然後 Amazon Redshift 會使用擷取的臨時憑證來存取該查詢的授權 Amazon S3 位置。

設定與 Amazon S3 存取授權的整合

若要設定 Amazon Redshift 與 Amazon S3 存取授權的整合,請執行下列操作:

使用 設定與 Amazon S3 Access Grants 的整合AWS 管理主控台

  1. 開啟 Amazon Redshift 主控台。

  2. 叢集窗格中選擇您的叢集。

  3. 在叢集詳細資訊頁面的身分提供者整合區段中,啟用與 S3 存取授權服務的整合。

    注意

    如果您未設定 IAM Identity Center,則不會顯示身分提供者整合區段。如需詳細資訊,請參閱啟用AWS IAM Identity Center

使用 啟用與 Amazon S3 Access Grants 的整合AWS CLI

  1. 若要建立新的 Amazon Redshift IdC 應用程式同時啟用 S3 整合,請執行下列操作:

    aws redshift create-redshift-idc-application <other parameters> --service-integrations '[ {"S3AccessGrants": [{"ReadWriteAccess": {"Authorization": "Enabled"}}]} ]'
  2. 若要修改現有的應用程式以啟用 S3 存取授權整合,請執行下列操作:

    aws redshift modify-redshift-idc-application <other parameters> --service-integrations '[ {"S3AccessGrants": [{"ReadWriteAccess": {"Authorization": "Enabled"}}]} ]'
  3. 若要修改現有的應用程式以停用 S3 存取授權整合,請執行下列操作:

    aws redshift modify-redshift-idc-application <other parameters> --service-integrations '[ {"S3AccessGrants": [{"ReadWriteAccess": {"Authorization": "Disabled"}}]} ]'

使用 S3 存取授權整合

設定 S3 存取授權整合之後,存取 S3 資料的查詢 (例如 COPYUNLOAD 或 Spectrum 查詢) 會使用 IdC 身分進行授權。未使用 IdC 驗證身分的使用者也可以執行這些查詢,但這些使用者帳戶不會利用 IdC 提供的集中式管理。

下列範例示範使用 S3 存取授權整合執行的查詢:

COPY table FROM 's3://mybucket/data'; // -- Redshift uses IdC identity UNLOAD ('SELECT * FROM table') TO 's3://mybucket/unloaded/' // -- Redshift uses IdC identity