airflow.providers.amazon.aws.operators.rds

Module Contents

Classes

RdsCreateDbSnapshotOperator

Creates a snapshot of a DB instance or DB cluster.

RdsCopyDbSnapshotOperator

Copies the specified DB instance or DB cluster snapshot.

RdsDeleteDbSnapshotOperator

Deletes a DB instance or cluster snapshot or terminating the copy operation.

RdsStartExportTaskOperator

Starts an export of a snapshot to Amazon S3. The provided IAM role must have access to the S3 bucket.

RdsCancelExportTaskOperator

Cancels an export task in progress that is exporting a snapshot to Amazon S3.

RdsCreateEventSubscriptionOperator

Creates an RDS event notification subscription.

RdsDeleteEventSubscriptionOperator

Deletes an RDS event notification subscription.

RdsCreateDbInstanceOperator

Creates an RDS DB instance.

RdsDeleteDbInstanceOperator

Deletes an RDS DB Instance.

RdsStartDbOperator

Starts an RDS DB instance / cluster.

RdsStopDbOperator

Stops an RDS DB instance / cluster.

class airflow.providers.amazon.aws.operators.rds.RdsCreateDbSnapshotOperator(*, db_type, db_identifier, db_snapshot_identifier, tags=None, wait_for_completion=True, **kwargs)[source]

Bases: RdsBaseOperator

Creates a snapshot of a DB instance or DB cluster.

The source DB instance or cluster must be in the available or storage-optimization state.

See also

For more information on how to use this operator, take a look at the guide: Create a database snapshot

Parameters
  • db_type (str) – Type of the DB - either “instance” or “cluster”

  • db_identifier (str) – The identifier of the instance or cluster that you want to create the snapshot of

  • db_snapshot_identifier (str) – The identifier for the DB snapshot

  • tags (Sequence[mypy_boto3_rds.type_defs.TagTypeDef] | dict | None) – A dictionary of tags or a list of tags in format [{“Key”: “…”, “Value”: “…”},] USER Tagging

  • wait_for_completion (bool) – If True, waits for creation of the DB snapshot to complete. (default: True)

template_fields = ('db_snapshot_identifier', 'db_identifier', 'tags')[source]
execute(context)[source]

Different implementations for snapshots, tasks and events.

class airflow.providers.amazon.aws.operators.rds.RdsCopyDbSnapshotOperator(*, db_type, source_db_snapshot_identifier, target_db_snapshot_identifier, kms_key_id='', tags=None, copy_tags=False, pre_signed_url='', option_group_name='', target_custom_availability_zone='', source_region='', wait_for_completion=True, **kwargs)[source]

Bases: RdsBaseOperator

Copies the specified DB instance or DB cluster snapshot.

See also

For more information on how to use this operator, take a look at the guide: Copy a database snapshot

Parameters
  • db_type (str) – Type of the DB - either “instance” or “cluster”

  • source_db_snapshot_identifier (str) – The identifier of the source snapshot

  • target_db_snapshot_identifier (str) – The identifier of the target snapshot

  • kms_key_id (str) – The AWS KMS key identifier for an encrypted DB snapshot

  • tags (Sequence[mypy_boto3_rds.type_defs.TagTypeDef] | dict | None) – A dictionary of tags or a list of tags in format [{“Key”: “…”, “Value”: “…”},] USER Tagging

  • copy_tags (bool) – Whether to copy all tags from the source snapshot to the target snapshot (default False)

  • pre_signed_url (str) – The URL that contains a Signature Version 4 signed request

  • option_group_name (str) – The name of an option group to associate with the copy of the snapshot Only when db_type=’instance’

  • target_custom_availability_zone (str) – The external custom Availability Zone identifier for the target Only when db_type=’instance’

  • source_region (str) – The ID of the region that contains the snapshot to be copied

  • wait_for_completion (bool) – If True, waits for snapshot copy to complete. (default: True)

