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
gefragt vor 7 Monaten780 Aufrufe
2 Antworten
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
beantwortet vor 7 Monaten
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
EXPERTE
beantwortet vor 7 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen