我正在尝试实现相同的目标,但对于 Parameter Store。我的场景是,开发人员将提供一个带有键/值的 .json 文件。CloudFormation 模板应使用该文件根据作为 json 文件创建的条目创建 Parameter Store 资源。
主模板 -
{
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters": {
"SSMParameterStore": {
"Description": "SSM Parameter Store",
"Type": "String"
}
},
"Resources": {
"InputParameters": {
"Type": "AWS::SSM::Parameter",
"Properties": {
"Name": {"Ref": "ParameterKey"},
"Type": "String",
"Value": {"Ref": "ParameterValue"}
}
}
}
}
输入模板 -
[{
"ParameterKey": "KeyPairName",
"ParameterValue": "MyKey"
},
{
"ParameterKey": "InstanceType",
"ParameterValue": "m1.micro"
}
]
命令:
aws cloudformation create-stack --stack-name test --template-body file:///home/user/Documents/Work/training/test/templt.json --parameters file:///home/user/Documents/Work/training/test/test.json --region us-east-1
输出:
An error occurred (ValidationError) when calling the CreateStack operation: Parameters: [SSMParameterStore] must have values
不确定这里缺少什么。