带有 CloudFormation 的 AWS SSM 参数存储

AWS SSM Parameter Store with CloudFormation

从 CFN 文档中我可以看到我可以创建一个 AWS::SSM::Parameter. I also see how I can create a KMS Master Key

但是文档页面中 SSM:Parameter 上的 type 参数没有列出 secure string 类型。

有没有一种方法可以在 cloudformation 模板中执行以下操作:

1) create KMS Key
2) use KMS key to encrypt a param
3) pull that param in User-Data for an EC2 instance

我将 运行 来自 Jenkins 作业的 CFN 模板,其中包含 jenkins 密码参数中的参数值。我还可以在模板的参数上设置 "NoEcho": true,这样它就不会在 CloudFormation 控制台中回显。

似乎有一种方法可以使用 custom resource 来做到这一点。结合 lambda 函数。

已添加对此的支持,因此您不再需要使用自定义资源。您必须使用对安全参数的动态引用。

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html

使用此功能,您可以将 {{resolve:ssm-secure:parameter-name:version}} 添加到 Fn::Join CF 内在的用户数据中。

截至 2019 年 4 月,安全字符串不可用作 cloudformation 模板中的参数类型,但文档指出 CloudFormation will support the Parameter Store ‘SecureString’ type in a later release.

https://aws.amazon.com/blogs/mt/integrating-aws-cloudformation-with-aws-systems-manager-parameter-store/