

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# AWS Secrets Manager 用于跟踪数据库密码或第三方 API 密钥
<a name="parameter-store-encryption"></a>

我们建议您使用 AWS Secrets Manager 在数据库凭证、API 密钥和其他**密**钥的整个生命周期中轮换、管理和检索它们。Secrets Manager 使您可以将代码中的硬编码凭证（包括密码）替换为对 Secrets Manager 的 API 调用，以便以编程方式检索密钥。有关更多信息，请参阅[什么是 S AWS ecrets Manager？](https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html) 在 S *AWS ecrets Manager 用户指南*中。

对于在模板中传递作为机密的参数（例如 OAuth 证书）的管道，您应在 CloudFormation 模板中包含用于访问存储在 Secrets Manager 中的密钥的动态引用。有关引用 ID 模式和示例，请参阅 *AWS CloudFormation 用户指南* 中的 [Secrets Manager 密钥](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html#dynamic-references-secretsmanager)。有关在管道中 web GitHub hook 的模板片段中使用动态引用的示例，请参阅 [Webhook 资源配置](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-webhook.html#aws-resource-codepipeline-webhook--examples)。



## 另请参阅
<a name="related-resources-managing-secrets"></a>

下列相关资源可以帮助您管理密钥。
+ Secrets Manager 可以自动轮换数据库凭证，例如用于轮换 Amazon RDS 密钥。有关更多信息，请参阅 S [AWS ecrets Manager 用户指南中的轮换](https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets.html) *S AWS ecrets Manager 密钥*。
+ 要查看有关向 CloudFormation 模板添加 Secrets Manager 动态引用的说明，请参阅 [https://aws.amazon.com/blogs/security/how-to-create-and-retrieve-secrets-managed-in-aws-secrets-manager-using-aws-cloudformation-template/](https://aws.amazon.com/blogs/security/how-to-create-and-retrieve-secrets-managed-in-aws-secrets-manager-using-aws-cloudformation-template/)。