diff --git a/airflow/providers/amazon/aws/example_dags/example_local_to_s3.py b/airflow/providers/amazon/aws/example_dags/example_local_to_s3.py index 647f802ad6c62..05f9c74d7685b 100644 --- a/airflow/providers/amazon/aws/example_dags/example_local_to_s3.py +++ b/airflow/providers/amazon/aws/example_dags/example_local_to_s3.py @@ -31,11 +31,12 @@ start_date=datetime(2021, 1, 1), # Override to match your needs catchup=False, ) as dag: - # [START howto_local_transfer_data_to_s3] + # [START howto_transfer_local_to_s3] create_local_to_s3_job = LocalFilesystemToS3Operator( task_id="create_local_to_s3_job", filename="relative/path/to/file.csv", dest_key=S3_KEY, dest_bucket=S3_BUCKET, + replace=True, ) - # [END howto_local_transfer_data_to_s3] + # [END howto_transfer_local_to_s3] diff --git a/airflow/providers/amazon/aws/transfers/local_to_s3.py b/airflow/providers/amazon/aws/transfers/local_to_s3.py index 704198b05d1ff..275f74716e44c 100644 --- a/airflow/providers/amazon/aws/transfers/local_to_s3.py +++ b/airflow/providers/amazon/aws/transfers/local_to_s3.py @@ -28,6 +28,10 @@ class LocalFilesystemToS3Operator(BaseOperator): """ Uploads a file from a local filesystem to Amazon S3. + .. seealso:: + For more information on how to use this operator, take a look at the guide: + :ref:`howto/operator:LocalFilesystemToS3Operator` + :param filename: Path to the local file. Path can be either absolute (e.g. /path/to/file.ext) or relative (e.g. ../../foo/*/*.csv). (templated) :param dest_key: The key of the object to copy to. (templated) diff --git a/airflow/providers/amazon/provider.yaml b/airflow/providers/amazon/provider.yaml index aeaf630105ce7..d0789da3d534e 100644 --- a/airflow/providers/amazon/provider.yaml +++ b/airflow/providers/amazon/provider.yaml @@ -509,6 +509,7 @@ transfers: python-module: airflow.providers.amazon.aws.transfers.salesforce_to_s3 - source-integration-name: Local target-integration-name: Amazon Simple Storage Service (S3) + how-to-guide: /docs/apache-airflow-providers-amazon/operators/transfer/local_to_s3.rst python-module: airflow.providers.amazon.aws.transfers.local_to_s3 - source-integration-name: SQL target-integration-name: Amazon Simple Storage Service (S3) diff --git a/docs/apache-airflow-providers-amazon/operators/transfer/local_to_s3.rst b/docs/apache-airflow-providers-amazon/operators/transfer/local_to_s3.rst new file mode 100644 index 0000000000000..53df0c629e043 --- /dev/null +++ b/docs/apache-airflow-providers-amazon/operators/transfer/local_to_s3.rst @@ -0,0 +1,50 @@ + .. Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + .. http://www.apache.org/licenses/LICENSE-2.0 + + .. Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +Local Filesystem to Amazon S3 Transfer Operator +=============================================== + +Use the LocalFilesystemToS3Operator transfer to copy data from the Airflow local filesystem +to an Amazon Simple Storage Service (S3) file. + +Prerequisite Tasks +^^^^^^^^^^^^^^^^^^ + +.. include:: ../_partials/prerequisite_tasks.rst + +.. _howto/operator:LocalFilesystemToS3Operator: + +Local to Amazon S3 +^^^^^^^^^^^^^^^^^^ + +This operator copies data from the local filesystem to an Amazon S3 file. + +To get more information about this operator visit: +:class:`~airflow.providers.amazon.aws.transfers.local_to_s3.LocalFilesystemToS3Operator` + +Example usage: + +.. exampleinclude:: /../../airflow/providers/amazon/aws/example_dags/example_local_to_s3.py + :language: python + :dedent: 4 + :start-after: [START howto_transfer_local_to_s3] + :end-before: [END howto_transfer_local_to_s3] + +Reference +^^^^^^^^^ + +* `AWS boto3 Library Documentation for Amazon S3 `__