Local file system access in AWS lambda

Is it possible to access the local file system in the AWMS lambda function? If so, is there a flaw in this?

+18
source share
2 answers

It is possible. I have a python function that does something like

localFilename = '/tmp/{}'.format(os.path.basename(key)) s3.download_file(Bucket=bucket, Key=key, Filename=localFilename) inFile = open(localFilename, "r") 

Make sure that you use it for temporary storage and do not support any state. Depends on what you are trying to do.

+21
source

From the AWS Lambda execution context :

Each execution context provides 512 MB of additional disk space in the / tmp directory . The contents of the directory remain when the execution context is frozen, providing a temporary cache that can be used for multiple calls. You can add additional code to check if there is data in the cache that you saved. For information on deployment restrictions, see AWS Lambda Limits .

0
source

All Articles