title: Running a script from .ebextensions folder in aws elastic beanstalk
body: <p>I am trying to run a script from when war is uploaded so here is the contents of configurations</p>
  
  <pre><code>container_commands:
      01_setup_apache:
          command: "cp .ebextensions/enable_mod_deflate.conf /etc/httpd/conf.d/enable_mod_deflate.conf"
      02_setup_script:
          command: "sudo su root"
      03_setup_script:
          command: "sudo mkdir -p /home/dev"
      04_setup_script:
          command: "sudo chmod 777 /home/dev -R"
      05_setup_script:
          command: "sudo cp .ebextensions/scripts/setup.sh /home/dev/"
      06_setup_script:
          command: "sudo chmod +x /home/dev/setup.sh"
      07_setup_script:
          command: "sudo /home/dev/setup.sh"
      08-restart-apache:
          command: "sudo /etc/init.d/httpd restart"
  </code></pre>
  
  <p>I tried every thing but deployment always fail on executing setup.sh. In above example it fails on <strong>07_setup_script</strong></p>
  
  <p>Here is log contents</p>
  
  <pre><code>] : Starting activity...
  /Command 01_setup_apache] : Starting activity...
  /Command 01_setup_apache] : Completed activity.
  /Command 02_setup_script] : Starting activity...
  /Command 02_setup_script] : Completed activity.
  /Command 03_setup_script] : Starting activity...
  /Command 03_setup_script] : Completed activity.
  /Command 04_setup_script] : Starting activity...
  /Command 04_setup_script] : Completed activity.
  /Command 05_setup_script] : Starting activity...
  /Command 05_setup_script] : Completed activity.
  /Command 06_setup_script] : Starting activity...
  /Command 06_setup_script] : Completed activity.
  /Command 07_setup_script] : Starting activity...
  /Command 07_setup_script] : Activity execution failed, because: sudo: unable to execute /home/dev/setup.sh: No such file or directory
     (ElasticBeanstalk::ExternalInvocationError)
  </code></pre>
  
  <p>If <strong>ssh</strong> on instances there is no folder or file over there (/home/dev) or ( /home/dev/setup.sh) it seems previous commands were not executed but log says its completed</p>
  
  <p>I know there is way to create a script file on run time, but can we avoid that and just use the above method. </p>