Upgrade Python runtime in CloudFormation templates
ProprietaryUpdate Python Lambda runtimes in CloudFormation and SAM templates to a target version. Bumps Runtime: python3.x properties (AWS::Lambda::Function, AWS::Serverless::Function, and the SAM Globals section) and python3.x entries in CompatibleRuntimes lists of Lambda layer versions. Indirection is followed: a YAML anchor aliased from a runtime value is bumped where it is defined, and a parameter referenced from a runtime value (!Ref or Ref:) has its Default and any AllowedValues bumped. Templates are recognized by content — AWSTemplateFormatVersion, an AWS:: Transform, or Resources with AWS:: resource types — so any YAML template is updated regardless of its file name or location. Only runtimes older than the target are changed; a runtime already on a newer version is left as-is.
org. openrewrite. python. migrate. UpgradePythonCloudFormationRuntimeRequired
The target Python version as MAJOR.MINOR (for example 3.12). Any patch component is dropped; the minor release is the upgrade target.
mod run . --recipe= org. openrewrite. python. migrate. UpgradePythonCloudFormationRuntime \
-P version=3.12Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.