cross-link to AWS forums

I have developed a simple Python web service using WSGI and would like to deploy it to AWS cloud using Elastic Beanstalk. My problem is I cannot make all the options I specify in Elastic Beanstalk configuration to be correctly configured in the cloud.

For deployment, I use Elastic Beanstalk CLI utility. I have run eb init command and set up the required parameters. After this, a directory named .elasticbeanstalk was created in my source tree. It has two config files that are used for deployment, namely config and optionsettings. The latter one among the other options contains the WSGI configuration that has to update /etc/httpd/conf.d/wsgi.conf at the instances. After some of my adjustments the file has the following settings:


WSGIPath = handler.py
NumProcesses = 2
StaticFiles = /static=
NumThreads = 10

/static = static/

LogPublicationControl = false

InstanceType = t1.micro
EC2KeyName = zmicier-aws

Application Healthcheck URL = 

MaxSize = 10
MinSize = 1
Custom Availability Zones = 

Automatically Terminate Unhealthy Instances = true

Notification Endpoint = 
Notification Protocol = email

It turns out that not all of these options are considered when I start the environment or update it. Thus, when I update NumThreads or NumProcesses, the respective parameters get changed in wsgi.conf as expected. But whatever I write to the WSGIPath and StaticFiles parameters, I'm not able to automatically change the respective values of wsgi.conf, they remain

Alias /static /opt/python/current/app/
WSGIScriptAlias / /opt/python/current/app/application.py

which drives me nuts. Moreover, when I deploy my application using git aws.push and having the following contents of .ebextensions/python.config file, neither of options I specify in it affects the deployment.

     - namespace: aws:elasticbeanstalk:container:python
       option_name: WSGIPath
       value: mysite/wsgi.py
     - namespace: aws:elasticbeanstalk:container:python
       option_name: NumProcesses
       value: 5
     - namespace: aws:elasticbeanstalk:container:python
       option_name: NumThreads
       value: 25
     - namespace: aws:elasticbeanstalk:container:python:staticfiles
       option_name: /static/
       value: app/static/ 

I wonder what I should do to force AWS use all the parameters I specify in the configuration, namely the WSGI Path and path to my static data.

  • I'm having this issue. I can't seem to get WSGIPath to update now, have resorted to creating a new environment. This is some serious "WTF" territory... – aendrew Feb 7 '14 at 15:37

You might want to look at building a Docker container and deploying that to Elastic Beanstalk. AWS have a Python sample for doing this at https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/docker-singlecontainer-deploy.html#docker-singlecontainer-pythonsample and a full github repo at https://github.com/aws-samples/eb-py-flask-signup/tree/docker

It'll be much easier to test locally, and you have a lot more flexibility. My rule of thumb is that once I'm spending time fighting the framework that should be making my life easier then it's time to change approach. I'd say you've reached that point.

It'll also make it easy to migrate your app to something like Fargate down the road.


Consider using .ebextensions documented at:


You can use file: to provision your configuration file as needed on the host instance. And then restart/reload, in case needed, with command:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.