[Solved]-How to deploy a subdirectory of git repo to elastic beanstalk


Assuming you have installed and set up the EB CLI you can create a script to zip your django-app/ folder and then deploy the resulting artefact:

  1. Create a folder in your project root called .ebextensions and inside this folder create a file called config.yml with the following basic contents:

    artifact: “deploy.zip”

(note the spacing is very important in a yml file, “deploy” should be in the first column, “artifact” in a secod (tab spaced) column)

  1. Create a deploy.sh script in your project root with the following:

    git archive –format=zip HEAD:django-app/ > deploy.zip;
    eb deploy;

Note: this works very well on Mac and Linux, I’ve had issues in the past with Windows because of spaces in the user folder structure on Windows.

Leave a comment