Search code examples
amazon-web-servicesaws-lambda

How can I recover deleted AWS Lambda code?


I've overwrote an AWS Lambda by accidented and replaced by uploading a zip file containing code for other Lambda function.

Is there any way to recover the previous code?

Moving forward - what's the best practice for deploying Lambda functions code?


Solution

  • If you have been publishing versions, you can go to the versions tab and select a previous version

    enter image description here

    From within that version, there is an option to download the code

    enter image description here

    As suggested in the comments, use a framework like Serverless (https://www.serverless.com/) to handle your deployments properly, and signup for Github to maintain your source code.