[英]Can I use "Fn::Join" in "Parameters" of AWS Cloudformation json template
I want to use in Parameters of Cloudformation json template shortcut of some Policy/Loadbalancers tags name, like that:我想在一些 Policy/Loadbalancers 标签名称的 Cloudformation json 模板快捷方式的参数中使用,如下所示:
"SomeScalingGroupName": {
"Type": "String",
"Default": {"Fn::Join": ["", ["Process-", {"Ref": "Env"}, "-Some-Worker-Name"]]}
},
And I get error:我得到错误:
Template validation error: Template format error: Every Default member must be a string.模板验证错误:模板格式错误:每个默认成员都必须是字符串。
So my question if that proper way to use function join in Parameters?所以我的问题是在参数中使用函数连接的正确方法吗? Or I they have any other way to do that?或者我他们有其他方法可以做到这一点? Or you have any better suggestions to using that?或者您对使用它有什么更好的建议?
Thanks!谢谢!
You cannot use intrinsic functions within the parameters section of your template.您不能在模板的参数部分中使用内部函数。
You can use intrinsic functions only in specific parts of a template.您只能在模板的特定部分使用内部函数。 Currently, you can use intrinsic functions in resource properties, metadata attributes, and update policy attributes.目前,您可以在资源属性、元数据属性和更新策略属性中使用内部函数。
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html
You will need use this function within your resource properties.您将需要在资源属性中使用此功能。 For example:例如:
"Parameters" : {
"Env" : {
"Type" : "String",
"Default" : "test"
},
"WorkerName" : {
"Type" : "String",
"Default" : "my-worker"
}
}
"Resources" : {
"LoadBalancer" : {
"Type" : "AWS::ElasticLoadBalancing::LoadBalancer",
...
"Properties" : {
"Tags" : [
{ "Key" : "Name", "Value": { "Fn::Join" : [ "-", [ "process", { "Ref" : "Env" }, { "Ref" : "SomeWorkerName" }]]}},
]
}
}
}
This will apply a 'Name' tag to your Load Balancer with a value of 'process-test-my-worker'.这会将“名称”标签应用到您的负载均衡器,其值为“process-test-my-worker”。 You can also use this same function anywhere else within the properties of your resources.您还可以在资源属性内的任何其他位置使用相同的功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.