Search code examples
amazon-web-servicesdeploymentamazon-ec2aws-code-deploy

CodeDeploy Script does not exist at specified location - appspec.yml


I am trying to deploy my app on AWS with CodeDeploy.

Here is my appspec.yml file:

version: 0.0

os: linux

files:
  - source: /
    destination: /home/ec2-user/todos // <== this dir already exists in my instance

hooks:
  ApplicationStop:
    ...

  BeforeInstall:
    - location: scripts/prerequisites
      timeout: 1200
      runas: root

  AfterInstall:
    ...
  ApplicationStart:
    ...
  ValidateService:
    ...

I keep getting the following error:

Error Code: ScriptMissing

Script Name: scripts/prerequisites

Message: Script does not exist at specified location: /opt/codedeploy-agent/deployment-root/2e557520-7ffe-4881-8c7c-991952c56e05/d-UWR3Z01FE/deployment-archive/scripts/prerequisites

Log Tail: LifecycleEvent - BeforeInstall

My scripts are stored in a file called 'scripts' that is found at the root of my app.

What am I missing? or doing wrong? If anyone could help me in the right direction I would be very grateful!


Solution

  • Ok so it seems that the problem was simply a typo. I forgot to write the file extension to my scripts (.sh)

    Like so:

    BeforeInstall:
        - location: scripts/prerequisites.sh // <--- this fixed it
          timeout: 1200
          runas: root
    

    Hope it helps anyone.