App engine connection to cloud storage

158 views
Skip to first unread message

Punita Goel

unread,
Oct 8, 2020, 10:57:10 AM10/8/20
to Google App Engine
In my Springboot based JAVA app, how can I specify the address of cloud storage to access it directly without using "Storage" GCP Java classes. With windows local app, I am using application.properties file to specify the same, and access it directly. 

If I try to replace the same "E:/folder1/folder2" with "gs://bucket1/folder1/folder2"
it gives me error: 
Constructor threw exception; nested exception is java.nio.file.FileSystemException: /workspace/gs:: Read-only file system. 
Meaning it is trying to find the path in the same workspace as where the jar/war file is placed.

Any help?

Alexis (Google Cloud Platform Support)

unread,
Oct 8, 2020, 6:14:37 PM10/8/20
to Google App Engine

Hi,

I'll try to assist the best I can.

The main issue here is that what you are doing is an http request and not local to the machine. For example "gs://" is essentially the gsutil tool wrapping-up an HTTP request and emulating locally, but it's not part of the local file system. Whereas the library you are using thinks it's manipulating the file system. Hence the problem you are having.

The workaround would be this[1], which consists of "mounting" GCS to the filesystem using Cloud Storage FUSE. But the problem is that it's an anti-pattern on App Engine. App Engine is ephemeral and could have many instances with these mounts. You are bypassing a library with concurrency for when many instances would talk to the same database. This means it may work if you only max one instance, but you could have problems after more than one instance is talking to the same files. It just doesn't make sense architecturally, but it may work. Use at your own risk. 

Let me know if there's something I'm not seeing or why you can't use the library provided.


Punita Goel

unread,
Oct 12, 2020, 9:53:42 AM10/12/20
to Google App Engine
I get it. Thank you for your response. Guess I will have to go for the library only and write extra lines of code. Since FUSE itself says "use it at your own risk". But thank you for providing the architectural details of engine. This would help me otherwise.
Reply all
Reply to author
Forward
0 new messages