Elastic Beanstalk CLI

EB CLI is a command-line-interface that makes it possible to automate a way of provisioning applications in the AWS cloud environment. The two important steps we have to do are:

Part 1: Installation of EB CLI

sudo su -
apt-get update
apt install python3-pip unzip
pip install --upgrade --user awsebcli
export PATH=$PATH:~/.local/bin/

Part 2: Deploy Application using EB CLI

mkdir eb-app
cd eb-app
wget https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/samples/php.zip
rm -f php.zip
eb init
eb create --single
eb events
eb health
eb logs --all
eb terminate

Best Practice

We sould never SSH into our servers to configure applications, we must make use ebextensions if we ever need to customize our applications. Elastic Beanstalk offers the following approaches to customize and configure deployments:

  • Packages
  • Groups
  • Users
  • Sources
  • Files
  • Commands
  • Services
  • Container commands

The commands run before the application and web server are setup and the application version file is extracted.

The container commands run after the application and web server have been setup and the application archive has been extracted, but before the application version is deployed.