0

GCP is a new thing for me but i want to know if it's possible to copy a specific file (e.g : myFiles.csv) from a bucket in the project A to a bucket in the project B every monday at 6.00 am ?

I need it because myFiles.csv is overwritten every Monday and i need to share it with the project B.

al-dann
  • 2,545
  • 1
  • 12
  • 22
  • Can you have a look at a transfer service - https://cloud.google.com/storage-transfer/docs/overview are there any reasons it cannot be used in your case? – al-dann Oct 14 '22 at 07:47

2 Answers2

1

You can use Storage transfer : https://cloud.google.com/storage-transfer/docs/create-transfers#google-cloud-console

With this service, you can select the source and destination bucket and scheduling options, every day in your case.

enter image description here

Source bucket project GCP A :

enter image description here

In this example, I selected a folder team_league in a bucket called mazlum_dev

In the prefix field, I added the name of the file I want to transfer input_team_slogans.json

You have to put your file name for your job.

Destination bucket project B :

enter image description here

You have to select the output folder of your destination bucket.

Sheduling options :

enter image description here

You can also use the GCloud sdk if needed with gsutil :

gsutil cp gs://your_bucket_project_a/your_file gs://your_bucket_project_b/output/

But you have to find a way to cron this script every day, that's why I recommend the first solution because everything is native and integrated for your need.

Mazlum Tosun
  • 5,761
  • 1
  • 9
  • 23
0

Follow below steps :

Click on this Web console link Storage > Transfer to create a new transfer. Then Select the source bucket you want to copy from ex.Project A. So once you go to the destination part of the transfer form, you can write/paste the target bucket (Ex. Project B) right in its text input. Even if that bucket is from another project. It will show you a green icon once the target has been verified as being an existing bucket. You can continue the form again to finalize your setup.

Once you start the transfer from the form, you can follow its progress by hitting the refresh button on top of the console.

As the bucket identifiers are globally unique (this is key to the solution).

Refer this SO Link for more information.

Hemanth Kumar
  • 2,728
  • 1
  • 4
  • 19