title: Write to /tmp directory in aws lambda with python
body: <p><strong>Goal</strong></p>
  
  <p>I'm trying to write a zip file to the /tmp folder in a python aws lambda, so I can extract manipulate before zipping, and placing it in s3 bucket.</p>
  
  <p><strong>Problem</strong></p>
  
  <p>Os Errno30 Read Only FileSystem</p>
  
  <p>This code was tested locally on my computer to make sure the file would write to my working directory before I uploaded it to aws. This is the code i'm trying to use.</p>
  
  <pre><code>file = downloadFile() #This is api call that returns binary zip object
  newFile = open('/tmp/myZip.zip','wb')
  newFile.write(file)
  extractAll('/tmp/myZip.zip')
  </code></pre>
  
  <p>here is the code that is trying to extract the zip file</p>
  
  <pre><code>def extractAll(self,source):
          with zipfile.ZipFile(source, 'r') as archive:
              archive.extractall()
  </code></pre>
  
  <p>here is the trace</p>
  
  <pre><code>[Errno 30] Read-only file system: '/var/task/test-deploy': OSError
  Traceback (most recent call last):
  File "/var/task/web.py", line 31, in web
  performAction(bb, eventBody)
  File "/var/task/src/api/web.py", line 42, in performAction
  zipHelper.extractAll('/tmp/myZip.zip')
  File "/var/task/src/shared/utils/zipfilehelper.py", line 24, in extractAll
  archive.extractall()
  File "/var/lang/lib/python3.6/zipfile.py", line 1491, in extractall
  self.extract(zipinfo, path, pwd)
  File "/var/lang/lib/python3.6/zipfile.py", line 1479, in extract
  return self._extract_member(member, path, pwd)
  File "/var/lang/lib/python3.6/zipfile.py", line 1538, in _extract_member
  os.mkdir(targetpath)
  OSError: [Errno 30] Read-only file system: '/var/task/test-deploy'
  </code></pre>