I am writing files to Google app engine managed vm (flexible environment). I have deployed the code to cloud. The code opened the file and write it without show errors like permission errors. However, my another code trying to open the file failed with "No such file or directory".
I have printed the location directory, so I used ssh command, also cannot find the file inside managed vm. And I cannot find any documentation about writing files to local storage of managed VM.
So how to write it to managed vm? What is the default storage location? Why I cannot find the file?
The reason you can't find the file inside the VM is because the VM is running a Docker container, and your app is actually inside that container. If you really wanted to, you could docker exec -it <container-name> -- /bin/bash
to poke around inside the container and then you should see your file (use docker ps
to find the container ID).
On App Engine flexible (new name for Managed VMs), your code could be scaled across many container so there's no promise that a file you write to one will be accessible later. You can get away with dealing with some writing to some /tmp files but not much more. You will be much better off writing any data to something like Cloud Datastore, Cloud SQL, Memcache, or Cloud Storage.