airflow.providers.amazon.aws.hooks.rds

Interact with AWS RDS.

Module Contents

Classes

RdsHook

Interact with AWS RDS using proper client from the boto3 library.

class airflow.providers.amazon.aws.hooks.rds.RdsHook(*args, **kwargs)[source]

Bases: airflow.providers.amazon.aws.hooks.base_aws.AwsGenericHook[mypy_boto3_rds.RDSClient]

Interact with AWS RDS using proper client from the boto3 library.

Hook attribute conn has all methods that listed in documentation

Additional arguments (such as aws_conn_id or region_name) may be specified and are passed down to the underlying AwsBaseHook.

See also

AwsGenericHook

Parameters

aws_conn_id – The Airflow connection used for AWS credentials.

get_db_snapshot_state(snapshot_id)[source]

Get the current state of a DB instance snapshot.

Parameters

snapshot_id (str) – The ID of the target DB instance snapshot

Returns

Returns the status of the DB snapshot as a string (eg. “available”)

Return type

str

Raises

AirflowNotFoundException – If the DB instance snapshot does not exist.

wait_for_db_snapshot_state(snapshot_id, target_state, check_interval=30, max_attempts=40)[source]

Polls RDS.Client.describe_db_snapshots() until the target state is reached. An error is raised after a max number of attempts.

Parameters
  • snapshot_id (str) – The ID of the target DB instance snapshot

  • target_state (str) – Wait until this state is reached

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

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

get_db_cluster_snapshot_state(snapshot_id)[source]

Get the current state of a DB cluster snapshot.

Parameters

snapshot_id (str) – The ID of the target DB cluster.

Returns

Returns the status of the DB cluster snapshot as a string (eg. “available”)

Return type

str

Raises

AirflowNotFoundException – If the DB cluster snapshot does not exist.

wait_for_db_cluster_snapshot_state(snapshot_id, target_state, check_interval=30, max_attempts=40)[source]

Polls RDS.Client.describe_db_cluster_snapshots() until the target state is reached. An error is raised after a max number of attempts.

Parameters
  • snapshot_id (str) – The ID of the target DB cluster snapshot

  • target_state (str) – Wait until this state is reached

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

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

get_export_task_state(export_task_id)[source]

Gets the current state of an RDS snapshot export to Amazon S3.

Parameters

export_task_id (str) – The identifier of the target snapshot export task.

Returns

Returns the status of the snapshot export task as a string (eg. “canceled”)

Return type

str

Raises

AirflowNotFoundException – If the export task does not exist.

wait_for_export_task_state(export_task_id, target_state, check_interval=30, max_attempts=40)[source]

Polls RDS.Client.describe_export_tasks() until the target state is reached. An error is raised after a max number of attempts.

Parameters
  • export_task_id (str) – The identifier of the target snapshot export task.

  • target_state (str) – Wait until this state is reached

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

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

get_event_subscription_state(subscription_name)[source]

Gets the current state of an RDS snapshot export to Amazon S3.

Parameters

subscription_name (str) – The name of the target RDS event notification subscription.

Returns

Returns the status of the event subscription as a string (eg. “active”)

Return type

str

Raises

AirflowNotFoundException – If the event subscription does not exist.

wait_for_event_subscription_state(subscription_name, target_state, check_interval=30, max_attempts=40)[source]

Polls RDS.Client.describe_event_subscriptions() until the target state is reached. An error is raised after a max number of attempts.

Parameters
  • subscription_name (str) – The name of the target RDS event notification subscription.

  • target_state (str) – Wait until this state is reached

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

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

get_db_instance_state(db_instance_id)[source]

Get the current state of a DB instance.

Parameters

db_instance_id (str) – The ID of the target DB instance.

Returns

Returns the status of the DB instance as a string (eg. “available”)

Return type

str

Raises

AirflowNotFoundException – If the DB instance does not exist.

wait_for_db_instance_state(db_instance_id, target_state, check_interval=30, max_attempts=40)[source]

Polls RDS.Client.describe_db_instances() until the target state is reached. An error is raised after a max number of attempts.

Parameters
  • db_instance_id (str) – The ID of the target DB instance.

  • target_state (str) – Wait until this state is reached

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

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

See also

For information about DB instance statuses, see Viewing DB instance status in the Amazon RDS User Guide. https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/accessing-monitoring.html#Overview.DBInstance.Status

get_db_cluster_state(db_cluster_id)[source]

Get the current state of a DB cluster.

Parameters

db_cluster_id (str) – The ID of the target DB cluster.

Returns

Returns the status of the DB cluster as a string (eg. “available”)

Return type

str

Raises

AirflowNotFoundException – If the DB cluster does not exist.

wait_for_db_cluster_state(db_cluster_id, target_state, check_interval=30, max_attempts=40)[source]

Polls RDS.Client.describe_db_clusters() until the target state is reached. An error is raised after a max number of attempts.

Parameters
  • db_cluster_id (str) – The ID of the target DB cluster.

  • target_state (str) – Wait until this state is reached

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

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

See also

For information about DB instance statuses, see Viewing DB instance status in the Amazon RDS User Guide. https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/accessing-monitoring.html#Overview.DBInstance.Status

Was this entry helpful?