使用 AWS CloudFormation 创建 AWS Secrets Manager 密钥
此示例将创建一个名为 CloudFormationCreatedSecret-
的密钥。密码值是下面的 JSON,其中包含一个 32 个字符的密码,该密码是在创建密钥时生成的。a1b2c3d4e5f6
{ "password": "
EXAMPLE-PASSWORD
", "username": "saanvi" }
此示例使用以下 CloudFormation 资源:
有关使用 AWS CloudFormation 创建资源的信息,请参阅《AWS CloudFormation 用户指南》中的了解模板基础知识。
JSON
{ "Resources": { "CloudFormationCreatedSecret": { "Type": "AWS::SecretsManager::Secret", "Properties": { "Description": "Simple secret created by AWS CloudFormation.", "GenerateSecretString": { "SecretStringTemplate": "{\"username\": \"saanvi\"}", "GenerateStringKey": "password", "PasswordLength": 32 } } } } }
YAML
Resources: CloudFormationCreatedSecret: Type: 'AWS::SecretsManager::Secret' Properties: Description: Simple secret created by AWS CloudFormation. GenerateSecretString: SecretStringTemplate: '{"username": "saanvi"}' GenerateStringKey: password PasswordLength: 32