

• AWS Systems Manager CloudWatch 控制面板在 2026 年 4 月 30 日之后将不再可用。客户可以像现在一样继续使用 Amazon CloudWatch 控制台来查看、创建和管理其 Amazon CloudWatch 控制面板。有关更多信息，请参阅 [Amazon CloudWatch 控制面板文档](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Dashboards.html)。

# AWS Systems Manager Parameter Store
<a name="systems-manager-parameter-store"></a>

Parameter Store 使您能够安全地大规模存储、组织和检索简单的配置数据。它旨在简化跨环境的配置管理，使团队能够标准化应用程序访问关键数据的方式，而无需对值进行硬编码或依赖片段化存储解决方案。

除了简单的存储之外，Parameter Store 还提供版本控制、通过 AWS Identity and Access Management（IAM）进行访问控制，以及与 Amazon EC2、Lambda 和 CloudFormation 等其他 AWS 服务无缝集成。这样一来，无需更改代码或重新部署即可实现动态配置更新，从而提高运营灵活性并降低风险。凭借分层命名、参数策略和变更跟踪等功能，Parameter Store 可帮助团队保持一致性、强制治理并构建更安全、更易于维护的系统。

Parameter Store 支持 `String`、`StringList` 和 `SecureString` 参数类型。`String` 和 `StringList` 参数值以明文形式存储。`SecureString` 参数使用 AWS Key Management Service 加密值，因此对于不需要轮换或其他高级密钥生命周期功能的轻量级加密配置值来说是理想的选择。有关参数类型的更多信息，请参阅[了解参数类型](what-is-a-parameter.md)

