Python Read-only file system Error With S3 and Lambda when opening a file for reading

前端 未结 3 549
滥情空心
滥情空心 2020-12-02 18:35

I\'m seeing the below error from my lambda function when I drop a file.csv into an S3 bucket. The file is not large and I even added a 60 second sleep prior to opening the f

相关标签:
3条回答
  • 2020-12-02 18:45

    Only /tmp seems to be writable in AWS Lambda.

    Therefore this would work:

    filepath = '/tmp/' + key
    
    0 讨论(0)
  • 2020-12-02 19:03

    I noticed when I uploaded a code for lambda directly as a zip file I was able to write only to /tmp folder, but when uploaded code from S3 I was able to write to the project root folder too.

    0 讨论(0)
  • 2020-12-02 19:04

    According to http://boto3.readthedocs.io/en/latest/guide/s3-example-download-file.html

    The example shows how to use the first parameter for the cloud name and the second parameter for the local path to be downloaded.

    in other hand, the amazaon docs, says

    Thus, we have 512 MB for create files. Here is my code for me in lambda aws, for me works like charm.

    .download_file(Key=nombre_archivo,Filename='/tmp/{}'.format(nuevo_nombre))
    
    0 讨论(0)
提交回复
热议问题