Open david-a opened 4 years ago
but I feel like having this script to run on a regular schedule is a must.
Oh yeah. My original intent was to turn this into a small docker image and a simple systemd timer to wrap podman and deploy it to a host that is always on.
But It shouldn't be too much terraform code to get a simple lambda deployed and wired into a cloudwatch scheduled expression. I don't remember what the free tier is for lambda invocations, but it's got to be orders of magnitude higher than the 7? invocations a week you'd put this little bridge script through.
AFAIK this is the aws Lambda free tier limits -
1,000,000 free requests per month Up to 3.2 million seconds of compute time per month
As you said, way higher than what we need here...
Also, what do you think of the way I handled configuration in the remote version? Command line parameters are passed as the event input to the Lambda, and the config.ini details are stored in a secure AWS SSM json parameter.
1M/mo is ... a ton. Glad to know this can safely run on AWS Free tier!
Haven't tested the code, yet. Using JSON that parses into the same dict that the cfgparse is wise. In the past, i've used this https://github.com/nficano/python-lambda
to make localized testing of lambda functions a lot easier. I've not yet used SSM, but if it's less clunky than KMS, it's probably a good compromise. Especially so if the code is updated to take an initial token expiration datetime + auto renew. That is, user must do the oAuth dance w/ Exist the first time, but once a token + renewal token is obtained, there should be no reason for people to have to set an annual token refresh reminder.
Haven't tried https://github.com/nficano/python-lambda, but good to know ! About that "dance" - I haven't used the cmd line in order to get the token.. Just opened an App through the exist.io website and it gave me the token - very easy. maybe you can update the Readme to use it too.
I've Forked this project and added a basic support for AWS Lambda. If you dig it, I can make a pull request from my fork. https://github.com/david-a/exist-duolingo-bridge/commit/9c7a0aa2bbaefe740691220b55546e399ff44a4c
It's very basic, also with basic instructions in the Readme, without an automatic package/deploy script, but I feel like having this script to run on a regular schedule is a must.