title: Read-only file system: 'data.json': IOError in aws lambda function
body: <p>I am trying to read data from PDF stored in S3 bucket, convert it to text and then dump these text into json file.</p>
  
  <p>Finally I want to upload this json file to elastic search for indexing. </p>
  
  <p>I have written below code snippet for doing this:</p>
  
  <pre><code>with open('data.json','w') as f:
          json.dump(doc,f)
          dataj=json.load(f)
          doc_data=dataj[:]
  </code></pre>
  
  <p><code>doc</code> is the text which I have extracted using pdfminer.
  when executing this code I'm getting  below error.</p>
  
  <pre><code>[Errno 30] Read-only file system: 'data.json': IOError
  Traceback (most recent call last):
  File "/var/task/lambda_function.py", line 56, in lambda_handler
  raise e
  IOError: [Errno 30] Read-only file system: 'data.json'.
  </code></pre>
  
  <p>Someone please help me in finding what I'm doing wrong here.</p>