This module contains Google Cloud Storage to S3 operator.

Module Contents



Synchronizes a Google Cloud Storage bucket with an S3 bucket.

class*, gcs_bucket=None, bucket=None, prefix=None, delimiter=None, gcp_conn_id='google_cloud_default', dest_aws_conn_id='aws_default', dest_s3_key, dest_verify=None, replace=False, google_impersonation_chain=None, dest_s3_extra_args=None, s3_acl_policy=None, keep_directory_structure=True, match_glob=None, gcp_user_project=None, **kwargs)[source]

Bases: airflow.models.BaseOperator

Synchronizes a Google Cloud Storage bucket with an S3 bucket.

See also

For more information on how to use this operator, take a look at the guide: Google Cloud Storage to Amazon S3

  • gcs_bucket (str | None) – The Google Cloud Storage bucket to find the objects. (templated)

  • bucket (str | None) – (Deprecated) Use gcs_bucket instead.

  • prefix (str | None) – Prefix string which filters objects whose name begin with this prefix. (templated)

  • delimiter (str | None) – (Deprecated) The delimiter by which you want to filter the objects. (templated) For e.g to lists the CSV files from in a directory in GCS you would use delimiter=’.csv’.

  • gcp_conn_id (str) – (Optional) The connection ID used to connect to Google Cloud.

  • dest_aws_conn_id (str | None) – The destination S3 connection

  • dest_s3_key (str) – The base S3 key to be used to store the files. (templated)

  • dest_verify (str | bool | None) –

    Whether or not to verify SSL certificates for S3 connection. By default SSL certificates are verified. You can provide the following values:

    • False: do not validate SSL certificates. SSL will still be used

      (unless use_ssl is False), but SSL certificates will not be verified.

    • path/to/cert/bundle.pem: A filename of the CA cert bundle to uses.

      You can specify this argument if you want to use a different CA cert bundle than the one used by botocore.

  • replace (bool) – Whether or not to verify the existence of the files in the destination bucket. By default is set to False If set to True, will upload all the files replacing the existing ones in the destination bucket. If set to False, will upload only the files that are in the origin but not in the destination bucket.

  • google_impersonation_chain (str | Sequence[str] | None) – Optional Google service account to impersonate using short-term credentials, or chained list of accounts required to get the access_token of the last account in the list, which will be impersonated in the request. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account (templated).

  • s3_acl_policy (str | None) – Optional The string to specify the canned ACL policy for the object to be uploaded in S3

  • keep_directory_structure (bool) – (Optional) When set to False the path of the file on the bucket is recreated within path passed in dest_s3_key.

  • match_glob (str | None) – (Optional) filters objects based on the glob pattern given by the string (e.g, '**/*/.json')

  • gcp_user_project (str | None) – (Optional) The identifier of the Google Cloud project to bill for this request. Required for Requester Pays buckets.

template_fields: Sequence[str] = ('gcs_bucket', 'prefix', 'delimiter', 'dest_s3_key', 'google_impersonation_chain', 'gcp_user_project')[source]
ui_color = '#f0eee4'[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

Was this entry helpful?