providers/amazon/docs/operators/rds.rst
.. 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 Relational Database Service (Amazon RDS) <https://aws.amazon.com/rds/>__ is a web service that makes it
easier to set up, operate, and scale a relational database in the cloud.
It provides cost-efficient, resizable capacity for an industry-standard relational database and manages
common database administration tasks.
.. include:: ../_partials/prerequisite_tasks.rst
.. include:: ../_partials/generic_parameters.rst
.. _howto/operator:RDSCreateDBSnapshotOperator:
To create a snapshot of an Amazon RDS database instance or cluster you can use
:class:~airflow.providers.amazon.aws.operators.rds.RDSCreateDBSnapshotOperator.
The source database instance must be in the available or storage-optimization state.
.. exampleinclude:: /../../amazon/tests/system/amazon/aws/example_rds_snapshot.py :language: python :dedent: 4 :start-after: [START howto_operator_rds_create_db_snapshot] :end-before: [END howto_operator_rds_create_db_snapshot]
.. _howto/operator:RDSCopyDBSnapshotOperator:
To copy a snapshot of an Amazon RDS database instance or cluster you can use
:class:~airflow.providers.amazon.aws.operators.rds.RDSCopyDBSnapshotOperator.
The source database snapshot must be in the available state.
.. exampleinclude:: /../../amazon/tests/system/amazon/aws/example_rds_snapshot.py :language: python :dedent: 4 :start-after: [START howto_operator_rds_copy_snapshot] :end-before: [END howto_operator_rds_copy_snapshot]
.. _howto/operator:RDSDeleteDBSnapshotOperator:
To delete a snapshot of an Amazon RDS database instance or cluster you can use
:class:~airflow.providers.amazon.aws.operators.rds.RDSDeleteDBSnapshotOperator.
The database snapshot must be in the available state to be deleted.
.. exampleinclude:: /../../amazon/tests/system/amazon/aws/example_rds_snapshot.py :language: python :dedent: 4 :start-after: [START howto_operator_rds_delete_snapshot] :end-before: [END howto_operator_rds_delete_snapshot]
.. _howto/operator:RDSStartExportTaskOperator:
To export an Amazon RDS snapshot to Amazon S3 you can use
:class:~airflow.providers.amazon.aws.operators.rds.RDSStartExportTaskOperator.
The provided IAM role must have access to the S3 bucket.
.. exampleinclude:: /../../amazon/tests/system/amazon/aws/example_rds_export.py :language: python :dedent: 4 :start-after: [START howto_operator_rds_start_export_task] :end-before: [END howto_operator_rds_start_export_task]
.. _howto/operator:RDSCancelExportTaskOperator:
To cancel an Amazon RDS export task to S3 you can use
:class:~airflow.providers.amazon.aws.operators.rds.RDSCancelExportTaskOperator.
Any data that has already been written to the S3 bucket isn't removed.
.. exampleinclude:: /../../amazon/tests/system/amazon/aws/example_rds_export.py :language: python :dedent: 4 :start-after: [START howto_operator_rds_cancel_export] :end-before: [END howto_operator_rds_cancel_export]
.. _howto/operator:RDSCreateEventSubscriptionOperator:
To create an Amazon RDS event subscription you can use
:class:~airflow.providers.amazon.aws.operators.rds.RDSCreateEventSubscriptionOperator.
This action requires an Amazon SNS topic Amazon Resource Name (ARN).
Amazon RDS event notification is only available for not encrypted SNS topics.
If you specify an encrypted SNS topic, event notifications are not sent for the topic.
.. exampleinclude:: /../../amazon/tests/system/amazon/aws/example_rds_event.py :language: python :dedent: 4 :start-after: [START howto_operator_rds_create_event_subscription] :end-before: [END howto_operator_rds_create_event_subscription]
.. _howto/operator:RDSDeleteEventSubscriptionOperator:
To delete an Amazon RDS event subscription you can use
:class:~airflow.providers.amazon.aws.operators.rds.RDSDeleteEventSubscriptionOperator.
.. exampleinclude:: /../../amazon/tests/system/amazon/aws/example_rds_event.py :language: python :dedent: 4 :start-after: [START howto_operator_rds_delete_event_subscription] :end-before: [END howto_operator_rds_delete_event_subscription]
.. _howto/operator:RdsCreateDbInstanceOperator:
To create a AWS DB instance you can use
:class:~airflow.providers.amazon.aws.operators.rds.RdsCreateDbInstanceOperator.
You can also run this operator in deferrable mode by setting deferrable param to True.
.. exampleinclude:: /../../amazon/tests/system/amazon/aws/example_rds_instance.py :language: python :dedent: 4 :start-after: [START howto_operator_rds_create_db_instance] :end-before: [END howto_operator_rds_create_db_instance]
.. _howto/operator:RDSDeleteDbInstanceOperator:
To delete a AWS DB instance you can use
:class:~airflow.providers.amazon.aws.operators.rds.RDSDeleteDbInstanceOperator.
You can also run this operator in deferrable mode by setting deferrable param to True.
.. exampleinclude:: /../../amazon/tests/system/amazon/aws/example_rds_instance.py :language: python :dedent: 4 :start-after: [START howto_operator_rds_delete_db_instance] :end-before: [END howto_operator_rds_delete_db_instance]
.. _howto/operator:RdsStartDbOperator:
To start an Amazon RDS DB instance or cluster you can use
:class:~airflow.providers.amazon.aws.operators.rds.RdsStartDbOperator.
.. exampleinclude:: /../../amazon/tests/system/amazon/aws/example_rds_instance.py :language: python :dedent: 4 :start-after: [START howto_operator_rds_start_db] :end-before: [END howto_operator_rds_start_db]
.. _howto/operator:RdsStopDbOperator:
To stop an Amazon RDS DB instance or cluster you can use
:class:~airflow.providers.amazon.aws.operators.rds.RdsStopDbOperator.
.. exampleinclude:: /../../amazon/tests/system/amazon/aws/example_rds_instance.py :language: python :dedent: 4 :start-after: [START howto_operator_rds_stop_db] :end-before: [END howto_operator_rds_stop_db]
.. _howto/sensor:RdsDbSensor:
To wait for an Amazon RDS instance or cluster to reach a specific status you can use
:class:~airflow.providers.amazon.aws.sensors.rds.RdsDbSensor.
By default, the sensor waits for a database instance to reach the available state.
.. exampleinclude:: /../../amazon/tests/system/amazon/aws/example_rds_instance.py :language: python :dedent: 4 :start-after: [START howto_sensor_rds_instance] :end-before: [END howto_sensor_rds_instance]
.. _howto/sensor:RdsSnapshotExistenceSensor:
To wait for an Amazon RDS snapshot with specific statuses you can use
:class:~airflow.providers.amazon.aws.sensors.rds.RdsSnapshotExistenceSensor.
By default, the sensor waits for the existence of a snapshot with status available.
.. exampleinclude:: /../../amazon/tests/system/amazon/aws/example_rds_snapshot.py :language: python :dedent: 4 :start-after: [START howto_sensor_rds_snapshot_existence] :end-before: [END howto_sensor_rds_snapshot_existence]
.. _howto/sensor:RdsExportTaskExistenceSensor:
To wait a for an Amazon RDS snapshot export task with specific statuses you can use
:class:~airflow.providers.amazon.aws.sensors.rds.RdsExportTaskExistenceSensor.
By default, the sensor waits for the existence of a snapshot with status available.
.. exampleinclude:: /../../amazon/tests/system/amazon/aws/example_rds_export.py :language: python :dedent: 4 :start-after: [START howto_sensor_rds_export_task_existence] :end-before: [END howto_sensor_rds_export_task_existence]
AWS boto3 library documentation for RDS <https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/rds.html>__RDS DB instance statuses <https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/accessing-monitoring.html>__