Configure elastic beanstalk to use the new version of python

How can I tell Amazon Elastic Beanstalk to use Python 2.7.3 when starting Django without creating a custom AMI?

It seems like it should just say elastic beanstalk to use a later version of python than 2.6. I would really like not to create a custom AMI, as this seems like overly complicating the problem.

I need python 2.7.3 and I need to use virtualenv 1.8.X. I noticed that using a later version of virtualenv than the Amazon Deployment Tutorial (1.7.X) adversely affects "git aws.push", but in this case I don’t have the option due to client requirements.

I learned how to create custom container commands in .ebextensions / *. config, for example:

container_commands: update_python: command: "sudo yum -y install python27; sudo ln -sf `which python2.7` /usr/bin/python" 

but that violates yum, which may be fine, but I would rather keep the system intact.

I could install python27 with yum as shown above and leave python26 as the default python, but I don't know how to make sure the server uses python27 to start Django. So an alternative question: how can I say that elastic beanstalk use python27 to start Django instead of standard python? I can easily install python27 on the system as an alternative python, I just have to explicitly call it.

Hope this question is not too broad. I am trying to come up with several angles to solve this problem. Thanks for any help.

+6
source share
1 answer

I ran into the same problem and the solution was pretty simple.

Assuming your PATH environment variable points to this folder:

 <path to unzipped EB CLI package>/eb/linux/python2.7/ 

Go there and edit the file named "eb"

 $cd <path to unzipped EB CLI package>/eb/linux/python2.7/ $vim eb 

On the first line, where it says "! # / Usr / bin / env python", change it to "! # / Usr / bin / env python2.7"

And then you should be fine!

-2
source

All Articles