Corentin Moreau
Corentin Moreau

Reputation: 111

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.

Upvotes: 0

Views: 112

Answers (1)

filipebarretto
filipebarretto

Reputation: 1952

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

enter image description here

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.

Upvotes: 3

Related Questions