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?

I'm using node.js so I'm thinking an install script might be the best option

  • Really curious why this has a score of -1 as this seems like a pretty reasonable question for serverfault. May 5, 2014 at 20:54
  • 1
    Just FYI, if your app uses a package manager you should handle all the gathering of modules there. EB isn't a true Git repo and there's a lot of stuff that goes on when you deploy to Elastic Beanstalk. If you need customize your environment during deployments, take a look at creating extensions for EB. Extensions go in a special folder called .ebextensions. I use a combination of this, and npm to do what I need to do. Git submodules aren't a good choice for EB.
    – iLoch
    May 6, 2014 at 21:49
  • You can use aws eb cli version 3.10.3+. They added ability to zip git submodules for application versions
    – ALex_hha
    Nov 21, 2017 at 11:28

3 Answers 3

  • If you don't have too many submodules (and you're not changing or updating them often) you could just replace them with the static files instead.

  • Many people in the PHP community are starting to move away from managing dependencies with Git submodules to using Composer http://getcomposer.org/. This might make part of your deployment flow simpler.

  • There is also a solution outlined here https://forums.aws.amazon.com/message.jspa?messageID=474880 The last comment (Aug 1, 2013 1:37 PM by oquismail) shows you how to modify Elastic beanstalk configuration files

  • You could consider managing deployments through https://github.com/briandilley/ebs-deploy (Python based command line tools for managing Amazon Elastic Beanstalk applications.)


You can also just git clone the submodule to get back a standalone Git repository. See https://stackoverflow.com/q/29246750/242933


If you use awsebcli installed thru pip, then this may help you.

We were able to find the source code for AWS-EB client 3.10.1 on PyPi.

The issue is in how git repos are handled while zipping your project's source code for uploading it to AWS. If you do not use git for your AWS project, the whole project directory (including any other git modules under subdirectories you may have in it) is zipped and sent to AWS. If you use git, then all the checked-in or staged code except the submodules is zipped and sent to AWS. Git submodules are skipped.

We wrote a fix for this issue by changing the behavior such that the submodules are also added to the zipped archive. You can see the fix at github.com/uppercasebrands/awsebcli-3.10.1/compare/eb-deploy-submodule on our git repo which is created from the original PyPi package.

You can install the fixed awsebcli-3.10.1 which now supports submodules by using pip:

pip install --upgrade git+https://github.com/uppercasebrands/awsebcli-3.10.1.git@eb-deploy-submodule

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .