Amazon-web-services – Elastic beanstalk deployment taking longer than timeout period, how to increase timeout period

amazon-elastic-beanstalkamazon-web-services

Elastic beanstalk deployment of a new environment for an application using the AWS website warns

Create environment operation is complete, but with command timeouts. Try increasing the timeout period

and although it eventually shows environment as green trying to connect to the url just gives

Service Temporarily Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. 

An earlier version of the application works fine, but in the ebextensions it has to copy a large file from s3 and then unzip it, this takes quite a while. The earlier version of the application only has to copy a 3GB file but the new version has to copy a 6GB file and as I can see no other errors Im guessing this has caused the timeout and prevented tomcat starting.

But how do I increase the timeout, I cannot see where I am meant to do it ?

Best Solution

You can do this using option settings. Option settings can be specified using ebextensions.

Create a file in your app source in a directory called .ebextensions. Lets say the file is .ebextensions/01-increase-timeout.config.

The contents of the file should be:

option_settings:
    - namespace: aws:elasticbeanstalk:command
      option_name: Timeout
      value: 1000

Note this file is in YAML format. After this you can update your environment with this version of source code.

From documentation for this option setting:

Timeout: Number of seconds to wait for an instance to complete executing commands.

For example, if source code deployment tasks are still running when you reach the configured timeout period, AWS Elastic Beanstalk displays the following error: "Some instances have not responded to commands. Responses were not received from ." You can increase the amount of time that the AWS Elastic Beanstalk service waits for your source code to successfully deploy to the instance.

You can read more about ebextensions here. Documentation on option settings is available here.

Related Question