github.com/xhghs/rclone@v1.51.1-0.20200430155106-e186a28cced8/docs/content/googlecloudstorage.md (about)

     1  ---
     2  title: "Google Cloud Storage"
     3  description: "Rclone docs for Google Cloud Storage"
     4  date: "2017-07-18"
     5  ---
     6  
     7  <i class="fab fa-google"></i> Google Cloud Storage
     8  -------------------------------------------------
     9  
    10  Paths are specified as `remote:bucket` (or `remote:` for the `lsd`
    11  command.)  You may put subdirectories in too, eg `remote:bucket/path/to/dir`.
    12  
    13  The initial setup for google cloud storage involves getting a token from Google Cloud Storage
    14  which you need to do in your browser.  `rclone config` walks you
    15  through it.
    16  
    17  Here is an example of how to make a remote called `remote`.  First run:
    18  
    19       rclone config
    20  
    21  This will guide you through an interactive setup process:
    22  
    23  ```
    24  n) New remote
    25  d) Delete remote
    26  q) Quit config
    27  e/n/d/q> n
    28  name> remote
    29  Type of storage to configure.
    30  Choose a number from below, or type in your own value
    31  [snip]
    32  XX / Google Cloud Storage (this is not Google Drive)
    33     \ "google cloud storage"
    34  [snip]
    35  Storage> google cloud storage
    36  Google Application Client Id - leave blank normally.
    37  client_id>
    38  Google Application Client Secret - leave blank normally.
    39  client_secret>
    40  Project number optional - needed only for list/create/delete buckets - see your developer console.
    41  project_number> 12345678
    42  Service Account Credentials JSON file path - needed only if you want use SA instead of interactive login.
    43  service_account_file>
    44  Access Control List for new objects.
    45  Choose a number from below, or type in your own value
    46   1 / Object owner gets OWNER access, and all Authenticated Users get READER access.
    47     \ "authenticatedRead"
    48   2 / Object owner gets OWNER access, and project team owners get OWNER access.
    49     \ "bucketOwnerFullControl"
    50   3 / Object owner gets OWNER access, and project team owners get READER access.
    51     \ "bucketOwnerRead"
    52   4 / Object owner gets OWNER access [default if left blank].
    53     \ "private"
    54   5 / Object owner gets OWNER access, and project team members get access according to their roles.
    55     \ "projectPrivate"
    56   6 / Object owner gets OWNER access, and all Users get READER access.
    57     \ "publicRead"
    58  object_acl> 4
    59  Access Control List for new buckets.
    60  Choose a number from below, or type in your own value
    61   1 / Project team owners get OWNER access, and all Authenticated Users get READER access.
    62     \ "authenticatedRead"
    63   2 / Project team owners get OWNER access [default if left blank].
    64     \ "private"
    65   3 / Project team members get access according to their roles.
    66     \ "projectPrivate"
    67   4 / Project team owners get OWNER access, and all Users get READER access.
    68     \ "publicRead"
    69   5 / Project team owners get OWNER access, and all Users get WRITER access.
    70     \ "publicReadWrite"
    71  bucket_acl> 2
    72  Location for the newly created buckets.
    73  Choose a number from below, or type in your own value
    74   1 / Empty for default location (US).
    75     \ ""
    76   2 / Multi-regional location for Asia.
    77     \ "asia"
    78   3 / Multi-regional location for Europe.
    79     \ "eu"
    80   4 / Multi-regional location for United States.
    81     \ "us"
    82   5 / Taiwan.
    83     \ "asia-east1"
    84   6 / Tokyo.
    85     \ "asia-northeast1"
    86   7 / Singapore.
    87     \ "asia-southeast1"
    88   8 / Sydney.
    89     \ "australia-southeast1"
    90   9 / Belgium.
    91     \ "europe-west1"
    92  10 / London.
    93     \ "europe-west2"
    94  11 / Iowa.
    95     \ "us-central1"
    96  12 / South Carolina.
    97     \ "us-east1"
    98  13 / Northern Virginia.
    99     \ "us-east4"
   100  14 / Oregon.
   101     \ "us-west1"
   102  location> 12
   103  The storage class to use when storing objects in Google Cloud Storage.
   104  Choose a number from below, or type in your own value
   105   1 / Default
   106     \ ""
   107   2 / Multi-regional storage class
   108     \ "MULTI_REGIONAL"
   109   3 / Regional storage class
   110     \ "REGIONAL"
   111   4 / Nearline storage class
   112     \ "NEARLINE"
   113   5 / Coldline storage class
   114     \ "COLDLINE"
   115   6 / Durable reduced availability storage class
   116     \ "DURABLE_REDUCED_AVAILABILITY"
   117  storage_class> 5
   118  Remote config
   119  Use auto config?
   120   * Say Y if not sure
   121   * Say N if you are working on a remote or headless machine or Y didn't work
   122  y) Yes
   123  n) No
   124  y/n> y
   125  If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth
   126  Log in and authorize rclone for access
   127  Waiting for code...
   128  Got code
   129  --------------------
   130  [remote]
   131  type = google cloud storage
   132  client_id =
   133  client_secret =
   134  token = {"AccessToken":"xxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","RefreshToken":"x/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_xxxxxxxxx","Expiry":"2014-07-17T20:49:14.929208288+01:00","Extra":null}
   135  project_number = 12345678
   136  object_acl = private
   137  bucket_acl = private
   138  --------------------
   139  y) Yes this is OK
   140  e) Edit this remote
   141  d) Delete this remote
   142  y/e/d> y
   143  ```
   144  
   145  Note that rclone runs a webserver on your local machine to collect the
   146  token as returned from Google if you use auto config mode. This only
   147  runs from the moment it opens your browser to the moment you get back
   148  the verification code.  This is on `http://127.0.0.1:53682/` and this
   149  it may require you to unblock it temporarily if you are running a host
   150  firewall, or use manual mode.
   151  
   152  This remote is called `remote` and can now be used like this
   153  
   154  See all the buckets in your project
   155  
   156      rclone lsd remote:
   157  
   158  Make a new bucket
   159  
   160      rclone mkdir remote:bucket
   161  
   162  List the contents of a bucket
   163  
   164      rclone ls remote:bucket
   165  
   166  Sync `/home/local/directory` to the remote bucket, deleting any excess
   167  files in the bucket.
   168  
   169      rclone sync /home/local/directory remote:bucket
   170  
   171  ### Service Account support ###
   172  
   173  You can set up rclone with Google Cloud Storage in an unattended mode,
   174  i.e. not tied to a specific end-user Google account. This is useful
   175  when you want to synchronise files onto machines that don't have
   176  actively logged-in users, for example build machines.
   177  
   178  To get credentials for Google Cloud Platform
   179  [IAM Service Accounts](https://cloud.google.com/iam/docs/service-accounts),
   180  please head to the
   181  [Service Account](https://console.cloud.google.com/permissions/serviceaccounts)
   182  section of the Google Developer Console. Service Accounts behave just
   183  like normal `User` permissions in
   184  [Google Cloud Storage ACLs](https://cloud.google.com/storage/docs/access-control),
   185  so you can limit their access (e.g. make them read only). After
   186  creating an account, a JSON file containing the Service Account's
   187  credentials will be downloaded onto your machines. These credentials
   188  are what rclone will use for authentication.
   189  
   190  To use a Service Account instead of OAuth2 token flow, enter the path
   191  to your Service Account credentials at the `service_account_file`
   192  prompt and rclone won't use the browser based authentication
   193  flow. If you'd rather stuff the contents of the credentials file into
   194  the rclone config file, you can set `service_account_credentials` with
   195  the actual contents of the file instead, or set the equivalent
   196  environment variable.
   197  
   198  ### Application Default Credentials ###
   199  
   200  If no other source of credentials is provided, rclone will fall back
   201  to
   202  [Application Default Credentials](https://cloud.google.com/video-intelligence/docs/common/auth#authenticating_with_application_default_credentials)
   203  this is useful both when you already have configured authentication
   204  for your developer account, or in production when running on a google
   205  compute host. Note that if running in docker, you may need to run
   206  additional commands on your google compute machine -
   207  [see this page](https://cloud.google.com/container-registry/docs/advanced-authentication#gcloud_as_a_docker_credential_helper).
   208  
   209  Note that in the case application default credentials are used, there
   210  is no need to explicitly configure a project number.
   211  
   212  ### --fast-list ###
   213  
   214  This remote supports `--fast-list` which allows you to use fewer
   215  transactions in exchange for more memory. See the [rclone
   216  docs](/docs/#fast-list) for more details.
   217  
   218  ### Modified time ###
   219  
   220  Google google cloud storage stores md5sums natively and rclone stores
   221  modification times as metadata on the object, under the "mtime" key in
   222  RFC3339 format accurate to 1ns.
   223  
   224  #### Restricted filename characters
   225  
   226  | Character | Value | Replacement |
   227  | --------- |:-----:|:-----------:|
   228  | NUL       | 0x00  | ␀           |
   229  | LF        | 0x0A  | ␊           |
   230  | CR        | 0x0D  | ␍           |
   231  | /         | 0x2F  | /          |
   232  
   233  Invalid UTF-8 bytes will also be [replaced](/overview/#invalid-utf8),
   234  as they can't be used in JSON strings.
   235  
   236  <!--- autogenerated options start - DO NOT EDIT, instead edit fs.RegInfo in backend/googlecloudstorage/googlecloudstorage.go then run make backenddocs -->
   237  ### Standard Options
   238  
   239  Here are the standard options specific to google cloud storage (Google Cloud Storage (this is not Google Drive)).
   240  
   241  #### --gcs-client-id
   242  
   243  Google Application Client Id
   244  Leave blank normally.
   245  
   246  - Config:      client_id
   247  - Env Var:     RCLONE_GCS_CLIENT_ID
   248  - Type:        string
   249  - Default:     ""
   250  
   251  #### --gcs-client-secret
   252  
   253  Google Application Client Secret
   254  Leave blank normally.
   255  
   256  - Config:      client_secret
   257  - Env Var:     RCLONE_GCS_CLIENT_SECRET
   258  - Type:        string
   259  - Default:     ""
   260  
   261  #### --gcs-project-number
   262  
   263  Project number.
   264  Optional - needed only for list/create/delete buckets - see your developer console.
   265  
   266  - Config:      project_number
   267  - Env Var:     RCLONE_GCS_PROJECT_NUMBER
   268  - Type:        string
   269  - Default:     ""
   270  
   271  #### --gcs-service-account-file
   272  
   273  Service Account Credentials JSON file path
   274  Leave blank normally.
   275  Needed only if you want use SA instead of interactive login.
   276  
   277  - Config:      service_account_file
   278  - Env Var:     RCLONE_GCS_SERVICE_ACCOUNT_FILE
   279  - Type:        string
   280  - Default:     ""
   281  
   282  #### --gcs-service-account-credentials
   283  
   284  Service Account Credentials JSON blob
   285  Leave blank normally.
   286  Needed only if you want use SA instead of interactive login.
   287  
   288  - Config:      service_account_credentials
   289  - Env Var:     RCLONE_GCS_SERVICE_ACCOUNT_CREDENTIALS
   290  - Type:        string
   291  - Default:     ""
   292  
   293  #### --gcs-object-acl
   294  
   295  Access Control List for new objects.
   296  
   297  - Config:      object_acl
   298  - Env Var:     RCLONE_GCS_OBJECT_ACL
   299  - Type:        string
   300  - Default:     ""
   301  - Examples:
   302      - "authenticatedRead"
   303          - Object owner gets OWNER access, and all Authenticated Users get READER access.
   304      - "bucketOwnerFullControl"
   305          - Object owner gets OWNER access, and project team owners get OWNER access.
   306      - "bucketOwnerRead"
   307          - Object owner gets OWNER access, and project team owners get READER access.
   308      - "private"
   309          - Object owner gets OWNER access [default if left blank].
   310      - "projectPrivate"
   311          - Object owner gets OWNER access, and project team members get access according to their roles.
   312      - "publicRead"
   313          - Object owner gets OWNER access, and all Users get READER access.
   314  
   315  #### --gcs-bucket-acl
   316  
   317  Access Control List for new buckets.
   318  
   319  - Config:      bucket_acl
   320  - Env Var:     RCLONE_GCS_BUCKET_ACL
   321  - Type:        string
   322  - Default:     ""
   323  - Examples:
   324      - "authenticatedRead"
   325          - Project team owners get OWNER access, and all Authenticated Users get READER access.
   326      - "private"
   327          - Project team owners get OWNER access [default if left blank].
   328      - "projectPrivate"
   329          - Project team members get access according to their roles.
   330      - "publicRead"
   331          - Project team owners get OWNER access, and all Users get READER access.
   332      - "publicReadWrite"
   333          - Project team owners get OWNER access, and all Users get WRITER access.
   334  
   335  #### --gcs-bucket-policy-only
   336  
   337  Access checks should use bucket-level IAM policies.
   338  
   339  If you want to upload objects to a bucket with Bucket Policy Only set
   340  then you will need to set this.
   341  
   342  When it is set, rclone:
   343  
   344  - ignores ACLs set on buckets
   345  - ignores ACLs set on objects
   346  - creates buckets with Bucket Policy Only set
   347  
   348  Docs: https://cloud.google.com/storage/docs/bucket-policy-only
   349  
   350  
   351  - Config:      bucket_policy_only
   352  - Env Var:     RCLONE_GCS_BUCKET_POLICY_ONLY
   353  - Type:        bool
   354  - Default:     false
   355  
   356  #### --gcs-location
   357  
   358  Location for the newly created buckets.
   359  
   360  - Config:      location
   361  - Env Var:     RCLONE_GCS_LOCATION
   362  - Type:        string
   363  - Default:     ""
   364  - Examples:
   365      - ""
   366          - Empty for default location (US).
   367      - "asia"
   368          - Multi-regional location for Asia.
   369      - "eu"
   370          - Multi-regional location for Europe.
   371      - "us"
   372          - Multi-regional location for United States.
   373      - "asia-east1"
   374          - Taiwan.
   375      - "asia-east2"
   376          - Hong Kong.
   377      - "asia-northeast1"
   378          - Tokyo.
   379      - "asia-south1"
   380          - Mumbai.
   381      - "asia-southeast1"
   382          - Singapore.
   383      - "australia-southeast1"
   384          - Sydney.
   385      - "europe-north1"
   386          - Finland.
   387      - "europe-west1"
   388          - Belgium.
   389      - "europe-west2"
   390          - London.
   391      - "europe-west3"
   392          - Frankfurt.
   393      - "europe-west4"
   394          - Netherlands.
   395      - "us-central1"
   396          - Iowa.
   397      - "us-east1"
   398          - South Carolina.
   399      - "us-east4"
   400          - Northern Virginia.
   401      - "us-west1"
   402          - Oregon.
   403      - "us-west2"
   404          - California.
   405  
   406  #### --gcs-storage-class
   407  
   408  The storage class to use when storing objects in Google Cloud Storage.
   409  
   410  - Config:      storage_class
   411  - Env Var:     RCLONE_GCS_STORAGE_CLASS
   412  - Type:        string
   413  - Default:     ""
   414  - Examples:
   415      - ""
   416          - Default
   417      - "MULTI_REGIONAL"
   418          - Multi-regional storage class
   419      - "REGIONAL"
   420          - Regional storage class
   421      - "NEARLINE"
   422          - Nearline storage class
   423      - "COLDLINE"
   424          - Coldline storage class
   425      - "DURABLE_REDUCED_AVAILABILITY"
   426          - Durable reduced availability storage class
   427  
   428  ### Advanced Options
   429  
   430  Here are the advanced options specific to google cloud storage (Google Cloud Storage (this is not Google Drive)).
   431  
   432  #### --gcs-encoding
   433  
   434  This sets the encoding for the backend.
   435  
   436  See: the [encoding section in the overview](/overview/#encoding) for more info.
   437  
   438  - Config:      encoding
   439  - Env Var:     RCLONE_GCS_ENCODING
   440  - Type:        MultiEncoder
   441  - Default:     Slash,CrLf,InvalidUtf8,Dot
   442  
   443  <!--- autogenerated options stop -->