How to use code from a third party python class in a repo when deploying a lambda function using AWS CDK

Viewed 99

I have a repo, let's call it 3rdPartyRepo. Within that repo lies a python file, call it PyFile.py, and within that file, there is a function, functionToUseForLambda, which I want to use as code for my lambda function.

Given that my AWS CDK deployment code lies in another repo, what is the best way to set functionToUseForLambda as the code for a lambda function when defining a stack? That is, what should I put in the "<CODE_GOES_HERE>" section for the code snipped below?

class RawDataStack(core.Stack):
    ...
    handler = Function(self, "initial-load-lambda",
                       runtime=Runtime.PYTHON_3_8,
                       code=<CODE_GOES_HERE>,
                       handler="test.lambda_handler",
                       environment={"BUCKET": raw_bucket.bucket_name})

Thanks in advance!

0 Answers
Related