user3777228
user3777228

Reputation: 159

Data Transfer between Google Storage different Service Accounts

I have two Google Service Credentials and a bucket on each account .I have to transfer files from one bucket to another. How can I do this programmatic ally? Can I achieve this with two Storage objects or using the Cloud storage Transfer service?

Upvotes: 2

Views: 1500

Answers (1)

coyote-tango
coyote-tango

Reputation: 39

Yes, with Storage Transfer Service you can create a transfer job and send the data to a destination bucket (in another project), keep in mind that it is documented that:

To access the data source and the data sink, this service account must have source permissions and sink permissions.

Meaning that you can't use two different service accounts, you will need to grant access to only one of the two service accounts you have.

If you want to transfer files from one bucket to another programmatically. First, you must grant permission to the service account associated with the Storage Transfer Service so it can access the data sink(destination bucket), please follow these steps.

Please note that if you are not creating the transfer job in the same project where the source bucket is located, then you must grant permissions to access it.

With Storage Transfer Service you can create a transfer job programmatically with Java and Python, examples include creating the transfer job and checking the transfer operation status. Full code example can be found for Java and Python.

Upvotes: 3

Related Questions