blob: 82868b6f26e9bbec8a85921fec8e13ab72d18d54 [file] [log] [blame]
.. 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.
Amazon S3 Operators
====================
Airflow to Amazon Simple Storage Service (S3) integration provides several operators to create and interact with S3 buckets.
- :class:`~airflow.providers.amazon.aws.sensors.s3.S3KeySensor`
- :class:`~airflow.providers.amazon.aws.sensors.s3.S3KeySizeSensor`
- :class:`~airflow.providers.amazon.aws.sensors.s3.S3KeysUnchangedSensor`
- :class:`~airflow.providers.amazon.aws.sensors.s3.S3PrefixSensor`
- :class:`~airflow.providers.amazon.aws.operators.s3.S3CreateBucketOperator`
- :class:`~airflow.providers.amazon.aws.operators.s3.S3DeleteBucketOperator`
- :class:`~airflow.providers.amazon.aws.operators.s3.S3DeleteBucketTaggingOperator`
- :class:`~airflow.providers.amazon.aws.operators.s3.S3GetBucketTaggingOperator`
- :class:`~airflow.providers.amazon.aws.operators.s3.S3PutBucketTaggingOperator`
- :class:`~airflow.providers.amazon.aws.operators.s3.S3CopyObjectOperator`
- :class:`~airflow.providers.amazon.aws.operators.s3.S3DeleteObjectsOperator`
- :class:`~airflow.providers.amazon.aws.operators.s3.S3FileTransformOperator`
- :class:`~airflow.providers.amazon.aws.operators.s3.S3ListOperator`
Prerequisite Tasks
------------------
.. include:: _partials/prerequisite_tasks.rst
.. _howto/operator:S3CreateBucketOperator:
Create an Amazon S3 Bucket
--------------------------
To create an Amazon S3 bucket you can use
:class:`~airflow.providers.amazon.aws.operators.s3.S3CreateBucketOperator`.
.. exampleinclude:: /../../airflow/providers/amazon/aws/example_dags/example_s3_bucket.py
:language: python
:dedent: 4
:start-after: [START howto_operator_s3_create_bucket]
:end-before: [END howto_operator_s3_create_bucket]
.. _howto/operator:S3DeleteBucketOperator:
Delete an Amazon S3 Bucket
--------------------------
To delete an Amazon S3 bucket you can use
:class:`~airflow.providers.amazon.aws.operators.s3.S3DeleteBucketOperator`.
.. exampleinclude:: /../../airflow/providers/amazon/aws/example_dags/example_s3_bucket.py
:language: python
:dedent: 4
:start-after: [START howto_operator_s3_delete_bucket]
:end-before: [END howto_operator_s3_delete_bucket]
.. _howto/operator:S3PutBucketTaggingOperator:
Set the tags for an Amazon S3 Bucket
------------------------------------
To set the tags for an Amazon S3 bucket you can use
:class:`~airflow.providers.amazon.aws.operators.s3.S3PutBucketTaggingOperator`.
.. exampleinclude:: /../../airflow/providers/amazon/aws/example_dags/example_s3_bucket.py
:language: python
:dedent: 4
:start-after: [START howto_operator_s3_put_bucket_tagging]
:end-before: [END howto_operator_s3_put_bucket_tagging]
.. _howto/operator:S3GetBucketTaggingOperator:
Get the tag of an Amazon S3 Bucket
----------------------------------
To get the tag set associated with an Amazon S3 bucket you can use
:class:`~airflow.providers.amazon.aws.operators.s3.S3GetBucketTaggingOperator`.
.. exampleinclude:: /../../airflow/providers/amazon/aws/example_dags/example_s3_bucket.py
:language: python
:dedent: 4
:start-after: [START howto_operator_s3_get_bucket_tagging]
:end-before: [END howto_operator_s3_get_bucket_tagging]
.. _howto/operator:S3DeleteBucketTaggingOperator:
Delete the tags of an Amazon S3 Bucket
--------------------------------------
To delete the tags of an Amazon S3 bucket you can use
:class:`~airflow.providers.amazon.aws.operators.s3.S3DeleteBucketTaggingOperator`.
.. exampleinclude:: /../../airflow/providers/amazon/aws/example_dags/example_s3_bucket.py
:language: python
:dedent: 4
:start-after: [START howto_operator_s3_delete_bucket_tagging]
:end-before: [END howto_operator_s3_delete_bucket_tagging]
Reference
---------
For further information, look at:
* `Boto3 Library Documentation for S3 <https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html>`__