“Fn :: Join”和参数中的分隔符?

时间:2015-04-16 06:23:12

标签: amazon-web-services amazon-cloudformation

我试图参数化Fn :: Join使用的分隔符,例如起初我有:

"Name" : { "Fn::Join" : [ ".", [ 
           { "Ref":"serviceName"}, { "Ref": "environment" } ] ] },

哪个效果很好,但之后我将其更改为:

"Name" : { "Fn::Join" : [ {"Ref":"HostNameSeparator"}, [
           { "Ref":"serviceName"}, { "Ref": "environment" } ] ] },

我从验证阶段得到以下错误:

A client error (ValidationError) occurred when calling the
ValidateTemplate operation: Template error: every Fn::Join object
requires two parameters, (1) a string delimiter and (2) a list of
strings to be joined or a function that returns a list of strings
(such as Fn::GetAZs) to be joined.

是否可以做我想要的,即将Join delimiter作为模板参数传递?

(为了清楚起见,我已经缩短了上面的例子,请忽略拼写错误)

1 个答案:

答案 0 :(得分:2)

您可以使用CustomResource实现此目的。 此CloudFormation模板已准备好运行,并说明了它的工作原理。分隔符作为参数传递,您将在堆栈的输出中找到连接的字符串。

UITextView