Kainax Kainax - 1 year ago 85
Git Question

Elastic Beanstalk "git aws.push" only commited difference?

We are storing our PHP project on github.

For fast deployment we are using .bat file for git pushing changes to AWS Elastic Beanstalk cloud:

"C:\Program Files (x86)\Git\bin\sh.exe" --login -i -c "git aws.push --environment envname"

We are making commit every time before push, and it's working just perfect, as expected.

Unfortunately, for some reason, sometime it is pushing really quick (just pushing difference in PHP Code changes), but sometimes it is sending whole 300mb project (with all media).

Is there any way to git push only changed diference? Maybe there is any additional parameters on push or preparation git commands before send? Or maybe there is some way to tell AWS EB to pull last commit from github repository?

Thanks for any help.

Answer Source

OK, after months of troubles I resolved the reason of the problem.

The problem is that on


command Elastic Beanstalk is checking if your current files are committed to the git or they are ahead of the repository. If your files are identical to a last git commit, then EB pulls only difference, but if your files are ahead of the last git commit, then it pulls whole folder!

To avoid problem I made a deploy.bat file for windows that tries to commit changes before aws.push command:

git add .
git commit -a
git aws.push --environment myenvironment

Now, if you already did commit before running this .bat file then you will upload only difference. Otherwise, you will be asked for a git commit message before uploading difference.

PS - Please note that if you will try to push version that is already on EB one more time, it will also try to upload entire folder.

PSS - If by any reason you will see that EB tries to pull entire folder, just close the window, make small changes to a source code (like adding new line or a comment), save, commit changes to git and run deploy.bat file again.

Works like a charm!


For those who are using new standalone eb cli, the code will be:

git add .
git commit -a
eb deploy your_environmant_name
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download