airflow.providers.amazon.aws.hooks.elasticache_replication_group

Module Contents

Classes

ElastiCacheReplicationGroupHook

Interact with Amazon ElastiCache.

class airflow.providers.amazon.aws.hooks.elasticache_replication_group.ElastiCacheReplicationGroupHook(max_retries=10, exponential_back_off_factor=1, initial_poke_interval=60, *args, **kwargs)[source]

Bases: airflow.providers.amazon.aws.hooks.base_aws.AwsBaseHook

Interact with Amazon ElastiCache. Provide thick wrapper around boto3.client("elasticache").

Parameters
  • max_retries (int) – Max retries for checking availability of and deleting replication group If this is not supplied then this is defaulted to 10

  • exponential_back_off_factor (float) – Multiplication factor for deciding next sleep time If this is not supplied then this is defaulted to 1

  • initial_poke_interval (float) – Initial sleep time in seconds If this is not supplied then this is defaulted to 60 seconds

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

TERMINAL_STATES[source]
create_replication_group(config)[source]

Creates a Redis (cluster mode disabled) or a Redis (cluster mode enabled) replication group.

Parameters

config (dict) – Configuration for creating the replication group

Returns

Response from ElastiCache create replication group API

Return type

dict

delete_replication_group(replication_group_id)[source]

Deletes an existing replication group.

Parameters

replication_group_id (str) – ID of replication group to delete

Returns

Response from ElastiCache delete replication group API

Return type

dict

describe_replication_group(replication_group_id)[source]

Get information about a particular replication group.

Parameters

replication_group_id (str) – ID of replication group to describe

Returns

Response from ElastiCache describe replication group API

Return type

dict

get_replication_group_status(replication_group_id)[source]

Get current status of replication group.

Parameters

replication_group_id (str) – ID of replication group to check for status

Returns

Current status of replication group

Return type

str

is_replication_group_available(replication_group_id)[source]

Helper for checking if replication group is available or not

Parameters

replication_group_id (str) – ID of replication group to check for availability

Returns

True if available else False

Return type

bool

wait_for_availability(replication_group_id, initial_sleep_time=None, exponential_back_off_factor=None, max_retries=None)[source]

Check if replication group is available or not by performing a describe over it

Parameters
  • replication_group_id (str) – ID of replication group to check for availability

  • initial_sleep_time (float | None) – Initial sleep time in seconds If this is not supplied then this is defaulted to class level value

  • exponential_back_off_factor (float | None) – Multiplication factor for deciding next sleep time If this is not supplied then this is defaulted to class level value

  • max_retries (int | None) – Max retries for checking availability of replication group If this is not supplied then this is defaulted to class level value

Returns

True if replication is available else False

Return type

bool

wait_for_deletion(replication_group_id, initial_sleep_time=None, exponential_back_off_factor=None, max_retries=None)[source]

Helper for deleting a replication group ensuring it is either deleted or can’t be deleted

Parameters
  • replication_group_id (str) – ID of replication to delete

  • initial_sleep_time (float | None) – Initial sleep time in second If this is not supplied then this is defaulted to class level value

  • exponential_back_off_factor (float | None) – Multiplication factor for deciding next sleep time If this is not supplied then this is defaulted to class level value

  • max_retries (int | None) – Max retries for checking availability of replication group If this is not supplied then this is defaulted to class level value

Returns

Response from ElastiCache delete replication group API and flag to identify if deleted or not

ensure_delete_replication_group(replication_group_id, initial_sleep_time=None, exponential_back_off_factor=None, max_retries=None)[source]

Delete a replication group ensuring it is either deleted or can’t be deleted

Parameters
  • replication_group_id (str) – ID of replication to delete

  • initial_sleep_time (float | None) – Initial sleep time in second If this is not supplied then this is defaulted to class level value

  • exponential_back_off_factor (float | None) – Multiplication factor for deciding next sleep time If this is not supplied then this is defaulted to class level value

  • max_retries (int | None) – Max retries for checking availability of replication group If this is not supplied then this is defaulted to class level value

Returns

Response from ElastiCache delete replication group API

Raises

AirflowException – If replication group is not deleted

Return type

dict

Was this entry helpful?