Hurry! Try our new Interactive Courses for FREE. 🥳   🚀
Written By:
iamabhishek
5 minute read
AWSHow ToInstallation Guide

How to Install the AWS EB CLI 3.0 on macOS

Posted in Tricks   LAST UPDATED: OCTOBER 19, 2021

If you are planning to host your web application on AWS Elasticbeanstalk service, then you must install the EB CLI available for remotely connecting to the Elasticbeanstalk environment and perform different operations on it.

There are two ways to install the AWS EB CLI on your mac OS machine:

  1. Using Homebrew

  2. Using Python and Pip

We will cover both the ways, with a complete step by step guide. So you just sit back, put your brain aside and just blindly follow these steps.

Using Homebrew:

Homebrew is a package manager for macOS. It doesn't come pre-installed, so you will have to install Homebrew on your macOS first, before using it to download EB CLI.

Once you have successfully installed Homebrew, you can run the following command to install EB CLI:

brew install awsebcli

Running the above command will install the latest version of the AWS elasticbeanstack command line interface.

Using Python and Pip:

If you have python and pip package manager installed in your macOS then we can use pip to install AWS elasticbeanstack command line interface.

Run the following command to install AWS EB CLI using pip:

pip install awsebcli --upgrade --user

The --upgrade option is to inform the pip package manager to upgrade all the requirements for awsebcli, that are already installed. The --user option is to install awsebcli in a subdirectory of your user directory, so that our installation doesn't affect any libraries used by the operating system.

Note: We can also install the awsebcli tool in a virtual environment. You can install Python and setup virtual env on macOS very easily using the venv module.

Once the pip command successfully installs the awsebcli tool, if you will try to run the eb --version command to check the version of the installed tool, or you will run the eb command, you will get -bash: eb: command not found error. But we just installed it using pip, right?

Well to start using the eb command, we will have to add the executable file to our PATH variable.

Add the executable file to PATH variable:

In macOS, we can find the Python installation here: ~/Library/Python/3.7/bin (change the version of Python as per your installation and verify that it is there once)

Adding executable file to PATH variable is three-step process:

  1. Find the shell's profile, as there are multiple supported shells.

  2. Add export command to our profile script

  3. Load the profile script.

Let's see how we can complete the above-mentioend points.

1. Find the shell profile:

To find your machine's supported shell profile, run the following command in the terminal:

echo $SHELL


/bin/bash

You can also run the below command to see the bash profile files.

$ ls -a ~


.bash_history
.bash_profile
.bash_sessions
Desktop
Documents

As you can see in the output above, we have .bash_profile available, so we will update this profile to start working with the AWS eb command.

2. Add export command to our profile script:

In this step we will be adding an export command to our profile script. The following example adds the path represented by LOCAL_PATH to the current PATH variable.

export PATH=LOCAL_PATH:$PATH

If you have Python 3.6 installed, then you should run the below command:

export PATH=~/Library/Python/3.6/bin:$PATH

3. Load the profile script:

Now we will load the profile script in which we added the export PATH in the second step into our current session. The command below will load the profile script, we just updated:

$ source ~/.bash_profile

And that's it. We are done!

Now to test, that everything was completed successfully, run the following command:

- eb --version

And you should see the version of the EB CLI that you installed.

Note: Every time you want to use the EB CLI, you may have to run step 2 and step 3 again to load the bash profile with the changes. So keep them saved somewhere or bookmark this URL.

Now that you have the Elasticbeanstalk CLI setup, you can start with provisioning a new environment for yourself.

You may also like:


IF YOU LIKE IT, THEN SHARE IT

RELATED POSTS