Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Elastic Beanstalk: Command Hooks Failed

Trying to deploy an IIS application to AWS Elastic Beanstalk via Visual Studio 2015. Every time we try to deploy it we get the following errors:

Error occurred during build: Command hooks failed

[Instance: i-XXXXXXXX ConfigSet: Infra-WriteRuntimeConfig, Infra-WriteApplication1,
Infra-WriteApplication2, Infra-EmbeddedPreBuild, Hook-PreAppDeploy,
Infra-EmbeddedPostBuild, Hook-EnactAppDeploy, Hook-PostAppDeploy]
Command failed on instance. Return code: 1 Output: null.

Unsuccessful command execution on instance id(s) 'i-XXXXXXXX'. Aborting the operation.

We've tried restarting the Application. We've tried deleting and recreating the Environment and Application. All to no success. Always the same error. I cannot find anything online anywhere that tells how to fix this. Has anyone else run into this problem and found a solution?

like image 956
NocFenix Avatar asked Dec 20 '25 05:12

NocFenix


2 Answers

The Beanstalk deployment errors are usually quite generic.

To get the root cause, the troubleshooting steps are the ones in AWS Elastic Beanstalk Troubleshooting doc:

  1. Retrieve and investigate EB Logs.
  2. If retrieved logs are not helpful, then SSH to the EC2 instance can be used to get more details or check that the instance config is really what is expected for example.
like image 149
pba Avatar answered Dec 21 '25 22:12

pba


Check the Hooks you have created correct in source code for example,

Hooks should be created in this path of the root of your project

.platform/hooks/postdeploy/
.platform/hooks/predeploy/

hooks creation

If you created a bash hooks you have to give permission for that before it execute so set permission for the hooks in .ebextensions as like below image shows

Give Permission to the hooks created

if above all are correct then, Check the EB logs, for that you have to login to the current instance.

IF the instance is attached with your key pair you can directly login to the ssh or else you have to create a ssh keypair and attach to the instance a shown below

set keypair with elasticbeanstalk application

Then Apply changes to the EB Application and Login to the instance with ssh

and check the below logs

ls /var/log/

cat /var/log/eb-hooks.log 

eb hooks log

You can also check the Detailed log's of EB Engine using

cat /var/log/eb-engine.log
like image 29
AkshayKrison Avatar answered Dec 21 '25 22:12

AkshayKrison



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!