简体   繁体   中英

How can I run a python script on demand from my PHP on Elastic beanstalk?

I set up a PHP web app on Elastic beanstalk (AWS), but I'd like to run a python script on demand ( click on button). My python script will update the database, and I will extract the result thanks to PHP. I don't know if anyone has good recommendations to do this, and if anyone can explain how to do it because I can't find a clear explanation on this topic.

A really good alternative would be to create an AWS Lambda function in Python, triggered by AWS API Gateway, such as the following architecture:

在此处输入图像描述

In your PHP code, when the button is clicked, you will make an API Call to API Gateway, that will trigger the Lambda function, and update the database and return the desired result.

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