-1

I want to store a folder from s3 inside aws /tmp, as a sub folder, and access it with Python in lambda. Haven't seen any documentation on this

mark7328
  • 41
  • 5
  • 3
    https://stackoverflow.com/questions/50946378/can-i-store-a-temp-file-on-aws-lambda-function – victor m Aug 25 '23 at 19:06
  • 1
    `/tmp` is just a file system - is should work just fine. But remember that you may have 1000 Lambda instances running at the same time. `/tmp` will not be shared between them. And if your Lambda does a cold start the data won't be there either. But if it's just temporary file storage it'll work great. – stdunbar Aug 25 '23 at 19:07
  • @stdunbar I'm trying to to create something like '/tmp/subdirectory/file.csv' – mark7328 Aug 25 '23 at 19:09
  • @victorm I know how to store to /tmp, I'm attempting to create a subfolder in /tmp – mark7328 Aug 25 '23 at 19:11
  • 1
    No reason that shouldn't work. You'll use something like `os.mkdir("/tmp/subdirectory")` and store your file. Of course, you should handle the possibility of an exception if it already exists from a previous run. – stdunbar Aug 25 '23 at 19:11
  • You can create subdirectories in /tmp. I personally have done it. Just don't expect the folder to be there in the next call. Cross calls move the file to s3. – victor m Aug 25 '23 at 19:20
  • Are you asking about Lambda's ephemeral storage folder `/tmp`, or something about S3? – Anon Coward Aug 25 '23 at 19:59
  • You can definitely create sub folders in the Lambda `/tmp` folder. If you are having an actual issue with that, please post more details of the issue. – Mark B Aug 25 '23 at 22:09

0 Answers0