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
asked 6 months ago711 views
2 Answers
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
answered 6 months ago
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
EXPERT
answered 6 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions