Home » Php » php – Unable to deploy to AWS Elastic Beanstalk using Git

php – Unable to deploy to AWS Elastic Beanstalk using Git

Posted by: admin July 12, 2020 Leave a comment

Questions:

I’m following the Elastic Beanstalk docs (http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs_express.html) to the letter but I’m unable to deploy either a node.js or PHP application using git.

$ eb push
Error: Failed to create the AWS Elastic Beanstalk application version
Cannot run aws.push for local repository HEAD: 

The same happens if I try to push from git

$ git aws.push
Updating the AWS Elastic Beanstalk environment phpapp-env...
Error: Failed to create the AWS Elastic Beanstalk application version

When you call eb init, the AWS tools setup a few git shortcuts. The call that is failing is…

$.git/AWSDevTools/aws.elasticbeanstalk.createapplicationversion
Error: Failed to create the AWS Elastic Beanstalk application version

The code for that python modules is…

from aws.dev_tools import *

if __name__ == "__main__":
  dev_tools = DevTools()
  dev_tools.create_application_version(None, None)

I’ve tried this for a brand new php and node.js projects. I’m running Python 2.7.2, Ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin12.0]. Any thoughts?

How to&Answers:

We experienced the same error message but different cause. The commit message for our git commit was either too long or contained special characters. Using a simpler git commit message cleared it up. Hope this helps someone!

Answer:

This bug will only bite people that use multiple AWS accounts. It seems that if you have AWS_CREDENTIAL_FILE declared in your environment variables, the AWS tools will pick that up instead of picking up the local credentials that I established for the Beanstalk project. You can check which configuration is being used by issuing the following command.

git aws.config

tells me that the credentials are coming from…

/Users/a12345/.ec2/CLI_Access_User.iam

…instead of the local environment. I wish the error message had indicated that this was a permissions issue.

Answer:

This happened to me when I ran out of application versions, there is a limit of 500

Answer:

I have another possible cause for this error, and debugging I got this:

{"Error":
    {"Code":"TooManyApplicationVersionsException",
     "Message":"You cannot have more than 500 Application Versions. Either remove some Application Versions or request a limit increase.",
     "Type":"Sender"},
"RequestId":"xxxxxxxx-8184-11e4-xxxx-d5d8eef7a812"}

Definitely the AWSDevTools, should throw those errors being more informative than Error: Failed to create the AWS Elastic Beanstalk application version or even provide a --verbose option.

Answer:

Solution is here:
Amazon Elastick BeanStalk error: Failed to create the AWS Elastic Beanstalk application version

Genrelly too many version uploaded to amazon.

Answer:

The above can work for someone but if you still find issues please do check your git aws.config, because if you are working on multiple Beanstalk with multiple accounts try checking if this correct.