To emulate production, I want to copy a file to my local google storage (app_default_bucket) maintained by the app engine launcher. This is performed via 'gsutil cp' in production. I would like to do the same locally. Possible?
I would like to avoid writing an app just for local use.
The gsutil cp command allows you to copy data between your local file system and the cloud, within the cloud, and between cloud storage providers. For example, to upload all text files from the local directory to a bucket, you can run: gsutil cp *.txt gs://my-bucket. You can also download data from a bucket.
Which command would you use to move objects between two cloud storage buckets? To copy any single object from one GCS location to another, you can use the copy command. This can be done from either of our public APIs, or by using the command-line client, gsutil.
The gsutil tool has commands such as mb and cp to perform operations.
Since GCS local storage (localhost:8000/_ah/gcs/app_default_bucket) is mapped to /tmp/storage directory (at least on Linux) and cp command supports directory destination, copying files from a bucket to local storage is just a matter of:
gsutil -m cp -r gs://[my-bucket] /tmp/storage
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With