By Alex Muller
I hate the idea of vendor lock-in, but I’ve found myself using AWS Lambda more and more often this year. And while neither of these uses are going to change the world, it’s lovely to have an easy, maintenance-free way of running code periodically.
I’m lucky that both of these are just little side projects which I don’t need to care too much about, so I haven’t had to think about setting up deployments for a team or monitoring or any of that supporting stuff. The web interface works well and is quick enough to get set up with.
The Lambda free tier is ludicrously generous for personal use, with 1 million invocations and about 74 hours of compute time per month (at the maximum 1.5GB memory). If you’re cynical then I guess they do that precisely so that people use it for things like this and then bring it to work.
Earlier this year I switched to Overcast because my old podcast client stopped being updated. Overcast is great in lots of ways but it doesn’t support XML feeds behind a paywall, which was unfortunate because I’d just started paying for a subscription to LBC’s password-protected full show podcasts.
This is a great use-case for Lambda. I wanted a bit of code which would run periodically, access the XML feed with my password and put it somewhere secret that didn’t have a password.
So I wrote a script that does exactly that:
CloudWatch Events schedules this script and runs it every 15 minutes for me and it’s worked flawlessly for the last 5 months.
The code’s available on GitHub.
This one’s a little more nerdy and a little less necessary. I cycle to work and use Strava to see how far I’ve ridden. But I like things being named properly and I’d rather not have a load of “Morning Ride” and “Evening Ride” every day on my profile.
I’d been renaming those things in the Strava interface and it took me too long to realise that it was a huge waste of my time and I should get a computer to do it for me. So I wrote a little script:
As before CloudWatch Events makes this super easy to schedule with an expression like rate(1 hour)
.
Again, the code is on GitHub if you want to see it. As this was the second time I’ve used Lambda I had a quick look around for something that might make Lambda easier to develop against and settled on python-lambda for my simple needs.
Written on Wednesday 20 September, 2017