How/where are files copied during execution in aws lambda?

0

I'm using fast api application and uploading the zip to create an aws lambda , based on this tutorial - https://guillaume-martin.github.io/deploy-fastapi-on-aws-lambda.html.

when i download the zip file , from the created lambda , i see all the files/directory structure in my project exist in the zip file . are all these files copied to the aws lambda enviornment? and is the directory structure maintain ? when i run the lambda code and print the current path via code below

import os 
print(os.getcwd())
===> var/task

I'm assuming this is some linux based container and file structure . where are other code files unzipped and saved during execution of lamba ? like say, i have a helper.py in my project folder, will i be able to reference the file , from my code using relative path , such that helper_file = "../helper.py" . I am aware that i can impot the files as python modules but , i'm curious , if all the files in the zip are copied to the lamba environment and the directory/file structure is maintained or not?

project/
    |_ venv/
    |_ app/
        |_ __init__.py
        |_ main.py
        |_ api/
            |_ __init__.py
            |_ api_v1/
                |_ __init__.py
                |_ api.py
                |_ helper.py
                |_ endpoints/
                    |_ __init__.py/
                    |_ myapp.py
已提問 7 個月前檢視次數 781 次
2 個答案
0

AWS Lambda includes a between 512 MB and 10,240 MB temporary file system (/tmp) for your code

https://aws.amazon.com/blogs/aws/aws-lambda-now-supports-up-to-10-gb-ephemeral-storage/

AWS
已回答 7 個月前
0

All files in your ZIP are copied to the Lambda function before execution. The documentation talks about how to package your dependencies into a ZIP - so it follows that those are extracted before execution so that your code can use them.

profile pictureAWS
專家
已回答 7 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南