Upgrading Secrets Manager Lambda rotation functions from Python 3.7 to 3.9 or above may cause different dependency errors when the code is executed. Different methods may help to resolve the problem.
1. Scenario
Customers who have deployed the Secrets Manager Lambda rotation function in the past may still be using the Python 3.7 runtime, which was deprecated in 2023 and will have updates blocked in February 2025. In some cases, simply updating it to Python 3.9 or newer can cause dependency errors, as the function environment could still have modules built for Python 3.7 specifically.
2. Solution
Secrets Manager official documentation describes two methods to resolve the error, which should help to have your Lambda environment running with the correct libraries:
Option 1 will recreate the function entirely and is less susceptible to errors.
3. Conclusion
Follow the steps as described on the documentation, preferably the recreation option. If you have any issues, please create a technical support case and one of our support engineers will assist you.