Hello Experts,
I have written a code to bootstrap my application and it is failing becasue it is not executing as expected. Command is as follows in my json template,
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [
"#!/bin/bash -v\n",
"apt-get upgrade -y\n",
"# Install packages\n",
"/usr/bin/cloud-init -s ", { "Ref" : "AWS::StackName" },
" --region ", { "Ref" : "AWS::Region" },
"# Install the Application and packages from the metadata\n",
"sudo sh /var/www/html/app/bin/setupscript \n",
"-u", {"Ref" : "URL"},
"-f", {"Ref" : "FirstName"},
"-l", {"Ref" : "LastName"},
"-e", {"Ref" : "Email"},
"-p", {"Ref" : "Password"},
"-c", {"Ref" : "CountryCode"},
"-s", {"Ref" : "StateCode"},
"-t", {"Ref" : "City"},
"-o", {"Ref" : "OrgName"},
"-r", {"Fn::GetAtt" : [ "ElasticLoadBalancer", "DNSName" ]},
"-d", {"Ref" : "DBName"},
"-a", {"Ref" : "DBUser"},
"-b", {"Ref" : "DBPassword"},
"-h", { "Fn::GetAtt" : [ "DBInstance", "Endpoint.Address" ] }
]]}}
Now it does execute but not as expected. This is what i get in the backend,
root@ip-10-0-1-252:/var/lib/cloud/instance# cat user-data.txt
#!/bin/bash -v
apt-get upgrade -y# Install packages
/usr/bin/cloud-init -s Stack --region us-west-2# Install the Application and packages from the metadata
sudo sh /var/www/html/app/bin/install
-uhttp://test.example.com-fSiddhesh-lKhavnekar-es.khavnekar@gmail.com-pmagento123-cIndia-sMaharashtra-tMumbai-oTestReseller-rMagentoSt-ElasticL-15OYLTVSLF4GR-1502451718.us-west-2.elb.amazonaws.com-dmagentodb-amagento-bmagento123-hmd1tt96j81juryu.cvjxzqrkxoho.us-west-2.rds.amazonaws.comroot@ip-10-0-1-252:/var/lib/cloud/instance#
There has to be space between each parameters and the value mentioed shoudl be in quotes. So the right command should be as below,
root@ip-10-0-1-252:/var/lib/cloud/instance# cat user-data.txt
#!/bin/bash -v
apt-get upgrade -y# Install packages
/usr/bin/cloud-init -s Stack --region us-west-2# Install the Application and packages from the metadata
sudo sh /var/www/html/app/bin/install -u "http://test.example.com" -f "Siddhesh" -l "Khavnekar" -e "s.khavnekar@gmail.com" -p "magento123" -c "India" -s "Maharashtra" -t "Mumbai" -o "TestReseller" -r "MagentoSt-ElasticL-15OYLTVSLF4GR-1502451718.us-west-2.elb.amazonaws.com" -d "magentodb" -a "magento" -b "magento123" -h "md1tt96j81juryu.cvjxzqrkxoho.us-west-2.rds.amazonaws.com"
Any help would be appreciated. Thanks.