title: How to append to json file on AWS S3
body: <p>I need to append to a json file on aws S3, python code is running on an EC2 instance. </p>
  
  <p>In a local setting I can easily do this as follows:</p>
  
  <pre><code>import json
  
  #example data
  json_data = {"id": "123", "name": "XYZ", "transaction": [20.0, 30.0]}
  # path
  local_path = '/home/ubuntu/test.json'
  
  with open(local_path, 'a', encoding='utf-8-sig') as file:
      json.dump(json_data, file)
      file.write('\n')
      file.close()
  </code></pre>
  
  <p>On EC2 I can connect to S3 as follows:</p>
  
  <pre><code>import boto
  s3_open = boto.connect_s3(host='s3.eu-central-1.amazonaws.com')
  </code></pre>
  
  <p>I define the path to S3:</p>
  
  <pre><code>s3_path = 's3://my-bucket/test.json'
  </code></pre>
  
  <p>How can I append to this file using the logic described above?</p>