Google Cloud AlloyDB Operators

The AlloyDB for PostgreSQL is a fully managed, PostgreSQL-compatible database service that’s designed for your most demanding workloads, including hybrid transactional and analytical processing. AlloyDB pairs a Google-built database engine with a cloud-based, multi-node architecture to deliver enterprise-grade performance, reliability, and availability.

Airflow provides operators to manage AlloyDB clusters.

Prerequisite Tasks

To use these operators, you must do a few things:

Create cluster

To create an AlloyDB cluster (primary end secondary) you can use AlloyDBCreateClusterOperator.

tests/system/google/cloud/alloy_db/example_alloy_db.py[source]

create_cluster = AlloyDBCreateClusterOperator(
    task_id="create_cluster",
    cluster_id=CLUSTER_ID,
    cluster_configuration=CLUSTER,
    is_secondary=False,
    location=GCP_LOCATION,
    project_id=GCP_PROJECT_ID,
)

Update cluster

To update an AlloyDB cluster you can use AlloyDBUpdateClusterOperator.

tests/system/google/cloud/alloy_db/example_alloy_db.py[source]

update_cluster = AlloyDBUpdateClusterOperator(
    task_id="update_cluster",
    cluster_id=CLUSTER_ID,
    cluster_configuration=CLUSTER_UPDATE,
    update_mask=CLUSTER_UPDATE_MASK,
    location=GCP_LOCATION,
    project_id=GCP_PROJECT_ID,
)

Delete cluster

To delete an AlloyDB cluster you can use AlloyDBDeleteClusterOperator.

tests/system/google/cloud/alloy_db/example_alloy_db.py[source]

delete_cluster = AlloyDBDeleteClusterOperator(
    task_id="delete_cluster",
    project_id=GCP_PROJECT_ID,
    location=GCP_LOCATION,
    cluster_id=CLUSTER_ID,
)

Was this entry helpful?