Accessing local filesystem in AWS lambda

It is possible. I have 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")

Be sure you are using it for temporary storage and not to maintain any state. Depends on what you are trying to do.


From AWS Lambda Execution Context:

Each execution context provides 512 MB of additional disk space in the /tmp directory. The directory content remains when the execution context is frozen, providing transient cache that can be used for multiple invocations. You can add extra code to check if the cache has the data that you stored. For information on deployment limits, see AWS Lambda Limits.

Tags:

Aws Lambda