Reputation: 177
I am trying to send inputs to my python script running on EC2 instance using the AWS API gateway. The workflow is as follows:
Users send an API request to AWS API gateway with parameters. The AWS API gateway then triggers the python script with the arguments passed in the API call.
However, I am unable to find any way in which the AWS API gateway can trigger a python script or pass an argument into an always running python script.
Any guidance on best practices to achieve this
Upvotes: 3
Views: 2114
Reputation: 5482
API Gateway can't interact directly with Python running in EC2. API Gateway has HTTPS endpoints. You will need to either have Python react to HTTPS requests directly or use the AWS Python SDK
Here's some general reading on Python and APIs
https://realpython.com/blog/python/api-integration-in-python/
Here's AWS boto3 SDK https://aws.amazon.com/sdk-for-python/
I would check these out and when you feel like you're getting close ask another question and provide details on your code
Good luck!
Upvotes: 0