- Newest
- Most votes
- Most comments
Running a python script on an EC2 instance is no different from running it on a VM in your on-prem data center or your personal machine. You can take a look at this Stackoverflow post for an example of how to run a python script and pass arguments to it - https://stackoverflow.com/questions/14155669/call-python-script-from-bash-with-argument
In AWS, there are other ways to achieve the same thing without having to provision an EC2 machine by using serverless mechanisms such as Glue Python Shell or AWS Lambda
Glue Python Shell - https://docs.aws.amazon.com/glue/latest/dg/add-job-python.html
Lambda function - https://docs.aws.amazon.com/lambda/latest/dg/lambda-python.html
The advantage with serverless approaches is that you pay only when your program runs. With EC2 machine, you will pay as long as your machine is on, even if it is sitting there doing nothing. Plus you will be responsible for patching the machines.
Relevant content
- asked a month ago
- asked 2 years ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 7 months ago