1回答
- 新しい順
- 投票が多い順
- コメントが多い順
0
If I understand your question correctly: You have a web application and you want to send two values to a Python script; have it perform some operation and return a result.
While you could do this with EC2 I wouldn't recommend it - you would have a whole instance running all the time even when your web application isn't requesting any results.
Instead, consider using Lambda. Create a Lambda function using Python then publish that function using Lambda function URLs - you pass the two values to the URL and it executes the Lambda function, returning the appropriate value.
Brettski, I know it's not recommended for simple tasks, but the actual application is image processing.
The S3 bucket folder name is the argument value. It takes a minimum of two to three hours to complete.
I have tested the script manually and it works well. I want to automate it on the EC2 instance
Thanks
Thanks for expanding on the question. In that case, I would use SQS: Send the job details to a SQS queue; have EC2 instances scale based on the length of the queue (that way you can run zero instances when there are no jobs; and you can scale to more instances if necessary); then your script on the EC2 instances reads the job details from the SQS queue. Don't forget to set the message visibility timeout to several hours. Note that you can create the SQS message as a trigger from S3 when the object is uploaded.