

• 2026 年 4 月 30 日之後將不再提供 AWS Systems Manager CloudWatch Dashboard。客戶可以繼續使用 Amazon CloudWatch 主控台來檢視、建立和管理其 Amazon CloudWatch 儀表板，就像現在一樣。如需詳細資訊，請參閱 [Amazon CloudWatch Dashboard 文件](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Dashboards.html)。

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

# 在 Parameter Store 中使用共用參數
<a name="parameter-store-shared-parameters"></a>

共用進階參數可簡化在多帳戶環境中的組態資料管理。您可以集中存放和管理參數，並與需要參考這些參數 AWS 帳戶 的其他 共用這些參數。

Parameter Store 與 AWS Resource Access Manager (AWS RAM) 整合以啟用進階參數共用。 AWS RAM 是一種服務，可讓您與其他 AWS 帳戶 或透過 共用資源 AWS Organizations。

您可以透過建立資源共享 AWS RAM，與 共用您擁有的資源。資源共用指定要共用的資源、要授予的許可以及共用的消費者。消費者可包括：
+ 中的特定組織 AWS 帳戶 內部或外部 AWS Organizations
+ 中的組織單位 AWS Organizations
+ 其在 中的整個組織 AWS Organizations

如需 的詳細資訊 AWS RAM，請參閱*[AWS RAM 《 使用者指南》](https://docs.aws.amazon.com/ram/latest/userguide/)*。

本主題說明如何共用您擁有的參數，以及如何使用與您共用的參數。

**Topics**
+ [共用參數的先決條件](#prereqs)
+ [共用參數](#share)
+ [停止共享共用參數](#unshare)
+ [識別共用參數](#identify)
+ [存取共用參數](#accessing)
+ [共用參數的許可集](#sharing-permissions)
+ [共用參數的輸送量上限](#throughput)
+ [共用參數定價](#pricing)
+ [已關閉的跨帳戶存取 AWS 帳戶](#closed-accounts)

## 共用參數的先決條件
<a name="prereqs"></a>

必須符合下列先決條件，才能從帳戶共用參數：
+ 若要共用參數，您必須在 中擁有該參數 AWS 帳戶。您不能共用已與您共用的參數。
+ 若要共用參數，該參數必須位於進階參數層。如需有關參數方案的詳細資訊，請參閱[管理參數層](parameter-store-advanced-parameters.md)。如需有關將現有標準參數變更為進階參數的詳細資訊，請參閱[將標準參數變更為進階參數](parameter-store-advanced-parameters-enabling.md)。
+ 若要共用`SecureString`參數，必須使用客戶受管金鑰加密，而且您必須透過 分別共用金鑰 AWS Key Management Service。 AWS 受管金鑰 無法共用。使用預設值加密的參數 AWS 受管金鑰 可以更新為改用客戶受管金鑰。如需 AWS KMS 關鍵定義，請參閱《 *AWS Key Management Service 開發人員指南*》中的[AWS KMS 概念](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-mgmt)。
+ 若要與組織或 中的組織單位共用參數 AWS Organizations，您必須啟用與 共用 AWS Organizations。如需詳細資訊，請參閱《AWS RAM 使用者指南》**中的[透過 AWS Organizations啟用共用](https://docs.aws.amazon.com/ram/latest/userguide/getting-started-sharing.html#getting-started-sharing-orgs)。

## 共用參數
<a name="share"></a>

若要共用參數，必須將它新增至資源共用。資源共用是可讓您跨 共用資源 AWS RAM 的資源 AWS 帳戶。資源共享指定要共用的資源，以及共用它們的消費者。

當您與其他 共用您擁有的參數時 AWS 帳戶，您可以從兩個 AWS 受管許可中選擇授予取用者。如需詳細資訊，請參閱[共用參數的許可集](#sharing-permissions)。

如果您是 中組織的一部分， AWS Organizations 且已啟用組織內的共用，則可以授予組織中的取用者從 AWS RAM 主控台到共用參數的存取權。否則，取用者會收到加入資源共用的邀請，並且在接受邀請後便能存取共用的參數。

您可以使用 AWS RAM 主控台或 AWS CLI共用您擁有的參數。

**注意**  
雖然您可以使用 Systems Manager [PutResourcePolicy](https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_PutResourcePolicy.html) API 操作共用參數，但我們建議改用 AWS Resource Access Manager (AWS RAM)。這是因為使用 `PutResourcePolicy`需要使用 AWS RAM [PromoteResourceShareCreatedFromPolicy](https://docs.aws.amazon.com/ram/latest/APIReference/API_PromoteResourceShareCreatedFromPolicy.html) API 操作，將參數提升為標準資源共享的額外步驟。否則，Systems Manager [DescribeParameters](https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_DescribeParameters.html) API 操作不會使用 `--shared` 選項傳回參數。

**使用 AWS RAM 主控台共用您擁有的參數**  
請參閱《AWS RAM 使用者指南》**中的 [Creating a resource share in AWS RAM](https://docs.aws.amazon.com/ram/latest/userguide/working-with-sharing.html#working-with-sharing-create)。

完成該程序時，請進行下列選擇：
+ 在「步驟 1」頁面中，對於**資源**，選取 `Parameter Store Advanced Parameter`，然後選取要共用之進階參數方案中每個參數的方塊。
+ 在「步驟 2」頁面中，對於**受管許可**，選擇要授予取用者的許可，如稍後在本主題中的[共用參數的許可集](#sharing-permissions)所述。

根據您的參數共用目標選擇其他選項。

**使用 共享您擁有的參數 AWS CLI**  
使用 [https://docs.aws.amazon.com/cli/latest/reference/ram/create-resource-share.html](https://docs.aws.amazon.com/cli/latest/reference/ram/create-resource-share.html) 命令將參數新增至新資源共用。

使用 [https://docs.aws.amazon.com/cli/latest/reference/ram/associate-resource-share.html](https://docs.aws.amazon.com/cli/latest/reference/ram/associate-resource-share.html) 命令將參數新增至現有資源共用。

下列範例會建立新的資源共用，以與組織中及個別帳戶中的取用者共用參數。

```
aws ram create-resource-share \
    --name "MyParameter" \
    --resource-arns "arn:aws:ssm:us-east-2:123456789012:parameter/MyParameter" \
    --principals "arn:aws:organizations::123456789012:ou/o-63bEXAMPLE/ou-46xi-rEXAMPLE" "987654321098"
```

## 停止共享共用參數
<a name="unshare"></a>

當您停止共享共用參數時，取用者帳戶將無法再存取參數。

若要停止共用您擁有的參數，您必須從資源共用中移除該參數。您可以使用 Systems Manager 主控台、 AWS RAM 主控台或 AWS CLI來這樣做。

**使用 AWS RAM 主控台停止共用您擁有的參數**  
請參閱《AWS RAM 使用者指南》**中的 [Update a resource share in AWS RAM](https://docs.aws.amazon.com/ram/latest/userguide/working-with-sharing-update.html)。

**使用 停止共用您擁有的參數 AWS CLI**  
使用 [disassociate-resource-share](https://docs.aws.amazon.com/cli/latest/reference/ram/disassociate-resource-share.html) 命令。

## 識別共用參數
<a name="identify"></a>

擁有者和取用者可以使用 AWS CLI識別共用參數。

**使用 識別共用參數 AWS CLI**  
若要使用 識別共用參數 AWS CLI，您可以從 Systems Manager `[https://docs.aws.amazon.com/cli/latest/reference/ssm/describe-parameters.html](https://docs.aws.amazon.com/cli/latest/reference/ssm/describe-parameters.html)`命令和 AWS RAM `[list-resources](https://docs.aws.amazon.com/cli/latest/reference/ram/list-resources.html)`命令中進行選擇。

將 `--shared` 選項與 `describe-parameters` 搭配使用時，命令會傳回與您共用的參數。

以下是範例：

```
aws ssm describe-parameters --shared
```

## 存取共用參數
<a name="accessing"></a>

消費者可以使用 AWS 命令列工具和 AWS SDKs 存取共用參數。若為取用者帳戶，與該帳戶共用的參數不會包含在**我的參數**頁面中。

**CLI 範例：使用 存取共用參數詳細資訊 AWS CLI**  
若要使用 存取共用參數詳細資訊 AWS CLI，您可以使用 [https://docs.aws.amazon.com/cli/latest/reference/ssm/get-parameter.html](https://docs.aws.amazon.com/cli/latest/reference/ssm/get-parameter.html)或 [https://docs.aws.amazon.com/cli/latest/reference/ssm/get-parameters.html](https://docs.aws.amazon.com/cli/latest/reference/ssm/get-parameters.html)命令。您必須將完整參數 ARN 指定為 `--name`，才能從其他帳戶擷取參數。

下列是 範例。

```
aws ssm get-parameter \
    --name arn:aws:ssm:us-east-2:123456789012:parameter/MySharedParameter
```

**共用參數的支援和不支援整合**  
目前，您可以在下列整合案例中使用共用參數：
+ AWS CloudFormation [範本參數](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html#aws-ssm-parameter-types)
+ [AWS 參數和秘密 Lambda 延伸](ps-integration-lambda-extensions.md)
+ [Amazon Elastic Compute Cloud (EC2) 啟動範本](https://docs.aws.amazon.com/autoscaling/ec2/userguide/using-systems-manager-parameters.html)
+ 使用 [EC2 RunInstances 命令](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html)從 Amazon Machine Image (AMI) 建立執行個體的 `ImageID` 值
+ [擷取 Automation 執行手冊中的參數值](https://repost.aws/knowledge-center/systems-manager-parameter-store) (Automation 是 Systems Manager 中的工具)

下列案例與整合服務目前不支援使用共用參數：
+ Run Command (Systems Manager 中的工具) 中[命令中的參數](sysman-param-runcommand.md)
+ AWS CloudFormation [動態參考](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html)
+ 中的[環境變數值](https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec.env.parameter-store) AWS CodeBuild
+ 中的[環境變數值](https://docs.aws.amazon.com/apprunner/latest/dg/env-variable.html) AWS App Runner
+ Amazon Elastic Container Service 中的[秘密值](https://docs.aws.amazon.com/AmazonECS/latest/userguide/secrets-envvar-ssm-paramstore.html)

## 共用參數的許可集
<a name="sharing-permissions"></a>

取用者帳戶會取得您與其共用之參數的唯讀存取權。取用者無法更新或刪除參數。取用者無法與第三個帳戶共用參數。

當您在 中建立資源共用 AWS Resource Access Manager 以共用參數時，您可以從兩個 AWS 受管許可集合中選擇，以授予此唯讀存取權：

**AWSRAMDefaultPermissionSSMParameterReadOnly**  
允許的動作：`DescribeParameters`、`GetParameter`、`GetParameters`

**AWSRAMPermissionSSMParameterReadOnlyWithHistory**  
允許的動作：`DescribeParameters`、`GetParameter`、`GetParameters`、`GetParameterHistory`

按照《AWS RAM 使用者指南》** 中 [Creating a resource share in AWS RAM](https://docs.aws.amazon.com/ram/latest/userguide/working-with-sharing.html#working-with-sharing-create) 的步驟操作時，請根據您是否希望使用者檢視參數歷史記錄，選擇 `Parameter Store Advanced Parameters` 作為資源類型和其中一個受管許可。

**注意**  
如果您要以程式設計方式擷取共用參數 （例如使用 AWS Lambda)，您可能需要將 `ssm:GetResourcePolicies`和 `ssm:PutResourcePolicy`許可新增至呼叫 AWS Resource Access Manager API 動作的任何 IAM 角色。

## 共用參數的輸送量上限
<a name="throughput"></a>

Systems Manager 會限制 [https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_GetParameter.html](https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_GetParameter.html) 和 [https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_GetParameters.html](https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_GetParameters.html) 操作的輸送量上限 (每秒交易數)。輸送量會在個別帳戶層級強制執行。因此，每個使用共用參數的帳戶都可以使用其允許的輸送量上限，而不會受到其他帳戶的影響。如需有關參數輸送量上限的詳細資訊，請參閱下列主題：
+ [增加Parameter Store輸送量](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-throughput.html)
+ *Amazon Web Services 一般參考* 中的 [Systems Manager Service Quotas](https://docs.aws.amazon.com/general/latest/gr/ssm.html#limits_ssm)。

## 共用參數定價
<a name="pricing"></a>

跨帳戶共用僅可在進階參數方案中使用。對於進階參數，會依每個進階參數*儲存*和 *API 用量*的目前價格產生費用。擁有帳戶需要支付進階參數的儲存費用。對共用進階參數進行 API 呼叫的任何耗用帳戶需要支付參數用量的費用。

例如，如果帳戶 A 建立進階參數 `MyAdvancedParameter`，該帳戶每月需要支付 0.05 美元以儲存參數。

接著帳戶 A 會與帳戶 B 和帳戶 C 共用 `MyAdvancedParameter`。在一個月內，這三個帳戶會呼叫 `MyAdvancedParameter`。下表說明每個帳戶進行的呼叫次數所產生的費用。

**注意**  
下表中的費用僅供說明使用。若要確認目前的定價，請參閱 [AWS Systems ManagerParameter Store 的定價](https://aws.amazon.com/systems-manager/pricing/#Parameter_Store)。


| 帳戶 | 呼叫次數 | 費用 | 
| --- | --- | --- | 
| 帳戶 A (擁有帳戶) | 10,000 次呼叫 |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/systems-manager/latest/userguide/parameter-store-shared-parameters.html)  | 
| 帳戶 B (耗用帳戶) | 20,000 次呼叫 |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/systems-manager/latest/userguide/parameter-store-shared-parameters.html)  | 
| 帳戶 C (耗用帳戶) | 30,000 次呼叫 |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/systems-manager/latest/userguide/parameter-store-shared-parameters.html)  | 

## 已關閉的跨帳戶存取 AWS 帳戶
<a name="closed-accounts"></a>

如果關閉 AWS 帳戶 擁有共用參數的 ，則所有取用帳戶都會失去共用參數的存取權。如果擁有帳戶在帳戶關閉後 90 天內重新開啟，則耗用帳戶會重新取得對先前共用參數的存取權。如需在關閉後期間重新開啟帳戶的詳細資訊，請參閱《 *AWS 帳戶管理 參考指南*》中的在[關閉 AWS 帳戶 之後存取您的](https://docs.aws.amazon.com/accounts/latest/reference/manage-acct-closing.html#accessing-after-closure) 。