28

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 ?

Paul Taylor
  • 13,411
  • 42
  • 184
  • 351

4 Answers4

52

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.

Daniel777
  • 851
  • 8
  • 20
Rohit Banga
  • 18,458
  • 31
  • 113
  • 191
  • 1
    Great that fixes it, FWIW I originally set value to 2000 but the max value allowed is 1800 (1/2 hour), thats okay because it only takes 11 minutes to deploy on the instance I i used but surprised the max value was that low. – Paul Taylor Sep 01 '14 at 09:11
  • I got yaml syntax error from aws, then I remove the spaces (yaml validator instruct me): option_name:Timeout and value:1000 (no spaces after the ":"). now its works great. thanks! – dang Nov 07 '16 at 11:31
  • 5
    Do NOT follow @dang advice! you need a space between value: and number. Correct is: `value: 1000`. not `value:1000` – Roman Nov 16 '16 at 11:05
  • 1
    @Roman you dont need to be rude. it did not succeed for me with the spaces so i removed them and now its ok for me. I did not advice nothing just point out some problem I encounter maybe it will help others if they encounter the same problem. – dang Nov 17 '16 at 09:07
  • do I need to add reference of this file somewhere in project ? I'm getting "ERROR: The operation timed out. The state of the environment is unknown. The timeout can be set using the --timeout option." – Aleem Nov 23 '16 at 06:27
7

Use: --timeout

For eg: eb create -db --timeout 20

This will give you 20 minutes of timeout limit.

Ash Singh
  • 3,921
  • 2
  • 25
  • 30
2

According to the official documentation you can pass --timeout option to your eb create call.

--timeout minutes
Set number of minutes before the command times out.
Alexander Poluektov
  • 7,844
  • 1
  • 28
  • 32
  • 1
    Are you sure this is the same timeout? Or is this the timeout for the eb-cli itself? My eb cli times out with `ERROR: TimeoutError - The EB CLI timed out after 10 minute(s). The operation might still be running. To keep viewing events, run 'eb events -f'. To set timeout duration, use '--timeout MINUTES'.` while the deployment itself keeps running without showing any timeout errors on the "Events" page. – djvg Sep 20 '18 at 13:35
1

I've just been doing it at time of deployment for my environment and it works fine this way too.

eb deploy production-env --timeout 30

..and that gives me 30 minutes.

Jordan
  • 1,650
  • 2
  • 18
  • 17