Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use cloudformation parameter in userdata

I have zookeeper connect as ip1:port1,ip2:port2,ip3:port3 and I want to use this in my userdata How can i do it?

"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",

I want to use ZooKeeperConnect values in my userdata

like image 316
chiru Avatar asked Oct 19 '22 04:10

chiru


1 Answers

You can reference the ZooKeeperConnect parameter or any other parameter in your userdata section:

"UserData" : {
    "Fn::Base64" : {
        "Fn::Join" : [ ",", [
            { "Ref" : "MyValue" },
            { "Ref" : "MyName" },
            "Hello World" ] ]
    }
}

The above snippet was taken from http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-general.html.

like image 110
jzonthemtn Avatar answered Oct 21 '22 06:10

jzonthemtn