I want to use the code in my CodeCommit repository to be used as lambda function instead of writing the complete code in lambda itself. Is it possible to achieve that?
Not by default in console or cli, but this is very common in CI/CD pipelines. CodeCommit -> CodeBuild (or some other tools) -> Lambda In more detail, usually, there is a pipeline (CodePipeline, CircleCI, Jenkins etc) which is triggered by commit in the repo, then pipeline clone code, CodeBuild(some other tool) process it, then pipeline deploys it to lambda. In the case of lambda code preparation, the usual process in CodeBuild is to zip the lambda code and publish it to artifacts bucket.