Sky21.86
Sky21.86

Reputation: 667

AWS - install python packages while deploying EC2 server

i am currently working on a project where I need to deploy python application on my EC2 instance. I cannot seem to figure out how to install packages on my EC2 instance during application installation. I have tried installation via "requirements.txt" file

mysql-connector-python==8.0.22

as well as via .ebextenstion/01_packages.config file that looks as following:

packages:
    yum:
        mysql-connector-python: '8.0.22'
        requests: '2.24.0'

BUT every time is deploy new version of my application i get an error and updated list of packages is not installed.

Any assistance is highly appreciated.

Upvotes: 1

Views: 800

Answers (2)

Sky21.86
Sky21.86

Reputation: 667

Ended up creating setup.config file in my .ebextentions, where I configured command to install required packages.

commands:
    install_requests:
        command: "pip install requests"
    install_wheel:
        command: "pip install wheel"
    install_mysql-connector-python:
        command: "pip install mysql-connector-python"

Upvotes: 0

Marcin
Marcin

Reputation: 238597

I verified on EB Python 3.7 AL2 version 3.1.4 that the following requirements.txt works:

mysql-connector-python==8.0.22
requests==2.24.0

Thus if you have other issues, they are not caused by the requirements.txt on that platform.

Upvotes: 1

Related Questions