Creating and managing data transfers programmatically

This page shows you how to use Storage Transfer Service directly through the REST API,
and programmatically with Java and Python in two common scenarios. To create a
transfer job using the Google Cloud Platform Console, see Creating and Managing Transfers with
the Console.

When you configure or edit transfer jobs programmatically using the Storage
Transfer API, the time must be in UTC. For more information on specifying the
schedule of a transfer job, see
Schedule.

Before you start

Before you can set up transfer jobs in the GCP Console, make sure you
have the necessary access:

Cloud Storage access: You must be the Owner or Editor of the
project that manages the data transfer. This project does not have to be
associated with either the source or sink.

Source and sink access: Storage Transfer Service uses a service account to perform
transfers. To access the data source and the data sink, this service account
must have source permissions and
sink permissions.

Transfer from Amazon S3 to Cloud Storage

In this example, you'll learn how to move files from Amazon S3 to a
Cloud Storage bucket. Be sure to review
Configuring Access and
Pricing to understand the implications of
moving data from Amazon S3 to Cloud Storage.

Check transfer operation status

For either of the examples above, you might want to check the status of your
transfer operation. The following example code returns the status of a transfer operation
based on a job ID and your project ID.

Cancel transfer operations

To cancel a single transfer operation, use the transferOperations cancel
method. To delete an entire transfer job, including future transfer operations
that are scheduled for it, set the transfer job's status to DELETED using
the transferJobs patch method. Updating a job's transfer status doesn't affect
transfer operations that are currently running. To cancel an in-progress transfer
operation, use the transferOperations cancel method.