I need to get python file from s3 bucket and use it in my AWS Lambda.
for eg file test.py file is stored in s3 bucket on some location. will use boto3 get_object() to get contents of the py file. now need to execute the py file in lambda?
Why using this and not Lambda Layers? Is more effective and cheap. You just need to import your .py code from the Layer.
Anyway, if you keep want to do this, you just need to name the get object result, convert it into "text" and then call it in the lambda
Example:
mycode = boto3.get_object(---)
mycode.toString or something like that
def lambda_handler():
mycode (try to exclude the def-lambda_handler in your "mycode" code)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.