SAM template and CI/CD for Lambda function

Hi, how to write a SAM template(if necessary) and implement CI/CD for pre-existing lambda function?

There’s https://aws.amazon.com/blogs/compute/introducing-aws-sam-pipelines-automatically-generate-deployment-pipelines-for-serverless-applications/

But you’re talking about a lambda that was written manually? Not sure about importing it, any way to stand up a second stack in parallel and then cut over?