How to use eb init without manual instructions

  1. I want to make an eb deploy in a clean environment. It tells me I first need to execute eb init.

Looks like you've solved this problem, but I'll clarify anyway: The EBCLI requires that the present working directory be rooted at an eb init-ed application. The EBCLI looks for a .elasticbeanstalk/config.yml directory to determine whether the PWD has been eb init-ed. Almost all eb operations require the PWD to have been init-ed with a Beanstalk application.

  1. EDIT I tried: eb init --region eu-west-1 appname ...

You're almost there. In order to suppress the interactive mode, which is what you are trying to do, you need to pass the --platform flag. I can clearly see how inconvenient this is, but what you need is:

eb init --region eu-west-1 --platform <platform-name> appname

Where <platform-name> is the name of the language your app is in. Passing the --platform argument suppresses the interactive mode according to the documentation.

Once that is done, you can execute:

  • eb use <environment name> followed by eb deploy, or just

  • eb deploy <environment-name>