This app creates two types of transfers using the Transfer Service tool.
These samples are used on the following documentation pages:
- https://cloud.google.com/storage/transfer/create-client
- https://cloud.google.com/storage/transfer/create-manage-transfer-program
- Set up a project on Google Developers Console.
- Go to the Developers Console and create or select your project. You will need the project ID later.
- Within Developers Console, select APIs & auth > Credentials.
- Select Add credentials > Service account > JSON key.
- Set the environment variable GOOGLE_APPLICATION_CREDENTIALS to point to your JSON key.
- Add the Storage Transfer service account as an editor of your project [email protected]
- Set up gcloud for application default credentials.
gcloud components update
gcloud init
- Install Google API Client Library for Python.
Creating a one-time transfer from Amazon S3 to Google Cloud Storage.
- Set up data sink.
- Go to the Developers Console and create a bucket under Cloud Storage > Storage Browser.
- Set up data source.
- Go to AWS Management Console and create a bucket.
- Under Security Credentials, create an IAM User with access to the bucket.
- Create an Access Key for the user. Note the Access Key ID and Secret Access Key.
- In aws_request.py, fill in the Transfer Job JSON template with relevant values.
- Run with
python aws_request.py
- Note the job ID in the returned Transfer Job.
Creating a daily transfer from a standard Cloud Storage bucket to a Cloud Storage Nearline bucket for files untouched for 30 days.
- Set up data sink.
- Go to the Developers Console and create a bucket under Cloud Storage > Storage Browser.
- Select Nearline for Storage Class.
- Set up data source.
- Go to the Developers Console and create a bucket under Cloud Storage > Storage Browser.
- In nearline_request.py, fill in the Transfer Job JSON template with relevant values.
- Run with
python nearline_request.py
- Note the job ID in the returned Transfer Job.
- In transfer_check.py, fill in the Transfer Job JSON template with relevant values. Use the Job Name you recorded earlier.
- Run with
python transfer_check.py