title: Userdata script not running in ubuntu server while creating with cloudformation template
body: <p>Sorry for asking repeated and old question .My code does not run a userdata shell script . My userdata property is a parameter which will given while create a stack .
  my code is</p>
  
  <pre><code>{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "AWS CloudFormation Sample Template",
  "Parameters": {
      "UserData": {
          "Description": "User data",
          "Type": "String"
      }
  },
  "Resources": {
      "EC2Instance": {
          "Type": "AWS::EC2::Instance",
          "Properties": {
              "KeyName": {
                  "Ref": "KeyName"
              },
              "InstanceType": {
                  "Ref": "InstanceType"
              },
              "ImageId": {
                  "Ref": "ImageId"
              },
              "SecurityGroups": [
                  {
                      "Ref": "EC2SecurityGroup"
                  }
              ],
              "UserData": {
                  "Fn::Base64": {
                      "Fn::Join": [
                          "",
                          [
                              "#!/bin/bash",
                              "\n",
                              {
                                  "Ref": "UserData"
                              }
                          ]
                      ]
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I gave the following shell command in userdata parameter</p>
  
  <pre><code>"apt-get update","\n","apt-get install -y apache2","\n","apt-get install -y php","\n"
  </code></pre>
  
  <p>I can't know whether my userdata scricpt is right or not,
  It doesn't show any error while creating a stack , It creates a instance successfully .
  After instance creation I checked apache2 and php not installed in the instance .
  can anyone find what is wrong in my code ?</p>