AWS CodeDeploy Appspec.yml files are not being copied to destination

1.6k Views Asked by At

My files are properly copied to an EC2 instance for deployments, but they are not copied to the destination. I've got at appspec.yml file like this:

ubuntu@ip:~$ cat /opt/coded*/deployment-root/*/*/de*/appspec.yml
version: 0.0
os: linux
# I also tried with source: /
files:
  - source: .
    destination: /home/ubuntu/
file_exists_behavior: OVERWRITE
# notes

# ------------------------------------------------------------------------------------

# To learn more about hooks, visit the docs here:
# https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-structure-hooks.html#appspec-hooks-server
hooks:
  BeforeInstall:
    - location: scripts/install_dependencies
      timeout: 300
      runas: root
  ApplicationStart:
    - location: scripts/start_server
      timeout: 300
      runas: root
  ApplicationStop:
    - location: scripts/stop_server
      timeout: 300
      runas: root

I've also tried setting source to source: / with the same result; nothing's copied

And I see my files are all in that /opt/coded* etc. path. But why isn't the CodeDeploy agent copying my files to the destination? The Download bundle hook is good, and the only error I get is in the ApplicationStart hook when I need to actually access my files.

Note: I'm using GitHub as my revision storage, not S3, if that helps

Edit: something that might be useful to know is in my install_dependencies script, I run something along the lines of:

cd /home/ubuntu/
pip install -r requirements.txt

where the pip installation is the line where it can't find the files

1

There are 1 best solutions below

0
On BEST ANSWER

Reasoning: https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-example.html#appspec-file-example-server

The order of the hooks. The files are copied before the AfterInstall hook.