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"
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:
cls git add . git commit -a git aws.push --environment myenvironment pause
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:
cls git add . git commit -a eb deploy your_environmant_name pause