template_fields = ('source_db_snapshot_identifier', 'target_db_snapshot_identifier', 'tags', 'pre_signed_url',...[source]
execute(context)[source]

Different implementations for snapshots, tasks and events.

class airflow.providers.amazon.aws.operators.rds.RdsDeleteDbSnapshotOperator(*, db_type, db_snapshot_identifier, wait_for_completion=True, **kwargs)[source]

Bases: RdsBaseOperator

Deletes a DB instance or cluster snapshot or terminating the copy operation.

See also

For more information on how to use this operator, take a look at the guide: Delete a database snapshot

Parameters
  • db_type (str) – Type of the DB - either “instance” or “cluster”

  • db_snapshot_identifier (str) – The identifier for the DB instance or DB cluster snapshot

template_fields = ('db_snapshot_identifier',)[source]
execute(context)[source]

Different implementations for snapshots, tasks and events.

class airflow.providers.amazon.aws.operators.rds.RdsStartExportTaskOperator(*, export_task_identifier, source_arn, s3_bucket_name, iam_role_arn, kms_key_id, s3_prefix='', export_only=None, wait_for_completion=True, waiter_interval=30, waiter_max_attempts=40, **kwargs)[source]

Bases: RdsBaseOperator

Starts an export of a snapshot to Amazon S3. The provided IAM role must have access to the S3 bucket.

See also

For more information on how to use this operator, take a look at the guide: Export an Amazon RDS snapshot to Amazon S3

Parameters
  • export_task_identifier (str) – A unique identifier for the snapshot export task.

  • source_arn (str) – The Amazon Resource Name (ARN) of the snapshot to export to Amazon S3.

  • s3_bucket_name (str) – The name of the Amazon S3 bucket to export the snapshot to.

  • iam_role_arn (str) – The name of the IAM role to use for writing to the Amazon S3 bucket.

  • kms_key_id (str) – The ID of the Amazon Web Services KMS key to use to encrypt the snapshot.

  • s3_prefix (str) – The Amazon S3 bucket prefix to use as the file name and path of the exported snapshot.

  • export_only (list[str] | None) – The data to be exported from the snapshot.

  • wait_for_completion (bool) – If True, waits for the DB snapshot export to complete. (default: True)

  • waiter_interval (int) – The number of seconds to wait before checking the export status. (default: 30)

  • waiter_max_attempts (int) – The number of attempts to make before failing. (default: 40)

template_fields = ('export_task_identifier', 'source_arn', 's3_bucket_name', 'iam_role_arn', 'kms_key_id',...[source]
execute(context)[source]

Different implementations for snapshots, tasks and events.

class airflow.providers.amazon.aws.operators.rds.RdsCancelExportTaskOperator(*, export_task_identifier, wait_for_completion=True, check_interval=30, max_attempts=40, **kwargs)[source]

Bases: RdsBaseOperator

Cancels an export task in progress that is exporting a snapshot to Amazon S3.

See also

For more information on how to use this operator, take a look at the guide: Cancel an Amazon RDS export task

Parameters
  • export_task_identifier (str) – The identifier of the snapshot export task to cancel

  • wait_for_completion (bool) – If True, waits for DB snapshot export to cancel. (default: True)

  • check_interval (int) – The amount of time in seconds to wait between attempts

  • max_attempts (int) – The maximum number of attempts to be made

template_fields = ('export_task_identifier',)[source]
execute(context)[source]

Different implementations for snapshots, tasks and events.

class airflow.providers.amazon.aws.operators.rds.RdsCreateEventSubscriptionOperator(*, subscription_name, sns_topic_arn, source_type='', event_categories=None, source_ids=None, enabled=True, tags=None, wait_for_completion=True, **kwargs)[source]

Bases: RdsBaseOperator

Creates an RDS event notification subscription.

See also

For more information on how to use this operator, take a look at the guide: Subscribe to an Amazon RDS event notification

Parameters
  • subscription_name (str) – The name of the subscription (must be less than 255 characters)

  • sns_topic_arn (str) – The ARN of the SNS topic created for event notification

  • source_type (str) – The type of source that is generating the events. Valid values: db-instance | db-cluster | db-parameter-group | db-security-group | db-snapshot | db-cluster-snapshot | db-proxy

  • event_categories (Sequence[str] | None) – A list of event categories for a source type that you want to subscribe to USER Events

  • source_ids (Sequence[str] | None) – The list of identifiers of the event sources for which events are returned

  • enabled (bool) – A value that indicates whether to activate the subscription (default True)l

  • tags (Sequence[mypy_boto3_rds.type_defs.TagTypeDef] | dict | None) – A dictionary of tags or a list of tags in format [{“Key”: “…”, “Value”: “…”},] USER Tagging

  • wait_for_completion (bool) – If True, waits for creation of the subscription to complete. (default: True)

template_fields = ('subscription_name', 'sns_topic_arn', 'source_type', 'event_categories', 'source_ids', 'tags')[source]
execute(context)[source]

Different implementations for snapshots, tasks and events.

class airflow.providers.amazon.aws.operators.rds.RdsDeleteEventSubscriptionOperator(*, subscription_name, **kwargs)[source]

Bases: RdsBaseOperator

Deletes an RDS event notification subscription.

See also

For more information on how to use this operator, take a look at the guide: Unsubscribe to an Amazon RDS event notification

Parameters

subscription_name (str) – The name of the RDS event notification subscription you want to delete

template_fields = ('subscription_name',)[source]
execute(context)[source]

Different implementations for snapshots, tasks and events.

class airflow.providers.amazon.aws.operators.rds.RdsCreateDbInstanceOperator(*, db_instance_identifier, db_instance_class, engine, rds_kwargs=None, wait_for_completion=True, deferrable=conf.getboolean('operators', 'default_deferrable', fallback=False), waiter_delay=30, waiter_max_attempts=60, **kwargs)[source]

Bases: RdsBaseOperator

Creates an RDS DB instance.

See also

For more information on how to use this operator, take a look at the guide: Create a database instance

Parameters
  • db_instance_identifier (str) – The DB instance identifier, must start with a letter and contain from 1 to 63 letters, numbers, or hyphens

  • db_instance_class (str) – The compute and memory capacity of the DB instance, for example db.m5.large

  • engine (str) – The name of the database engine to be used for this instance

  • rds_kwargs (dict | None) – Named arguments to pass to boto3 RDS client function create_db_instance https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/rds.html#RDS.Client.create_db_instance

  • wait_for_completion (bool) – If True, waits for creation of the DB instance to complete. (default: True)

  • waiter_delay (int) – Time (in seconds) to wait between two consecutive calls to check DB instance state

  • waiter_max_attempts (int) – The maximum number of attempts to check DB instance state

  • deferrable (bool) – If True, the operator will wait asynchronously for the DB instance to be created. This implies waiting for completion. This mode requires aiobotocore module to be installed. (default: False)

template_fields = ('db_instance_identifier', 'db_instance_class', 'engine', 'rds_kwargs')[source]
execute(context)[source]

Different implementations for snapshots, tasks and events.

execute_complete(context, event=None)[source]
class airflow.providers.amazon.aws.operators.rds.RdsDeleteDbInstanceOperator(*, db_instance_identifier, rds_kwargs=None, wait_for_completion=True, deferrable=conf.getboolean('operators', 'default_deferrable', fallback=False), waiter_delay=30, waiter_max_attempts=60, **kwargs)[source]

Bases: RdsBaseOperator

Deletes an RDS DB Instance.

See also

For more information on how to use this operator, take a look at the guide: Delete a database instance

Parameters
  • db_instance_identifier (str) – The DB instance identifier for the DB instance to be deleted

  • rds_kwargs (dict | None) – Named arguments to pass to boto3 RDS client function delete_db_instance https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/rds.html#RDS.Client.delete_db_instance

  • wait_for_completion (bool) – If True, waits for deletion of the DB instance to complete. (default: True)

  • waiter_delay (int) – Time (in seconds) to wait between two consecutive calls to check DB instance state

  • waiter_max_attempts (int) – The maximum number of attempts to check DB instance state

  • deferrable (bool) – If True, the operator will wait asynchronously for the DB instance to be created. This implies waiting for completion. This mode requires aiobotocore module to be installed. (default: False)

template_fields = ('db_instance_identifier', 'rds_kwargs')[source]
execute(context)[source]

Different implementations for snapshots, tasks and events.

execute_complete(context, event=None)[source]
class airflow.providers.amazon.aws.operators.rds.RdsStartDbOperator(*, db_identifier, db_type=RdsDbType.INSTANCE, wait_for_completion=True, waiter_delay=30, waiter_max_attempts=40, deferrable=conf.getboolean('operators', 'default_deferrable', fallback=False), **kwargs)[source]

Bases: RdsBaseOperator

Starts an RDS DB instance / cluster.

See also

For more information on how to use this operator, take a look at the guide: Start a database instance or cluster

Parameters
  • db_identifier (str) – The AWS identifier of the DB to start

  • db_type (airflow.providers.amazon.aws.utils.rds.RdsDbType | str) – Type of the DB - either “instance” or “cluster” (default: “instance”)

  • wait_for_completion (bool) – If True, waits for DB to start. (default: True)

  • waiter_delay (int) – Time (in seconds) to wait between two consecutive calls to check DB instance state

  • waiter_max_attempts (int) – The maximum number of attempts to check DB instance state

  • deferrable (bool) – If True, the operator will wait asynchronously for the DB instance to be created. This implies waiting for completion. This mode requires aiobotocore module to be installed.

template_fields = ('db_identifier', 'db_type')[source]
execute(context)[source]

Different implementations for snapshots, tasks and events.

execute_complete(context, event=None)[source]
class airflow.providers.amazon.aws.operators.rds.RdsStopDbOperator(*, db_identifier, db_type=RdsDbType.INSTANCE, db_snapshot_identifier=None, wait_for_completion=True, waiter_delay=30, waiter_max_attempts=40, deferrable=conf.getboolean('operators', 'default_deferrable', fallback=False), **kwargs)[source]

Bases: RdsBaseOperator

Stops an RDS DB instance / cluster.

See also

For more information on how to use this operator, take a look at the guide: Stop a database instance or cluster

Parameters
  • db_identifier (str) – The AWS identifier of the DB to stop

  • db_type (airflow.providers.amazon.aws.utils.rds.RdsDbType | str) – Type of the DB - either “instance” or “cluster” (default: “instance”)

  • db_snapshot_identifier (str | None) – The instance identifier of the DB Snapshot to create before stopping the DB instance. The default value (None) skips snapshot creation. This parameter is ignored when db_type is “cluster”

  • wait_for_completion (bool) – If True, waits for DB to stop. (default: True)

  • waiter_delay (int) – Time (in seconds) to wait between two consecutive calls to check DB instance state

  • waiter_max_attempts (int) – The maximum number of attempts to check DB instance state

  • deferrable (bool) – If True, the operator will wait asynchronously for the DB instance to be created. This implies waiting for completion. This mode requires aiobotocore module to be installed.

template_fields = ('db_identifier', 'db_snapshot_identifier', 'db_type')[source]
execute(context)[source]

Different implementations for snapshots, tasks and events.

execute_complete(context, event=None)[source]

Was this entry helpful?