This is a very inexperienced question. I've only ever deployed/hosted web applications so I don't understand what the system would have to look like if I want a CLI-like program hosted for anyone else to run.
It is a python script and I want it on AWS (probably will use a docker container, ECS, and terraform. So I suppose this is mainly a question about how to build the image).
The script takes flags/commands, runs while terminal printing for a few minutes, and then stops once finished. How do I host/build this so that anyone can access it through their shell/terminal? Is some sort of server akin to a http server required? There is no front end for it. And ideally many people can run this at once at any time.
EDIT: correction, there is no web GUI frontend... I add this to clear-up my loose use of these terms. Is this in principle an API?
CodePudding user response:
I would encourage you to look into AWS Lambda for something like this. AWS Lambda allows you to run code (including Python) without having to think about the servers are configured. One of the main benefits is you only pay for the time the software is actually executing, rather than paying for a Virtual Machine running idle.
As you mention, if you want to move towards an 'API' design where other users can call your service, you can use Amazon API Gateway in front of the Lambda code to handle this. There are really good examples of these design patterns here: https://serverlessland.com/patterns
Something like this one: https://serverlessland.com/patterns/apigw-lambda-cdk sounds like what you are looking for, but as mentioned by SecurityObscurity, you will need to think about authentication and authorisation. This could be handled by AWS Cognito or IAM authorisation depending on your use case.
