Install Python Packages On Elastic Beanstalk

Install

To install Python packages on Amazon Beanstalk, we have to run add a command in our .ebextension/*.config file. Amazon Linux AMIs in Beanstalk are not shipped with pip but easy_install.

# these commands run before the application and web server are
# set up and the application version file is extracted.
commands:
  01_install_termcolor:
    command: 'easy_install termcolor'

See Amazon's documentation for more info.

Troubleshooting

Logs of the execution of .ebextension/*.config files are found in /var/log/cfn-init.log.

You should see something like

[DEBUG] Running command 01_install_termcolor
[DEBUG] No test for command 01_install_termcolor
[INFO] Command 01_install_termcolor succeeded
[DEBUG] Command 01_install_termcolor output: Searching for termcolor
Reading http://pypi.python.org/simple/termcolor/
Best match: termcolor 1.1.0
Quentin Pleplé
May 2014