I\'m running a Flask webserver on an EC2 Ubuntu instance. The purpose is to capture the body of an incoming POST, write it to a file locally, then upload that file to S3.
You should make sure the program is actually trying to write in the directory you want it to write to. It could be that it tries to write into the directory of the Python binary (or anything else), that depends on your command and the current working directory. For testing purposes you might try to change the path like so (make sure /tmp is writeable for the user, which should be the case):
with open('/tmp/test.json', 'w') as f:
f.write(data)