简体   繁体   中英

How do I set up WSGI in Elastic Beanstalk when running AWS Deep Learning Base AMI (Amazon Linux 2)?

In my elasticbeanstalk, I have:

Platform:
  PlatformArn: arn:aws:elasticbeanstalk:us-east-2::platform/Python 3.7 running on 64bit Amazon Linux 2/3.0.3
OptionSettings:
  aws:autoscaling:launchconfiguration:
    RootVolumeSize: "90"
    IamInstanceProfile: aws-elasticbeanstalk-ec2-role
    ImageId: ami-017ff046baf80c98c
  ...

where that ami is https://aws.amazon.com/marketplace/pp/B07NMRZ463 (AWS Deep Learning Base AMI (Amazon Linux 2)).

I have a flask application with application.py :

....
# run the app.
if __name__ == "__main__":
    # Setting debug to True enables debug output. This line should be
    # removed before deploying a production app.
    # application.debug = True
    print('Starting application')
    application.run(host='0.0.0.0')

When I load it, my .platform/hooks/prebuild runs (I see the logs in /var/log/eb-hooks.log ). But my application server does not seem to start.

If it matters, my code is in /var/app/staging and didn't get moved to /var/app/current .

What am I doing wrong?

I did some more digging around, and I think a one way would be to create your own custom platform form EB:

You create a platform by providing Elastic Beanstalk with a Packer template, and the scripts and files that the template invokes to build an AMI.

However:

Elastic Beanstalk doesn't support custom platforms based on an Amazon Linux 2 AMI.

Not perfect, but maybe this option could be explored further towards using Deep Learning AMI with EB.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM