

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

# AWS STS 區域端點
<a name="feature-sts-regionalized-endpoints"></a>

**注意**  
如需了解設定頁面配置或解譯以下 **Support AWS SDKs和工具**資料表的說明，請參閱 [了解本指南的設定頁面](settings-reference.md#settingsPages)。

 AWS Security Token Service (AWS STS) 提供全球和區域服務。有些 AWS SDKs 和 CLIs 預設使用全域服務端點 (`https://sts.amazonaws.com`)，有些則使用區域服務端點 (`https://sts.{region_identifier}.{partition_domain}`)。在[預設啟用](https://docs.aws.amazon.com/accounts/latest/reference/manage-acct-regions.html)的區域中，對 AWS STS 全域端點的請求會在請求產生的相同區域中自動提供。在選擇加入區域中，全域 AWS STS 端點的請求由單一 AWS 區域美國東部 （維吉尼亞北部） 提供。如需 AWS STS 端點的詳細資訊，請參閱*AWS Security Token Service 《 API 參考*》中的[端點](https://docs.aws.amazon.com/STS/latest/APIReference/welcome.html#sts-endpoints)或《 *AWS Identity and Access Management 使用者指南*[AWS STS 》中的管理 AWS 區域](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html)。

 AWS 最佳實務是盡可能使用區域端點並設定您的 [AWS 區域](feature-region.md)。商業 以外[分割區](https://docs.aws.amazon.com/glossary/latest/reference/glos-chap.html?id=docs_gateway#partition)中的客戶必須使用區域端點。並非所有 SDKs和工具都支援此設定，但所有 都已定義全球和區域端點的行為。如需詳細資訊，請參閱下一節。

**注意**  
AWS 已對[依預設啟用](https://docs.aws.amazon.com/accounts/latest/reference/manage-acct-regions.html)的區域中的 AWS Security Token Service (AWS STS) 全域端點 (`https://sts.amazonaws.com`) 進行變更，以增強其彈性和效能。對全域端點的 AWS STS 請求會在與您的工作負載 AWS 區域 相同的 中自動提供。這些變更不會部署至選擇加入區域。我們建議您使用適當的 AWS STS 區域端點。如需詳細資訊，請參閱*AWS Identity and Access Management 《 使用者指南*》中的[AWS STS 全域端點變更](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_region-endpoints.html#reference_sts_global_endpoint_changes)。

對於支援此設定的 SDKs 和工具，客戶可以使用下列項目來設定功能：

**`sts_regional_endpoints` - 共用 AWS `config`檔案設定`AWS_STS_REGIONAL_ENDPOINTS` - 環境變數**  
此設定指定 SDK 或工具如何決定用來與 AWS 服務 AWS Security Token Service () 通訊的端點AWS STS。  
**預設值：**`regional`，請參閱下表中的例外狀況。  
2022 年 7 月之後發行的所有新 SDK 主要版本都將預設為 `regional`。新的 SDK 主要版本可能會移除此設定並使用`regional`行為。為了降低此變更的未來影響，我們建議您盡可能`regional`在應用程式中開始使用 。
**有效值：**   *（建議值：`regional`)*   
+ **`legacy`** – 使用全域 AWS STS 端點 `sts.amazonaws.com`。
+ **`regional`** – SDK 或工具一律使用目前設定區域的 AWS STS 端點。例如，如果用戶端設定為使用 `us-west-2`，則對 的所有呼叫 AWS STS 都會對區域端點 進行`sts.us-west-2.amazonaws.com`，而不是全域`sts.amazonaws.com`端點。若要在啟用此設定的同時，將請求傳送至全域端點，您可以將區域設為 `aws-global`。
在 `config` 檔案中設定這些值的範例：  

```
[default]
sts_regional_endpoints = regional
```
透過命令列設定環境變數的 Linux/macOS 範例：  

```
export AWS_STS_REGIONAL_ENDPOINTS=regional
```
透過命令列設定環境變數的 Windows 範例：  

```
setx AWS_STS_REGIONAL_ENDPOINTS regional
```

## 支援 AWS SDKs和工具
<a name="feature-sts-regionalized-endpoints-sdk-compat"></a>

**注意**  
 AWS 最佳實務是盡可能使用區域端點並設定您的 [AWS 區域](feature-region.md)。

 以下資料表摘要說明 SDK 或工具：
+ **支援設定**：是否支援 STS 區域端點的共用`config`檔案變數和環境變數。
+ **預設設定值**：如果支援，則設定的預設值。
+ **預設服務用戶端目標 STS 端點**：用戶端使用什麼預設端點，即使變更它的設定不可用。
+ **服務用戶端備用行為**：軟體開發套件應該使用區域端點，但未設定區域時所執行的動作。這是行為，無論它是否因為預設值而使用區域端點，還是因為 `regional` 已由 設定選取。

資料表也會使用下列值：
+ **全域端點**：`https://sts.amazonaws.com`。
+ **區域端點**：根據您應用程式[AWS 區域](feature-region.md)所使用的設定。
+ **`us-east-1` （區域）**：使用`us-east-1`區域端點，但具有比一般全域請求更長的工作階段字符。


| SDK |  支援設定  |  預設設定值  |  預設服務用戶端目標 STS 端點  |  服務用戶端備用行為  | 備註或更多資訊 | 
| --- | --- | --- | --- | --- | --- | 
| [AWS CLI  ](https://docs.aws.amazon.com/cli/latest/userguide/) v2 | 否 | N/A | 區域 (Region) 端點 | 全域端點 |  | 
| [AWS CLI v1](https://docs.aws.amazon.com/cli/v1/userguide/cli-chap-welcome.html) | 是 | legacy | 全域端點 | 全域端點 |  | 
| [適用於 C\$1\$1 的 SDK](https://docs.aws.amazon.com/sdk-for-cpp/latest/developer-guide/) | 否 | N/A | 區域 (Region) 端點 | us-east-1 （區域） |  | 
| [SDK for Go V2 (1.x)](https://docs.aws.amazon.com/sdk-for-go/v2/developer-guide/) | 否 | N/A | 區域 (Region) 端點 | 請求失敗 |  | 
| [適用於 Go 的 SDK 1.x (V1)](https://docs.aws.amazon.com/sdk-for-go/latest/developer-guide/) | 是 | legacy | 全域端點 | 全域端點 | 若要使用共用config檔案設定，您必須開啟從組態檔案載入；請參閱[工作階段](https://docs.aws.amazon.com/sdk-for-go/api/aws/session/)。 | 
| [適用於 Java 的 SDK 2.x](https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/) | 否 | N/A | 區域 (Region) 端點 | 請求失敗 |  如果未設定區域， `AssumeRole`和 `AssumeRoleWithWebIdentity`將使用全域 STS 端點。  | 
| [適用於 Java 的 SDK 1.x](https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/) | 是 | legacy | 全域端點 | 全域端點 |  | 
| [適用於 JavaScript 3.x 的 SDK](https://docs.aws.amazon.com/sdk-for-javascript/latest/developer-guide/) | 否 | N/A | 區域 (Region) 端點 | us-east-1 （區域） |  | 
| [適用於 JavaScript 2.x 的 SDK](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/) | 是 | legacy | 全域端點 | 全域端點 |  | 
| [適用於 Kotlin 的 SDK](https://docs.aws.amazon.com/sdk-for-kotlin/latest/developer-guide/) | 否 | N/A | 區域 (Region) 端點 | 全域端點 |  | 
| [適用於 .NET 4.x 的 SDK](https://docs.aws.amazon.com/sdk-for-net/latest/developer-guide/) | 否 | N/A | 區域 (Region) 端點 | us-east-1 （區域） |  | 
| [適用於 .NET 3.x 的 SDK](https://docs.aws.amazon.com/sdk-for-net/v3/developer-guide/) | 是 | regional | 全域端點 | 全域端點 |  | 
| [適用於 PHP 的 SDK 3.x](https://docs.aws.amazon.com/sdk-for-php/latest/developer-guide/) | 是 | regional | 全域端點 | 請求失敗 |  | 
| [適用於 Python 的 SDK (Boto3)](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/quickstart.html) | 是 | regional | 全域端點 | 全域端點 |  | 
| [適用於 Ruby 的 SDK 3.x](https://docs.aws.amazon.com/sdk-for-ruby/latest/developer-guide/) | 是 | regional | 區域 (Region) 端點 | 請求失敗 |  | 
| [適用於 Rust 的 SDK](https://docs.aws.amazon.com/sdk-for-rust/latest/dg/) | 否 | N/A | 區域 (Region) 端點 | 請求失敗 |  | 
| [適用於 Swift 的 SDK](https://docs.aws.amazon.com/sdk-for-swift/latest/developer-guide/) | 否 | N/A | 區域 (Region) 端點 | 請求失敗 |  | 
| [PowerShell V5 的工具](https://docs.aws.amazon.com/powershell/latest/userguide/) | 是 | regional | 全域端點 | 全域端點 |  | 
| [PowerShell V4 的工具](https://docs.aws.amazon.com/powershell/v4/userguide/) | 是 | regional | 全域端點 | 全域端點 |  | 