0

I am trying to deploy an application onto EC2 instances with AWS CodeDeploy. I am getting up to the point where CodeDeploy errors out at the BeforeInstall hook. The error message I am getting is related to a ScriptMissing. The exact error is:

Script does not exist at specified location: /opt/codedeploy-agent/deployment-root/1bfe51a8-151a-4366-8a3f-c061adb4bb90/d-X8N0B5IOE/deployment-archive/scripts\codedeploy\install_dependencies.sh

The odd thing is the file exists in my version control repository. So far I have tried changing the permissions of the script, and have also tried different method in the appspec.yml file in order to get CodeDeploy to recognize this file. All methods have failed. I tried the other solutions posted relating to this scenario but they do not seem to help me.

Do these script files int he appspec.yml also need to part of the zip file that CodeDeploy uses? Any advice would be appreciated. Below is the appspec.yml file.

Appspec

version: 0.0
os: linux
files:
  - source: /
    destination: /var/www/html
    overwrite: true

hooks:
  BeforeInstall:
    - location: scripts/codedeploy/install_dependencies.sh
      timeout: 300
      runas: root
  AfterInstall:
    - location: scripts/codedeploy/install_composer_dependencies.sh
      timeout: 300
      runas: root
    - location: scripts/codedeploy/start_server.sh
      timeout: 30
      runas: root
  ApplicationStop:
    - location: scripts/codedeploy/stop_server.sh
      timeout: 30
      runas: root
Dave Michaels
  • 847
  • 1
  • 19
  • 51
  • Yes, they should be part of the zip – Marcin Feb 14 '22 at 22:23
  • I added the script to the zip file that gets pushed to S3, but I'm still getting the same error. In CodeDeploy, it says the script is still missing but if I navigate to the location CodeDeploy specifies, I see all the scripts there. Maybe I need to specify the scripts in the appspec.yml file differently? – Dave Michaels Feb 15 '22 at 04:46

1 Answers1

0

I had a similar problem. My paths was scripts/file-name.sh. I just removed 'scripts/' from location path and leave only .sh file names and it works for me.