使用身分提供者外掛程式 - Amazon Redshift

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

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

使用身分提供者外掛程式

如需如何使用身分提供者外掛程式的一般資訊,請參閱提供 IAM 登入資料的選項。如需如何管理 IAM 身分的相關資訊 (包括 IAM 角色的最佳實務),請參閱 Amazon Redshift 中的身分和存取管理

使用 ADFS 身分提供者外掛程式進行身分驗證

以下是使用 Active Directory Federation Service (ADFS) 身分提供者外掛程式來針對連線至 Amazon Redshift 資料庫的使用者進行驗證的範例。

>>> con = redshift_connector.connect( iam=True, database='dev', host='my-testing-cluster.abc.us-east-2.redshift.amazonaws.com', cluster_identifier='my-testing-cluster', credentials_provider='AdfsCredentialsProvider', user='brooke@myadfshostname.com', password='Hunter2', idp_host='myadfshostname.com' )

使用 Azure 身分提供者外掛程式進行身分驗證

以下是使用 Azure 身分提供者外掛程式進行身分驗證的範例。您可以為 Azure 企業應用程式建立 client_idclient_secret 的值,如下所示。

>>> con = redshift_connector.connect( iam=True, database='dev', host='my-testing-cluster.abc.us-east-2.redshift.amazonaws.com', cluster_identifier='my-testing-cluster', credentials_provider='AzureCredentialsProvider', user='brooke@myazure.org', password='Hunter2', idp_tenant='my_idp_tenant', client_id='my_client_id', client_secret='my_client_secret', preferred_role='arn:aws:iam:123:role/DataScientist' )

使用 AWS IAM Identity Center 身分提供者外掛程式進行身分驗證

以下是使用 IAM Identity Center AWS 身分提供者外掛程式進行身分驗證的範例。

with redshift_connector.connect( credentials_provider='BrowserIdcAuthPlugin', host='my-testing-cluster.abc.us-east-2.redshift.amazonaws.com', database='dev', idc_region='us-east-1', issuer_url='https://identitycenter.amazonaws.com/ssoins-790723ebe09c86f9', idp_response_timeout=60, listen_port=8100, idc_client_display_name='Test Display Name', # port value of 5439 is specified by default )

使用 Azure Browser 身分提供者外掛程式進行身分驗證

以下是使用 Azure Browser 身分提供者外掛程式來針對連線至 Amazon Redshift 資料庫的使用者進行驗證的範例。

由使用者提供登入憑據的瀏覽器會進行多重要素驗證。

>>>con = redshift_connector.connect( iam=True, database='dev', host='my-testing-cluster.abc.us-east-2.redshift.amazonaws.com', cluster_identifier='my-testing-cluster', credentials_provider='BrowserAzureCredentialsProvider', idp_tenant='my_idp_tenant', client_id='my_client_id', )

使用 Okta 身分提供者外掛程式進行身分驗證

以下是使用 Okta 身分提供者外掛程式進行身分驗證的範例。您可以透過 Okta 應用程式取得 idp_hostapp_idapp_name 的值。

>>> con = redshift_connector.connect( iam=True, database='dev', host='my-testing-cluster.abc.us-east-2.redshift.amazonaws.com', cluster_identifier='my-testing-cluster', credentials_provider='OktaCredentialsProvider', user='brooke@myazure.org', password='hunter2', idp_host='my_idp_host', app_id='my_first_appetizer', app_name='dinner_party' )

搭配使用 JumpCloud 與一般 SAML 瀏覽器身分提供者外掛程式來進行身分驗證

以下是搭配使用 JumpCloud 與一般 SAML 瀏覽器身分提供者外掛程式來進行身分驗證的範例。

密碼是必要參數。但是,您不必輸入此參數,因為瀏覽器會進行多重要素驗證。

>>> con = redshift_connector.connect( iam=True, database='dev', host='my-testing-cluster.abc.us-east-2.redshift.amazonaws.com', cluster_identifier='my-testing-cluster', credentials_provider='BrowserSamlCredentialsProvider', user='brooke@myjumpcloud.org', password='', login_url='https://sso.jumpcloud.com/saml2/plustwo_melody' )