无论如何,我们可以将 Secret Manager 的动态引用传递给AWS Launch Config 用户数据吗?
这是我尝试的代码片段:
"SampleLaunchConfig": {
"Type": "AWS::AutoScaling::LaunchConfiguration",
"Properties": {
"ImageId": {
"Fn::FindInMap": [
"AWSRegionArch2AMI",
{
"Ref": "AWS::Region"
},
"AMI"
]
},
"UserData": {
"Fn::Base64": {
"Fn::Join": [
"",
[
"#!/bin/bash -xe\n",
"yum update -y\n",
"useradd -p <<pwd>>{{resolve:secretsmanager:Credentials:SecretString:userName}}\n",
"\n"
]
]
}
}
}
}
获取 useradd 时似乎出错:无效的用户名 '{{resolve:secretsmanager:Credentials:SecretString:userName}}'
如何将 Secret Manager 密钥值传递给 cloudformation 用户数据?