Configure the EB CLI
After installing the EB CLI, you are ready to
configure your project folder with
eb init in your application's project directory to configure the EB CLI and
The following example shows the configuration steps when running
eb init for
the first time in a project folder named
To initialize an EB CLI project
First, the EB CLI prompts you to select a region. Type the number that corresponds to the region that you would like to use and press Enter.
eb initSelect 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 (Columbus) 14) ca-central-1 : Canada (Central) 15) eu-west-2 : EU (London) (default is 3):
Next, provide your access key and secret key so that the EB CLI can manage resources for you. Access keys are created in the AWS Identity and Access Management management console. If you don't have keys, see How Do I Get Security Credentials? in the Amazon Web Services General Reference.
You have not yet set up your credentials or your credentials are incorrect You must provide your credentials. (aws-access-id):
An application in Elastic Beanstalk is a resource that contains a set of application versions (source), environments, and saved configurations that are associated with a single web application. Each time you deploy your source code to Elastic Beanstalk using the EB CLI, a new application version is created and added to the list.
Select an application to use 1) [ Create new Application ] (default is 1):
The default application name is the name of the folder in which you run
eb init. Enter any name that describes your project.
Enter Application Name (default is "eb"):
ebApplication eb has been created.
Select a platform that matches the language or framework that your web application is developed in. If you haven't started developing an application yet, choose a platform that you are interested in. You will see how to launch a sample application shortly, and you can always change this setting later.
Select a platform. 1) Node.js 2) PHP 3) Python 4) Ruby 5) Tomcat 6) IIS 7) Docker 8) Multi-container Docker 9) GlassFish 10) Go 11) Java (default is 1):
Choose yes to assign an SSH key pair to the instances in your Elastic Beanstalk environment, allowing you to connect directly to them for troubleshooting.
Do you want to set up SSH for your instances? (y/n):
Choose an existing key pair or create a new one. 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. The CLI registers the new key pair with Amazon EC2 for you and stores the private key locally in a folder named
.sshin your user directory.
Select a keypair. 1) [ Create new KeyPair ] (default is 1):
Your EB CLI installation is now configured and ready to use. See Managing Elastic Beanstalk Environments with the EB CLI for instructions on creating and working with an Elastic Beanstalk environment.
Ignoring files with .ebignore
You can tell the EB CLI to ignore certain files in your project directory with a
.ebignore file. This file works like a
When you deploy your project directory to Elastic Beanstalk and create a new application version, the EB
CLI will not include files specified by the
.ebignore in the source
bundle that it creates.
.ebignore is present, but a
the EB CLI will ignore files specified in the
.gitignore. If an
.ebignore file is present, the EB CLI will not read the
In Windows, adding an
.ebignore file causes the EB CLI to follow
symbolic links and include the linked file when creating a source bundle. This is a known
issue and will be fixed in a future update.
Using Named Profiles
If you store your credentials as a named profile in a
config file, you can use the
--profile option to explicitly specify a
profile. For example, the following command creates a new application using the
eb init --profile
You can also change the default profile by setting the
environment variable. When this variable is set, the EB CLI will read credentials from the
specified profile instead of
Linux, macOS, or Unix
Deploying an Artifact Instead of the Project Folder
You can tell the EB CLI to deploy a ZIP or WAR file that you generate as part of a
separate build process by adding the following lines to
.elasticbeanstalk/config.yml in your project folder.
If you configure the EB CLI in your Git repository, and
you don't commit the artifact to source, use the
--staged option to deploy the
eb deploy --staged
Configuration Settings and Precedence
The EB CLI uses a provider chain to look for AWS credentials in a number of different places, including system or user environment variables and local AWS configuration files.
The AWS CLI looks for credentials and configuration settings in the following order:
Command Line Options – a named profile can be specified with
--profileto override default settings.
Environment Variables –
The AWS credentials file – located at
~/.aws/credentialson Linux and OS X systems or at
C:\Users\on Windows systems. This file can contain multiple named profiles in addition to a default profile.
The AWS CLI configuration file – located at
~/.aws/configon Linux and OS X systems or
C:\Users\on Windows systems. This file can contain a default profile, named profiles, and AWS CLI specific configuration parameters for each.
Legacy EB CLI configuration file – located at
~/.elasticbeanstalk/configon Linux and OS X systems or
C:\Users\on Windows systems.
Instance profile credentials – these credentials can be used on EC2 instances with an assigned instance role, and are delivered through the Amazon EC2 metadata service. The instance profile must have permission to use Elastic Beanstalk.
If the credentials file contains a named profile with the name "eb-cli", the EB CLI will prefer that profile over the default profile. If no profiles are found, or a profile is found but does not have permission to use Elastic Beanstalk, the EB CLI prompts you to enter keys.
To use the EB CLI from an EC2 instance, create a role that has access to the resources needed and assign that role to the instance when it is launched. Launch the instance and install the EB CLI with pip:
sudo pip install awsebcli
pip comes pre-installed on Amazon Linux.
The EB CLI will read credentials from the instance metadata. For more information, see Granting Applications that Run on Amazon EC2 Instances Access to AWS Resources in IAM User Guide.