Automatically update AWS Lambda Runtime With Python

Python for devops v1.2 — Writing Python script to upgrade AWS lambda functions running outdated/unsupported runtimes.

Akhilesh Mishra
6 min readJul 7, 2024
Photo by Tai Bui on Unsplash

This is the second blog post on my blog series Python for DevOps where I explore real-world devops use cases to write Python scripts.

Python for devops part 1 — Automate encryption of SQS queues
Python for Devops part 3— Building a RESTful API with Flask and PostgreSQL.

Scenario

Suppose you got a report from the security team complaining about hundreds of Lambda functions running unsupported runtime such as Python 3.8 and Node.js 14x. Remember, AWS won’t automatically update outdated runtimes for your Lambda functions.

Manually updating all these Lambda functions can be a pain. As a responsible Devops engineer, you want to avoid these manual tasks and write a reusable Python script to automate these tasks.

What we will be doing in this blog post?

In this blog post, I will teach you how to automate updating lambda runtimes. Our script will take the desired Python versions as arguments, list the lambdas running older versions, and upgrade the runtime to the…

--

--

Akhilesh Mishra

DevOps engineer with expertise in multi-cloud, and various DevOps tools.