Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use eb init without manual instructions

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

When I do this I see the following:

Select a default region
1) us-east-1 : US East (N. Virginia)
2) us-west-1 : US West (N. California)
3) us-west-2 : US West (Oregon)
4) eu-west-1 : EU (Ireland)
5) eu-central-1 : EU (Frankfurt)
6) ap-south-1 : Asia Pacific (Mumbai)
7) ap-southeast-1 : Asia Pacific (Singapore)
8) ap-southeast-2 : Asia Pacific (Sydney)
9) ap-northeast-1 : Asia Pacific (Tokyo)
10) ap-northeast-2 : Asia Pacific (Seoul)
11) sa-east-1 : South America (Sao Paulo)
12) cn-north-1 : China (Beijing)
13) us-east-2 : US East (Ohio)
14) ca-central-1 : Canada (Central)
15) eu-west-2 : EU (London)
(default is 3):

As you can see the setup needs manual instructions. How can I automate this setup?

I tried

$ export AWS_ACCESS_KEY_ID="xxx"
$ export AWS_SECRET_ACCESS_KEY="xxx"
$ export AWS_DEFAULT_REGION="xxx"
$ eb init

But again it was necessary to choose the region etc (like above)?

How can I autogenerate my .aws to make an eb deployment without manual interaction, only commands?

EDIT I tried:

init --region eu-west-1 appname

This brought me already a bit further but now I receive:

Select the default environment.

You can change this later by typing "eb use [environment_name]".
1) app-dev
2) app-uat

How can I automate this setup in my eb init command?

like image 771
DenCowboy Avatar asked Feb 08 '18 18:02

DenCowboy


People also ask

How can I get EB init?

To use eb init to create a new key pair, you must have ssh-keygen installed on your local machine and available from the command line. Forces EB CLI to prompt you to provide a value for every eb init command option.

How do you setup EB CLI with EB ENV that is already running?

To attach the EB CLI to an existing environmentOpen a command line terminal and navigate to your user folder. Create and open a new folder for your environment. Run the eb init command, and then choose the application and environment whose health you want to monitor.

How do you get the Elastic Beanstalk command line?

The easiest and recommended way to install the EB CLI is to use the EB CLI setup scripts available on GitHub. Use the scripts to install the EB CLI on Linux, macOS, or Windows. The scripts install the EB CLI and its dependencies, including Python and pip . The scripts also create a virtual environment for the EB CLI.


1 Answers

  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>

like image 66
progfan Avatar answered Oct 21 '22 04:10

progfan