在用户数据中使用cloudformation参数

chi*_*iru 6 parameters amazon-web-services user-data aws-cloudformation

我有 Zookeeper 连接为 ip1:port1,ip2:port2,ip3:port3 我想在我的用户数据中使用它我该怎么做?

"ZooKeeperConnect": {
         "Type": "String",
         "Description": "list of IP or CNAME's for the associated zookeeper ensemble",
         "AllowedPattern": "([1-9][0-9]?|[1-2][0-9]{2})(\\.([1-9][0-9]?|[1-2][0-9]{2})){3}(:[1-9][0-9]{1,4})?(,([1-9][0-9]?|[1-2][0-9]{2})(\\.([1-9][0-9]?|[1-2][0-9]{2})){3}(:[1-9][0-9]{1,4})?)*"
       }


"UserData": {
         "Fn::Base64": {
           "Fn::Join": [
             "",
             [
               "#!/bin/bash \n",
               "echo Cache proxy vars... \n",
Run Code Online (Sandbox Code Playgroud)

我想在我的用户数据中使用 ZooKeeperConnect 值

jzo*_*mtn 3

您可以ZooKeeperConnect在用户数据部分引用该参数或任何其他参数:

"UserData" : {
    "Fn::Base64" : {
        "Fn::Join" : [ ",", [
            { "Ref" : "MyValue" },
            { "Ref" : "MyName" },
            "Hello World" ] ]
    }
}
Run Code Online (Sandbox Code Playgroud)

上面的代码片段取自http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-general.html