Search code examples
gitamazon-web-servicesgit-submodulesamazon-elastic-beanstalk

AWS Elastic Beanstalk + Git Submodules


I'm using Amazon's Elastic Beanstalk to deploy my app via Git, and I've got submodules within my Git. Of course, when I look at the directories where the data for the submodules should be, nothing is there because the submodules have not been initialized.

Apparently Elastic Beanstalk doesn't support submodules. Is this correct? If so, how can I convince Git to let me have the features of a submodule but still upload all the code of the submodule when I push the main repo?


Solution

  • Elastic Beanstalk does support sub-modules if you just make sure that Git is installed on the AMI you use by Customizing and Configuring AWS Elastic Beanstalk Environments. You can do that by providing a config in your git repo:

    • Create a configuration file with the extension .config (e.g., myapp.config) and place it in an .ebextensions top-level directory of your git repo

    • In that file, specify the dependencies:

       packages: 
          <name of package manager>:
             <package name>: <version>
    

    for example:

       packages:
          yum:
             git: []
    
    • make sure you match the name of package manager to the AMI you're using, so for example yum for Amazon Linux, apt for Ubuntu.

    • you'll probably have to adapt your build script to initialize the sub-modules as EB won't do that for you

    • commit, push and deploy and go