title: How to run my own shell script inside user data in ec2 instance
body: <p>I have a shell script which copies files from an s3 bucket and then runs a python script and later deletes the file which was copied.
  this file panorama.sh is in the /home/ubuntu directory of my ec2 instance.
  I have modified my user data of the ec2 instance as follows</p>
  <pre><code>Content-Type: multipart/mixed; boundary=&quot;//&quot;
  MIME-Version: 1.0
  
  --//
  Content-Type: text/cloud-config; charset=&quot;us-ascii&quot;
  MIME-Version: 1.0
  Content-Transfer-Encoding: 7bit
  Content-Disposition: attachment; filename=&quot;cloud-config.txt&quot;
  
  #cloud-config
  cloud_final_modules:
  - [scripts-user, always]
  
  --//
  Content-Type: text/x-shellscript; charset=&quot;us-ascii&quot;
  MIME-Version: 1.0
  Content-Transfer-Encoding: 7bit
  Content-Disposition: attachment; filename=&quot;userdata.txt&quot;
  
  #!/bin/sh
  sh ./panorama.sh
  
  </code></pre>
  <p>However this does not seem to work as when i check my cloud watch log in /var/log/cloud-init-output.log  im getting this in the end</p>
  <p>sh: 0: Can't open ./panorama.sh
  Cloud-init v. 20.4.1-0ubuntu1~18.04.1 running 'modules:final' at Thu, 11 Mar 2021 08:31:38 +0000. Up 17.05 seconds.
  2021-03-11 08:31:38,684 - cc_scripts_user.py[WARNING]: Failed to run module scripts-user (scripts in /var/lib/cloud/instance/scripts)
  2021-03-11 08:31:38,684 - util.py[WARNING]: Running module scripts-user (&lt;module 'cloudinit.config.cc_scripts_user' from '/usr/lib/python$</p>
  <p>I tried putting ls in the user data to see what are the files in the current directory. It seems to be in the same working directory (/home/ubuntu). So why is it not able to find my shell script and execute it?</p>