**注意**  
如果您管理需要自动轮换、跨账户访问或精细审核日志记录的凭证，则建议使用 [AWS Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html)。Secrets Manager 专为管理数据库凭证、API 密钥和受支持的第三方软件提供的密钥等密钥而设计。有关更多信息，请参阅《AWS Secrets Manager 用户指南》**中的[什么是 AWS Secrets Manager？](https://docs.aws.amazon.com//secretsmanager/latest/userguide/intro.html)。

下面是一些您可以在 Parameter Store 中存储和管理的配置数据类型的示例：
+ **数据库连接字符串（非轮换）**：jdbc:mysql://host:3306/appdb
+ **应用程序环境变量**：ENV=production、LOG\_LEVEL=debug
+ **服务端点 URL**：内部微服务端点或第三方基本 URL
+ **资源标识符**：S3 存储桶名称、DynamoDB 表名、ARN
+ **应用程序调整参数**：缓存 TTL、批次大小、轮询间隔

**注意**  
*不*建议将 Parameter Store 用于以下类型的配置数据：  
功能标志
超时等操作杠杆
允许列表和屏蔽列表
断路器
动态配置
对于这类配置数据，请使用 AWS AppConfig。有关更多信息，请参阅[什么是 AWS AppConfig？](https://docs.aws.amazon.com/appconfig/latest/userguide/what-is-appconfig.html)。

## Parameter Store 特征
<a name="parameter-store-features"></a>

Parameter Store 包含以下用于管理参数的功能：
+ **与其他账户共享参数**

  将配置数据集中保管在单个 AWS 账户中，并与其他需要访问权限的账户共享参数。有关更多信息，请参阅 [使用 Parameter Store 中的共享参数](parameter-store-shared-parameters.md)。
+ **操作系统修补**

  Amazon EC2 允许您通过[引用参数而不是对 AMI（AMI）ID](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-systems-manager-parameter-to-find-AMI.html.html) 进行硬编码来指定新实例的操作系统。这种方法可确保您的实例自动使用最新的已修补和更新的映像。AWS 和操作系统供应商提供用于跟踪当前 AMI 版本的[公共参数](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-finding-public-parameters.html)，因此您无需手动管理更新。您还可以定义自己的参数来引用集中管理的黄金 AMI，从而更轻松地在整个组织内强制执行一致的、经批准的配置。
+ **可从其他 AWS 服务访问**

  其他 AWS 服务允许您轻松引用参数值。下面是一些示例：
  + Lambda 函数可以使用[参数和密钥 Lambda 扩展](https://docs.aws.amazon.com/systems-manager/latest/userguide/ps-integration-lambda-extensions.html)来检索参数和密钥。
  + Amazon Elastic Container Service 和 AWS Fargate 允许您[注入环境变量](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/secrets-envvar-ssm-paramstore.html)，这些变量的值在 Parameter Store 中集中管理。
  + AWS CloudFormation 模板可以引用[参数值](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references-ssm.html)。
  + AWS AppConfig 使您能够创建[引用参数的配置文件](https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-creating-free-form-configuration-and-profile-create-console.html)，从而允许您使用逐步推出、基于警报的回滚和内置数据验证等功能安全地部署配置更改。
  + AWS CodeBuild 允许您[定义环境变量](https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec.env.parameter-store)，这些变量的值会在构建时从 Parameter Store 中动态检索。
+ **参数历史记录**

  Parameter Store 保留每个参数的 100 个最新[版本](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-paramstore-versions.html)，因此在调查操作问题时，您可以快速查看和重建以前的值。
+ **事件和通知**

  通过订阅参数[更改事件](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-paramstore-cwe.html)来实现 Parameter Store 中工作流的自动化。您还可以使用[更改事件](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-policies.html)来强制执行过期，并在参数未在指定的时间范围内轮换时接收通知。
+ **按层次组织参数**

  使用[参数层次结构](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-paramstore-hierarchies.html)对相关参数进行分组，从而更轻松地在各种环境和应用程序中发现、管理和筛选参数。

## 参数层
<a name="parameter-store-tiers-introduction"></a>

Parameter Store 提供多个影响成本、规模和性能的参数层。需单独配置参数以使用标准参数层（默认层）或高级参数层。

使用:
+ 对大多数配置数据和低规模工作负载使用标准参数
+ 当您需要更高限制、更大值或参数策略时使用高级参数

**重要**  
您可以将参数从标准升级到高级，但不能降级。

下表介绍了参数层之间的区别。


****  

| 功能 | 标准 | 高级 | 
| --- | --- | --- | 
| 最大参数<br />（每个 AWS 账户和 AWS 区域） | 10000 | 100000 | 
| 最大值大小 | 4 KB | 8 KB | 
| 参数策略 | 不支持 | 支持<br />有关更多信息，请参阅 [在 Parameter Store 中分配参数策略](parameter-store-policies.md)。 | 
| 跨 AWS 账户共享参数 | 不支持 | 支持<br />有关更多信息，请参阅 [使用 Parameter Store 中的共享参数](parameter-store-shared-parameters.md)。 | 
| 成本 | 无额外费用 | 需支付费用<br />有关更多信息，请参阅 [Parameter Store 的 AWS Systems Manager 定价](https://aws.amazon.com/systems-manager/pricing/#Parameter_Store)。 | 

有关参数层及其功能的更多信息，请参阅 [管理层](parameter-store-advanced-parameters.md)。

有关 Parameter Store 配额和限制的完整列表，请参阅《*AWS 一般参考*》中的 [AWS Systems Manager endpoints and quotas](https://docs.aws.amazon.com/general/latest/gr/ssm.html#parameter-store)。

## 性能和吞吐量
<a name="parameter-store-performance-and-throughput"></a>

Parameter Store 提供适用于低规模工作负载的默认吞吐量。对于需要更高请求速率的应用程序，您可以启用更高吞吐量。
+ 默认吞吐量足以满足典型配置检索模式的需求。
+ 高吞吐量模式支持明显更高的请求速率，适用于大规模或对延迟敏感的应用程序。
+ 启用更高吞吐量时，将收取额外费用。

如果应用程序频繁或大规模地检索参数，请尽早评估吞吐量设置以避免节流。有关启用高吞吐量的信息，请参阅[更改 Parameter Store 吞吐量](parameter-store-throughput.md)。

## 如何检索参数
<a name="parameter-store-how-to-retrieve"></a>

您可以使用 AWS 管理控制台、AWS CLI 或 AWS SDK 从 Parameter Store 中检索参数以调用以下 API 操作：
+ [GetParameter](https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_GetParameter.html)
+ [GetParameters](https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_GetParameters.html)
+ [API\_GetParametersByPath](https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_GetParametersByPath.html)

**AWS CLI**：下表包含 Parameter Store 的示例 AWS CLI 命令。


****  

| 命令 | 用法 | 适用场景 | 
| --- | --- | --- | 
| get-parameter | aws ssm get-parameter --name "{{name}}" | 获取一个特定参数值。 | 
| get-parameter | aws ssm get-parameter --name "{{name}}" --with-decryption | 获取 `SecureString` 参数类型。注意：必须包含 `--with-decryption` 标志才能看到明文值；否则，您将只收到加密的元数据。 | 
| get-parameters | aws ssm get-parameters --names "{{name1}}" "{{name2}}" | 一次最多获取 10 个特定不相关的参数。 | 
| get-parameters-by-path | aws ssm get-parameters-by-path --path "{{/my/app/path/}}" | 批量检索整个环境的配置。 | 
| get-parameter-history | aws ssm get-parameter-history --name "{{name}}" | 检查某个值随时间的变化情况。 | 

**SDK（例如 Boto3 for Python）**：在应用程序代码中使用 `get_parameter()` 或 `get_parameters_by_path()` 等方法在运行时获取值。

**CDK 和 CloudFormation**：
+ **AWS CDK**：在合成或部署期间使用 `valueForStringParameter` 或 `valueFromLookup` 读取值。
+ **CloudFormation**：使用动态引用（例如 `{{resolve:ssm:parameter-name:version}}`）将值直接注入模板。

**注意**  
对于大多数动态参数引用，您可以使用以下惯例指定参数名称：  
{{`ssm:{{parameter-name}}`}}

要开始使用Parameter Store，请参阅[设置 Parameter Store](parameter-store-setting-up.md)。