Copy files from one bucket to another
The first data operation of this tutorial will consist in transferring the files from one bucket located in one GCP project to another bucket located in a different GCP project.
Last updated
The first data operation of this tutorial will consist in transferring the files from one bucket located in one GCP project to another bucket located in a different GCP project.
Last updated
Access your tailer folder (created during installation).
Create a working folder named tailer-demo for this tutorial, and inside create a folder named 1-Copy_files for this step.
In your 1-Copy_files folder, create a JSON file named 000099-tailer-demo-sts.json for your data operation.
Copy the following contents into your file:
Take note of the different parameters. For detailed information on storage-to-storage configuration file parameters, refer to this page.
Edit the following values: ◾ In the source section, replace my-gcp-project with the ID of the GCP project containing your source bucket. ◾ In the source section, replace my-source-bucket with the name of the GCS bucket containing the source files. ◾ In the source section, replace the value of the gcp_credentials_secret parameter with the service account credentials for the source GCP project. If you haven't generated them yet, refer to this page. ◾ In the destinations section, replace my-destination-bucket with the name of the GCS bucket that will contain the output files. ◾ In the destinations section, replace the value of the gcp_credentials_secret parameter with the service account credentials for the destination GCP project. If you haven't done it yet, refer to this page. ◾ If you share the demo project with other developers, then in the configuration_id, replace YOUR-NAME by a personal value, like your name. This way, you won't overwrite a configuration deployed by someone else. You should also add your name in the source's gcs_source_prefix and archive_prefix, and in the destinations' gcs_destination_prefix to avoid any interferences with another developer's data operation.
Your JSON file is now ready to use.
Once your JSON file is ready, you can deploy the data operation:
Access your working folder by running the following command:
To deploy the data operation, run the following command:
You may be asked to select a context (see this page for more information). If you haven't deployed any context, then choose "no context". You can also use the flag --context to specify the context of your choice, or NO_CONTEXT if that's what you want:
Access Tailer Studio.
Sign in with your Tailer Platform credentials.
In the left navigation menu, select Storage-to-storage.
In the Configurations tab, search for your data operation. You can see its status is Activated.
Click the data operation ID to display its parameters and full JSON file, or to leave comments about it.
Now that our configuration is deployed, we can test it. Let's mimic production behavior. Access the folders you created when preparing the demonstration environment:
In your source bucket, copy a file. The file name must match one of the filename_template specified in the configuration.
On Tailer Studio, in the Storage-to-Storage section, Runs tab, you should see a run for your data operation. It should appear as "running" and quickly get the status "success".
In your source bucket, input-folder should be empty.
In your source bucket, archive-tailer-demo-folder should contain a folder for each input file, named as the filename date.
In your destination bucket, input-tailer-demo-folder should contain a copy of the input files.
You can see in the Storage to Storage documentation that you can handle different use cases with this data operation:
You can add multiple destinations to share data with different consumers.
You can send data to external partners. You just need a service account (or a user and a password) that can access the destination. Then you generate credentials associated with it (see documentation here) and specify it in the "destinations" object.
You can work with Google Cloud Storage, but also Amazon S3, Azure and SFTP.