Transferring data across the GCS Buckets
There are multiple ways of dealing with the data transfer in and out of the bucket. Please go through the previous post for getting the background of Google cloud storage buckets and its concepts.
Uploading files through the web console
Select the specific bucket and click on the upload file option.
Select the desired file/files and upload them.
Uploading files through command-line
Copying the file to the bucket
gsutil cp README-cloudshell.txt gs://datacloudies-bucket1/
Listing the files from GCS bucket
gsutil ls -l gs://datacloudies-bucket1/
Copying/Moving data from one bucket to another using web console
Go to the bucket and select the particular file, select option to copy/move the file
Select the permissions accordingly, select the destination bucket and copy the file
Copying files from one bucket to another through command-line
Sometimes, if you have a different class in the destination bucket, it only allows through the command line.
gsutil cp -p gs://"datacloudies-bucket1/Copy of e41959-rac.pdf" gs://"datacloudies-bkt-gsutil/Copy of Copy of e41959-rac.pdf"
Verify the copied file in the target bucket.
Below command for moving the file between the buckets.
gsutil mv -p gs://"datacloudies-bucket1/Copy of e41959-rac.pdf" gs://"datacloudies-bkt-gsutil/Copy of Copy of e41959-rac.pdf"
-p denotes to keep the previous permissions of the files.
To summarize this, we have successfully completed the data transfer operations across various scenarios, like one bucket to another bucket, copy/move from on-premise to cloud GCS using web console and command-line utility. Thank you for reading it. Please do follow the next posts for learning more GCS topics.