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?
If you have been publishing versions, you can go to the versions tab and select a previous version
From within that version, there is an option to download the code
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.