

 Amazon Redshift 將不再支援從修補程式 198 開始建立新的 Python UDFs。現有 Python UDF 將繼續正常運作至 2026 年 6 月 30 日。如需詳細資訊，請參閱[部落格文章](https://aws.amazon.com/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/)。

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

# 設定 Amazon Redshift CLI
<a name="setting-up-rs-cli"></a>

本節說明如何設定和執行 AWS CLI 命令列工具，以用於管理 Amazon Redshift。Amazon Redshift 命令列工具會在 AWS Command Line Interface (AWS CLI) 上執行，而後者又使用 Python ([https://www.python.org/](https://www.python.org)：//)。 AWS CLI 可在支援 Python 的任何作業系統上執行。

## 安裝 AWS Command Line Interface
<a name="setting-up.installing-the-tools"></a>

若要開始使用 Amazon Redshift 命令列工具，請先設定 AWS CLI，然後新增定義 Amazon Redshift CLI 選項的組態檔案。

如果您已經 AWS CLI 為其他服務安裝並設定 AWS ，您可以略過此程序。

**安裝 AWS Command Line Interface**

1. 前往[安裝或更新至最新版本的 AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-set-up.html)，然後遵循安裝 的指示 AWS CLI。

   對於 CLI 存取，您需要存取金鑰 ID 和私密存取金鑰。盡可能使用臨時憑證，而不是長期存取金鑰。臨時憑證包含存取金鑰 ID、私密存取金鑰，以及指出憑證何時到期的安全符記。如需詳細資訊，請參閱《*IAM 使用者指南*》中的[將臨時登入資料與 AWS 資源](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_use-resources.html)搭配使用。

1. 建立包含組態資訊 (例如您的存取金鑰、預設區域和命令輸出格式) 的檔案。然後設定 `AWS_CONFIG_FILE` 環境變數來參考該檔案。如需詳細說明，請參閱 AWS Command Line Interface 《 使用者指南》中的[設定 AWS 命令列界面](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html)。

1. 執行測試命令以確認 AWS CLI 介面是否正常運作。例如，下列命令應會顯示 AWS CLI協助資訊：

   ```
   aws help
   ```

   下列命令應會顯示 Amazon Redshift 協助資訊：

   ```
   aws redshift help
   ```

如需有關 Amazon Redshift CLI 命令的參考資料，請前往《 AWS CLI 參考》中的 [Amazon Redshift](https://docs.aws.amazon.com/cli/latest/reference/redshift/index.html)。