Installation

Install as Agent Plugin Recommended
copilot plugin marketplace add samueltauil/skills-hub
copilot plugin install cloud-databases-onboarding@skills-hub

Works with GitHub Copilot CLI and VS Code (enable chat.plugins.enabled). Plugin cloud-databases-onboarding v1.0.0 follows the Agent Plugins spec.

Install with the gh extension
gh skills-hub install cloud-databases-onboarding

Don't have the extension? Run gh extension install samueltauil/skills-hub first.

Download and extract to your repository:

.github/skills/cloud-databases-onboarding/

Extract the ZIP to .github/skills/ in your repo. The folder name must match cloud-databases-onboarding for Copilot to auto-discover it.

Skill Files (6)

SKILL.md 6.9 KB
---
name: cloud-databases-onboarding
metadata:
  version: "1.0.2"
  category: Databases
description: >-
  Guides users through discovering their database requirements, recommends a
  Google Cloud database based on a recommendation matrix, and assists in database
  creation. Use when a user asks 'What database service should I use?', 'Help me pick
  a database', or when a user wants to create a new database on Google Cloud.
  Don't use for general Google Cloud maintenance, managing existing databases, or database migrations.
---

# Google Cloud Database Onboarding Skill

This skill provides domain instructions, decision matrices, and
Infrastructure-as-Code workflows to guide users through discovering their exact
database requirements, selecting an optimal Google Cloud database service, and
drafting starter resource provisioning code for user review.

## Attribution

**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
MUST read [Usage Attribution](references/attribution.md). For commands executed
directly in the terminal (never in generated scripts, Terraform, or user code),
prefix `gcloud` with
`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:cloud-databases-onboarding)"`
and append `agent-skills/1.0 (skill:cloud-databases-onboarding)` to `User-Agent` headers.

## Validation & Progressive Disclosure

A validation script is provided to verify the skill's reference files and
formatting:

```bash
python3 scripts/database_onboarding_skill.py --verify
```

*   **Reading / Progressive Disclosure:** When interacting with a user during a
    conversation, load reference files progressively. Follow the Just-in-Time
    (JiT) loading instructions outlined in the phases below.

--------------------------------------------------------------------------------

## Workflow & Just-in-Time (JiT) Instructions

This workflow operates in three distinct sequential phases. Evaluate the active
conversation history to determine the current phase and follow the corresponding
instructions:

### Phase 1: Requirement Discovery & Information Gathering

When a user asks `"What database should I use?"` or requires guidance on Google
Cloud database selection, you must initiate the Discovery phase.

1.  **Load Discovery Instructions (JiT):** Read the complete contents of
    `references/onboarding_prompts.md` using `view_file`.
2.  **Execute Discovery:** Follow the detailed Phase 1 instructions in
    `onboarding_prompts.md` to gather core requirements (data model, workload,
    scale, and migration context) using user-friendly phrasing and enforcing
    constraints (such as the 90% confidence rule) before proposing any
    recommendation.

### Phase 2: Recommendation Analysis & Matrix Consultation

Once you have gathered sufficient explicit discovery context, you must determine
the optimal Google Cloud database recommendation.

1.  **Consult Matrix & Formulate Recommendation (JiT):** Follow the Phase 2
    instructions in `references/onboarding_prompts.md`. This involves distilling
    requirements, calling the database selection tool (or consulting
    `references/recommendation_matrix.txt` directly if the tool is unavailable),
    and formulating a single recommendation.
2.  **Deliver Recommendation:** Deliver the recommendation to the user, mapping
    destination codes to plain English, explaining the reasoning, and offering
    to help with provisioning as detailed in `onboarding_prompts.md`.

### Phase 3: Implementation & Provisioning (Plan-Validate-Execute Pattern)

When the user accepts the recommendation and requests to provision or modify
cloud resources, follow the Phase 3 instructions in
`references/onboarding_prompts.md` using a strict **Plan-Validate-Execute** pattern.
Limit your actions to creating and validating draft artifacts for user review.

1.  **Analyze the Workspace:** Scan the user's workspace/open files/related
    directories with database resources scripts.
2.  **Obtain User Confirmation:** If the target infrastructure files are not
    clear, ask the user explicitly to confirm the file paths or target directory
    before modifying anything.
3.  **Draft Infrastructure Plan (Plan):** Create or edit the necessary Terraform
    configuration files or any other relevant scripts necessary to provision the
    resources. When creating or editing Terraform files or any other database
    resource provisioning script, you MUST:

    *   Add a stamped header comment at the top of every generated Terraform
        file/ shell script or any other resource provisioning script. (e.g., `#
        Generated with cloud onboarding skills selector @date`, replacing
        `@date` with the current date/timestamp).
    *   Add a custom default tag like `resource_generated_by = "cloud db
        onboarding skill"` under the `default_tags` block or as a resource
        label/tag.
    *   **gcloud CLI Generation**: When drafting `gcloud` CLI commands or shell
        scripts, you MUST follow the instructions in the `gcloud` skill.
        Specifically:
        *   Always use `gcloud beta` command group for database provisioning
            (e.g., `gcloud beta <group> <resource> create`).
        *   Validate leaf-level syntax using `gcloud help <leaf_command>` prior
            to proposing commands.
        *   Append explicit `--project=<PROJECT_ID>` and explicit location flags
            (`--region`, `--zone`, or `--location`).
        *   Use `--dry-run` or `--validate-only` preview flags where supported.
        *   Include custom label/tag flags (e.g.
            `--labels=resource_generated_by=cloud_db_onboarding_skill`) on
            generated `gcloud` provisioning commands.
        *   **Do NOT include `--quiet` (`-q`)**: Provisioning commands are
            drafted for interactive human user review and execution, so do NOT
            include non-interactive `--quiet` or `-q` flags.
        *   **No Live Write Execution**: The skill MUST ONLY draft provisioning
            commands or code for user review and MUST NOT execute mutating/write
            infrastructure operations directly.

4.  **Validate Infrastructure Code (Validate):** Before finalizing, you must
    validate the drafted infrastructure code to verify syntax and configuration
    correctness. *Why this matters:* Validating Terraform code ensures that
    configuration blocks, IAM bindings, and instance sizing are
    syntax-error-free and strictly enforceable before code review.

5.  **Create Pull Request (Execute):** Once validation succeeds with zero
    errors, automatically create a Pull request containing the validated
    Terraform/shell/scripts updates for user review. Leave live infrastructure
    changes (`terraform apply` or `gcloud` commands) to human review or
    automated CI/CD pipelines.

--------------------------------------------------------------------------------

## Supporting Resources & Documentation

- [Google Cloud Databases Overview](https://cloud.google.com/products/databases)
-   Use the `gcloud` skill for CLI command formatting and validation.
references/
attribution.md 1.9 KB
# Usage Attribution

**MUST READ**: Before executing any `gcloud`, REST API, or MCP command with
this skill, follow these usage attribution instructions. Tag every command you
execute directly in the terminal so usage can be attributed. The tag identifies
only the skill and its version; it carries no user data.

-   **`gcloud` CLI Commands**: Prefix every `gcloud` invocation, whatever the
    subcommand, with the metrics environment variable. Set it inline on each
    command because shell state may not persist between commands:

    ```bash
    CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:cloud-databases-onboarding)" \
    gcloud <command> [flags]
    ```

    Do not use `gcloud config set` for this: it would persist beyond the current
    task and mislabel unrelated usage.

-   **Direct HTTP, REST, and MCP Requests**: On direct HTTP calls to Google
    Cloud APIs (for example with `curl`) or HTTP requests to a remote MCP
    server, include `agent-skills/1.0 (skill:cloud-databases-onboarding)` in the `User-Agent`
    header. If a `User-Agent` header is already specified, append this string to
    the end of it rather than overwriting existing `User-Agent` data — the
    collection pipeline parses the `agent-skills/<version>` and `skill:<name>`
    tokens, so any rewording breaks attribution:

    ```
    User-Agent: <existing_user_agent> agent-skills/1.0 (skill:cloud-databases-onboarding)
    ```

-   **Constraint for Generated Code**: The tracking prefix is strictly for
    commands you execute directly in the terminal. Do NOT include this tracking
    prefix in generated scripts, Terraform templates, or code provided to the
    user for their own repositories.

-   **User Opt-Out**: If the user asks to disable or remove tracking or
    attribution tags, omit the `CLOUDSDK_METRICS_REQUEST_ATTRIBUTION` variable
    and custom `User-Agent` suffix from all commands.
onboarding_prompts.md 12.1 KB
# Database onboarding agent instructions

Your primary role is to assist users in selecting the best GCP database service
for their use case from the Google Cloud (GCP) portfolio.

You operate in one of three distinct phases: **Phase 1 (Discovery)**, **Phase 2
(Recommendation)**, or **Phase 3 (Implementation & Provisioning)**. Evaluate the
active conversation history to determine your current phase and strictly follow
the instructions for that phase.

## CRITICAL CONSTRAINTS

**NEVER provide a premature database recommendation or guess a database choice
during Phase 1.** *Why this matters:* Recommending a target database without
verifying data model flexibility, transaction consistency (ACID vs. eventual),
and throughput/scale leads to incompatible architectural choices, failed
migrations, and costly re-architecting.

**GLOBAL OVERRIDE: Instance Creation** **Condition:** At ANY point in the
conversation (Phase 1, Phase 2, or Phase 3), if the user explicitly requests to
create a database instance. **Your Action:**

1.  IMMEDIATELY proceed to **Phase 3: Implementation & Provisioning
    (Plan-Validate-Execute)**.

2.  For the `database_type` argument, provide the requested database (e.g.,
    "PostgreSQL", "Spanner").

3.  For the `user_context` argument, provide a summary of the requirements
    gathered.

4.  After the tool returns a JSON response, your FINAL response to the user must
    be ONLY the exact JSON content returned by the tool. Do not add any
    conversational filler or markdown blocks.

--------------------------------------------------------------------------------

## PHASE 1: DISCOVERY (Information Gathering)

**Condition:**
** DO NOT JUMP TO RECOMMENDATION WITHOUT ASKING FOR THE BELOW INFORMATION.**
You are in this phase until you have a complete picture of
the user's requirements. *A "complete picture" generally requires knowing: 1)
Data model (e.g., relational, document, key-value, vector), 2) Primary workload
(OLTP, OLAP, HTAP, vector search), 3) Scale, latency, and throughput
requirements (e.g., QPS, vector count, number of dimensions, index size),

4) On-prem requirements and 5) Current database/migration context.

**Stay in this phase until you have gathered enough
information to confidently recommend a database product with 90% confidence.**

**Your Actions & Rules:**

1.  **Efficiency:** Gather requirements efficiently by asking multiple relevant
    follow-up questions in a single turn. Your goal is to get a "complete
    picture" (data model, workload, scale, and context) as quickly as possible.

2.  **Constraint:** Aim to gather enough information to make a confident
    recommendation within **1-2 turns maximum**.

3.  **User-Friendly Phrasing:** Frame your questions in plain, accessible
    language. If you must use technical jargon (e.g., "OLTP," "HTAP,"
    "relational," "horizontal scaling"), you MUST provide a brief,
    easy-to-understand definition in plain English.

4.  **Provide Examples:** Along with each question, provide 3 or 4 options for
    the users to choose from. Users may also respond with free text.

    *   *Example:* "Are you dealing with highly structured data (like strict
        accounting tables where every row looks the same), flexible/unstructured
        data (like user profiles with varying attributes, JSON documents, or IoT
        device logs), or both?"

    *   *Example:* "What does the database need to do with the stored
        information? For example, will you primarily be adding to and updating
        it (like a shopping cart or user profile), searching and transforming it
        (like running reports or analytics), or both?"

5.  Use the provided discovery questions as a baseline, but adapt them to fit
    these user-friendly rules: {discovery_questions_by_source}

6.  Maintain a conversational, empathetic, and helpful tone.

7.  Ask the user if they have any additional context or requirements to add
    about their workflow.

**CRITICAL CONSTRAINT:** You MUST NOT call the {database_selection_agent_name}
during this phase. *Why this matters:* Invoking the selection tool without a
complete discovery context results in inaccurate or generic recommendations that
fail to account for critical migration complexity, schema constraints, or IOPS
requirements.

--------------------------------------------------------------------------------

## PHASE 2: RECOMMENDATION (Analysis & Delivery)

**Condition:** You are in this phase when you have gathered enough explicit
information from the user (ideally within 1-2 turns) to confidently recommend a
database.

**Your Actions (Execute in strict order):**

### **Step A: The Summary & Tool Call**

1.  Distill all the user's requirements from the conversation history into a
    single, comprehensive sentence.

2.  **IMMEDIATELY CALL THE DATABASE SELECTION TOOL** using ONLY this summary
    sentence as your input argument.

*💡 Examples of highly effective summary arguments for the tool call:*

*   "I need a low-cost, 100% open-source compatible, fully managed relational
    database for a small internal web app. It will have low traffic and doesn't
    need to scale much. MySQL or PostgreSQL is fine. We are on MySQL 5.7."

*   "We're migrating a large (10TB+) on-prem PostgreSQL 15 database to GCP. We
    need a managed service with significantly better performance for mixed OLTP
    and analytical (HTAP) workloads than standard PostgreSQL, plus low-lag read
    replicas for reporting."

*   "We are modernizing from a self-hosted Oracle 19c database and want to move
    to an open-source compatible database on GCP to reduce licensing costs. Key
    needs are robust migration tooling, high availability, HTAP capabilities,
    and a fully managed service."

*   "For our core transaction system, I need a globally distributed relational
    database capable of horizontal write scaling with strong consistency, and it
    must offer at least 99.999% availability. We're migrating from a sharded
    MySQL setup."

*   "I'm looking for a managed NoSQL database on GCP for a high-throughput (1M+
    OPS), low-latency (<10ms) key-value store, primarily for time-series data
    from IoT devices. We're migrating from on-prem HBase."

*   "I'm building a new mobile app and need a serverless NoSQL document database
    that's easy to use, handles real-time data synchronization with clients,
    offers offline support, and has a generous free tier to start."

### **Step B: The Final Response & Recommendation Delivery**

1.  **CRITICAL INSTRUCTION:** After the tool returns a response, you must
    generate a final, user-facing response explaining the recommendation.

2.  Provide exactly ONE top database recommendation based on the tool's output.

3.  **Map Destination Codes to Plain English:** The tool returns destination
    codes (enums). You MUST translate them to plain-English product names in
    your response to the user according to this mapping:

    *   `ALLOYDB_FOR_POSTGRESQL` -> AlloyDB for PostgreSQL
    *   `ALLOYDB_OMNI` -> AlloyDB Omni
    *   `BIGTABLE` -> Cloud Bigtable
    *   `CLOUD_SQL_FOR_MYSQL_ENTERPRISE` -> Cloud SQL for MySQL Enterprise
    *   `CLOUD_SQL_FOR_MYSQL_ENTERPRISE_PLUS` -> Cloud SQL for MySQL Enterprise
        Plus
    *   `CLOUD_SQL_FOR_POSTGRESQL_ENTERPRISE` -> Cloud SQL for PostgreSQL
        Enterprise
    *   `CLOUD_SQL_FOR_POSTGRESQL_ENTERPRISE_PLUS` -> Cloud SQL for PostgreSQL
        Enterprise Plus
    *   `CLOUD_SQL_FOR_SQL_SERVER` -> Cloud SQL for SQL Server
    *   `FIRESTORE` -> Google Cloud Firestore
    *   `MEMORYSTORE` -> Memorystore
    *   `MEMORYSTORE_FOR_MEMCACHED` -> Memorystore for Memcached
    *   `MEMORYSTORE_FOR_REDIS` -> Memorystore for Redis
    *   `MEMORYSTORE_FOR_VALKEY` -> Memorystore for Valkey
    *   `SPANNER` -> Cloud Spanner
    *   `SPANNER_GRAPH` -> Cloud Spanner Graph
    *   `ORACLE_AT_DATABASES` -> Oracle Database@Google Cloud
    *   `ORACLE_SELF_MANAGED` -> Oracle (Self-Managed)
    *   `SPANNER_OMNI` -> Spanner Omni

4.  Clearly explain your reasoning by mapping the GCP database features to the
    user's stated requirements. Keep the explanation accessible, just like in
    the discovery phase.

5.  Offer to help the customer create a starter instance of the recommended
    database (transitioning to Phase 3 upon user acceptance).

6.  **DO NOT call the database selection tool again** after it has returned a
    successful result.

--------------------------------------------------------------------------------

## PHASE 3: IMPLEMENTATION & PROVISIONING (Plan-Validate-Execute)

**Condition:** You are in this phase when the user accepts the recommendation
and requests to provision, create, or modify database resources, or triggers the
global override.

**Your Actions & Rules (Follow strict Plan-Validate-Execute):**

Follow the **Plan-Validate-Execute Pattern** to draft the infrastructure
modifications. Do NOT apply changes to production directly:

1.  **Analyze the Workspace:** Scan the user's workspace, open files, and
    related directories for existing database resource scripts (e.g.,
    Terraform configuration files).

2.  **Obtain User Confirmation:** If the target infrastructure files or
    directory are not clear, ask the user explicitly to confirm the file
    paths or target directory before modifying anything.

3.  **Draft Infrastructure Plan (Plan):** Create or edit the necessary Terraform
    configuration files or shell scripts to provision the resources.

    -   When generating `gcloud` CLI commands or shell scripts, you MUST follow
        and apply the `gcloud` skill instructions:
        *   Always use `gcloud beta` command group for database provisioning
            (e.g., `gcloud beta <group> <resource> create`).
        *   Validate leaf-level command syntax using `gcloud help
            <leaf_command>` prior to proposing commands.
        *   Explicitly append `--project=<PROJECT_ID>` and explicit location
            flags (`--region`, `--zone`, or `--location`).
        *   Include `--dry-run` or `--validate-only` for pre-execution
            verification if supported by the command.
        *   Include custom label/tag flags (e.g.,
            `--labels=resource_generated_by=cloud_db_onboarding_skill`) on
            generated `gcloud` provisioning commands.
        *   Do NOT include `--quiet` (`-q`) flags in generated `gcloud` commands
            (commands are drafted for interactive user review).
        *   The skill MUST ONLY draft provisioning commands or code for user
            review and MUST NOT execute mutating/write infrastructure operations
            directly.
    -   When creating or editing Terraform files or shell scripts, you MUST:
        *   Add a stamped header comment at the top of every generated file
            (e.g., `# Generated with cloud onboarding skills selector
            @timestamp`).
        *   Add a custom default tag like `resource_generated_by = "cloud db
            onboarding skill"` under the `default_tags` block or as a resource
            label/tag.

4.  **Validate Infrastructure Code (Validate):** Before finalizing, validate
    the drafted infrastructure code to verify syntax and configuration
    correctness. *Why this matters:* Validating Terraform code ensures that
    configuration blocks, IAM bindings, and instance sizing are
    syntax-error-free and strictly enforceable before code review.

5.  **Create Pull Request / Change List (Execute):** After validation succeeds
    with zero errors, automatically submit the changes as a **Change List (CL)**
    or Pull Request for user review. Never apply live infrastructure changes
    (`terraform apply` or `gcloud` commands) directly to production
    yourself. If necessary, you may use the {resource_creation_agent_name}
    to help draft this.

7.  **DO NOT call the database selection tool again** after it has returned a
    successful result.

## FALLBACK: Tool Failure Handling

If you call the database selection tool and it returns a `failure_reason`, an
error, or an insufficient response:

1.  **DO NOT** call the tool again immediately.
2.  If the failure is due to insufficient information, ask an additional
    follow-up question to gather more information.

3.  If the failure is due to something else, return the error and allow the
    agent calling you to handle the error.
recommendation_matrix.txt 43.5 KB
# Recommendation Matrix for Database Migrations to Google Cloud

# ===================================================================================================
# TABLE OF CONTENTS (LINE HINTS FOR AGENT JUST-IN-TIME READING)
# To save context window tokens when reading this file via view_file, use StartLine/EndLine with these line hints:
#
# | Source Database                              | Line Range  | Primary GCP Destinations |
# | :---                                         | :---        | :---                     |
# | MySQL                                        | L23 - L96   | Cloud SQL for MySQL Enterprise / Plus, Spanner |
# | PostgreSQL                                   | L98 - L214  | Cloud SQL for PostgreSQL, AlloyDB, Spanner |
# | Microsoft SQL Server                         | L216 - L283 | Cloud SQL for SQL Server, AlloyDB for PostgreSQL, Spanner |
# | Oracle                                       | L285 - L441 | Oracle Database@Google Cloud, Oracle Self-Managed, AlloyDB for PostgreSQL, Spanner |
# | HBase                                        | L443 - L479 | Bigtable |
# | Amazon DynamoDB                              | L481 - L535 | Bigtable, Spanner |
# | Apache Cassandra                             | L537 - L594 | Bigtable, Spanner |
# | Redis / Valkey                               | L596 - L645 | Memorystore for Valkey |
# | Memcached                                    | L647 - L677 | Memorystore for Valkey |
# | Aerospike                                    | L679 - L729 | Bigtable, Memorystore for Valkey |
# | MongoDB / Amazon DocumentDB / Azure CosmosDB   | L731 - L775 | Firestore, Spanner |
# | Neo4j / Amazon Neptune / Aerospike Graph       | L777 - L814 | Spanner Graph |
# ===================================================================================================

# MySQL
source_recommendations {
  source: MYSQL
  discovery_questions: [
    "What MySQL version?",
    "What is the size of the database?",
    "What are the availability requirements?",
    "Is it a sharded MySQL deployment?",
    "Are you willing to refactor the application?",
    "What is the planned growth rate in the next 6-12 months?",
    "Does your application require temporary scaling up to handle workload surges?"
  ]
  recommendations {
    selection_criteria: [
      "100% open source compatible",
      "Standard production performance and availability (99.95% SLA)",
      "Also includes versions predating MySQL 8"
    ]
    primary_destination: CLOUD_SQL_FOR_MYSQL_ENTERPRISE
    migration_complexity: [
      "Low complexity. Easy with Database Migration Service"
    ]
    best_when: "Existing MySQL customers are looking to stay on MySQL. Cloud SQL for MySQL is a great choice for straightforward migrations, offering an easy and accessible path to a fully managed, secure, and highly available cloud database."
    benefits: [
      "Fully managed",
      "Secure",
      "H/A & DR",
      "99.95% SLA",
      "Broad MySQL version support",
      "Lower entry point"
    ]
  }
  recommendations {
    selection_criteria: [
      "100% open source compatible",
      "High performance (up to 3x faster reads, 2x faster writes) and high availability (99.99% SLA, near-zero maintenance downtime)",
      "Continuous availability is needed",
      "MySQL 8+ only"
    ]
    primary_destination: CLOUD_SQL_FOR_MYSQL_ENTERPRISE_PLUS
    migration_complexity: [
      "Low complexity. Easy with Database Migration Service"
    ]
    best_when: "Cloud SQL Enterprise Plus is the premier choice for mission-critical MySQL workloads, delivering dramatic performance gains with up to 3x faster reads and 2x improved write latency, while ensuring maximum availability through near-zero maintenance downtime and a 99.99% SLA."
    benefits: [
      "All the benefits of Cloud SQL for MySQL Enterprise",
      "Optimized performance (3x faster)",
      "Near zero maintenance downtime",
      "99.99% SLA"
    ]
  }
  recommendations {
    selection_criteria: [
      "Sharded MySQL workloads (e.g. Vitess, app sharding) or large scale workloads",
      "Ability to handle extremely large databases",
      "Customers looking for highest scale and availability (e.g. payments use-cases)",
      "Customer pain point around scale and management of existing sharded MySQL environment",
      "Workloads with highly spiky or unpredictable traffic patterns that benefit from autoscaling to optimize costs"
    ]
    primary_destination: SPANNER
    migration_complexity: [
      "Medium to Higher Complexity. Requires query and transaction handling changes, but Google SQL similarity to MySQL limits the rewrite effort. We offer free Spanner Migration Tool and Black Belt team expertise"
    ]
    best_when: "The source DB is sharded MySQL - Spanner transforms the operational burden of sharding. Instead of managing individual database shards, Spanner operates as a single, logical database that automatically handles horizontal scaling, delivering virtually infinite capacity and multi-region consistent writes. This shift eliminates the pain of re-sharding and cross-shard management, replacing it with a system built for the highest reliability, backed by an up to 99.999% SLA and no maintenance downtime. Spanner's native autoscaling also makes it a highly cost-effective solution for spiky workloads."
    benefits: [
      "Virtually infinite scale",
      "Multi-region consistent writes",
      "No maintenance downtime",
      "99.999% SLA",
      "Online schema changes",
      "Automatic scaling to handle spiky workloads and optimize costs"
    ]
  }
}

# PostgreSQL
source_recommendations {
  source: POSTGRESQL
  discovery_questions: [
    "What PostgreSQL version?",
    "What is the size of the database?",
    "Is it an analytical/HTAP workload?",
    "Is it a sharded PostgreSQL deployment?",
    "Do you need to leave a portion of your workload on-premises?",
    "Do you need a multi cloud solution?",
    "Do you need to build Gen AI applications with pgvector?",
    "Does your application require temporary scaling up to handle workload surges?"
  ]
  recommendations {
    selection_criteria: [
      "100% open source compatible",
      "Standard production performance and availability (99.95% SLA)",
      "Supports PostgreSQL 9.6 and above (including legacy versions 9.6, 10, 11)"
    ]
    primary_destination: CLOUD_SQL_FOR_POSTGRESQL_ENTERPRISE
    migration_complexity: [
      "Low complexity. Easy with Database Migration Service"
    ]
    best_when: "Existing PostgreSQL customers who are looking to stay on PostgreSQL. Cloud SQL is a great choice for straightforward migrations, offering an easy and accessible path to a fully managed, secure, and highly available cloud database."
    benefits: [
      "Fully managed",
      "Secure",
      "H/A & DR",
      "99.95% SLA",
      "Broadest PostgreSQL version support",
      "Up to 64TB storage",
      "pgvector support for Gen AI apps"
    ]
  }
  recommendations {
    selection_criteria: [
      "100% open source compatible",
      "High performance (up to 4x reads, 2x writes) and high availability (99.99% SLA, near-zero maintenance downtime)",
      "Supports PostgreSQL 12 and above"
    ]
    primary_destination: CLOUD_SQL_FOR_POSTGRESQL_ENTERPRISE_PLUS
    migration_complexity: [
      "Low complexity. Easy with Database Migration Service"
    ]
    best_when: "Existing PostgreSQL customers who are looking to stay on PostgreSQL. Cloud SQL Enterprise Plus delivers dramatic performance gains, while ensuring maximum availability through a 99.99% SLA."
    benefits: [
      "All the features and capabilities of Enterprise edition with up to 2x improved write throughput and up to 4x improved read throughput compared to Enterprise edition",
      "Near zero maintenance downtime",
      "99.99% SLA",
      "pgvector support for Gen AI apps"
    ]
  }
  recommendations {
    selection_criteria: [
      "Higher level of performance and manageability than open source",
      "Fully open source compatible",
      "Extreme performance (4x transactional, 100x analytical HTAP) and high availability (99.99% SLA, near-zero maintenance downtime)",
      "Hybrid Transactional and Analytical (HTAP) workloads",
      "Do you need to scale out for reads?"
    ]
    primary_destination: ALLOYDB_FOR_POSTGRESQL
    migration_complexity: [
      "Low complexity. Easy with Database Migration Service"
    ]
    best_when: "AlloyDB is a next-generation, PostgreSQL-compatible database that modernizes the most demanding enterprise workloads by delivering extreme performance for transactions and analytics (HTAP), a cloud-native elastic architecture, and a fully integrated platform for generative AI, all backed by enterprise-grade availability."
    benefits: [
      "Superior performance, columnar engine, improved manageability, autopilot optimizations",
      "4x performance for transactions and 100x faster analytical queries compared to stock PostgreSQL",
      "Up to 64TB storage (>64TB coming soon)",
      "Cloud-first architecture with complete disaggregation of compute and storage",
      "Read replicas and read replica pools",
      "Vertex AI integration for real-time model inferencing, BQ integration with Datastream",
      "pgvector support for Gen AI apps",
      "Near zero maintenance downtime"
    ]
  }
  recommendations {
    selection_criteria: [
      "Need to run PostgreSQL workloads on-premises and/or in any public cloud",
      "Need to break free from legacy databases faster than you can replatform in the Cloud",
      "Developers looking for a local / on-premises database"
    ]
    primary_destination: ALLOYDB_OMNI
    migration_complexity: [
      "Low complexity"
    ]
    best_when: "PostgreSQL customers who are looking to stay on PostgreSQL. Looking to run on-prem, in any cloud, or in an air-gapped environment."
    benefits: [
      "Run AlloyDB anywhere you run Databases",
      "2x performance for OLTP and 100x for analytical queries compared to stock PostgreSQL",
      "Support for edge computing, hybrid and multi-cloud customers who have regulatory restrictions or data sovereignty requirements",
      "No cost for development and testing",
      "Fully compatible with AlloyDB in the Cloud"
    ]
  }
  recommendations {
    selection_criteria: [
      "Ability to handle extremely large databases or sharded PostgreSQL workloads",
      "Customers looking for highest scale and availability (e.g. payments use-cases)",
      "Workloads with highly spiky or unpredictable traffic patterns that benefit from autoscaling to optimize costs"
    ]
    primary_destination: SPANNER
    migration_complexity: [
      "Medium complexity. While Spanner is a distributed database, the Spanner PostgreSQL dialect significantly reduces the migration effort. We offer free Spanner Migration Tool and Black Belt team expertise"
    ]
    best_when: "The source is a large or sharded PostgreSQL - Spanner transforms the operational burden of sharding. Instead of managing individual database shards, Spanner operates as a single, logical database that automatically handles horizontal scaling, delivering virtually infinite capacity and multi-region consistent writes. This shift eliminates the pain of re-sharding and cross-shard management, replacing it with a system built for the highest reliability, backed by an up to 99.999% SLA and no maintenance downtime. Spanner's native autoscaling also makes it a highly cost-effective solution for spiky workloads."
    benefits: [
      "Virtually infinite scale",
      "Multi-region consistent writes",
      "No maintenance downtime",
      "99.999% SLA",
      "Online schema changes",
      "Analyze operational data isolated from transactional workloads with BigQuery",
      "Automatic scaling to handle spiky workloads and optimize costs"
    ]
  }
}

# SQL Server
source_recommendations {
  source: SQL_SERVER
  discovery_questions: [
    "What SQL Server version?",
    "Are you concerned about licensing costs and do you have an existing ELA with Microsoft?",
    "SQL Server-specific options needed?",
    "Is this OLTP, analytical, or mixed workload?",
    "Are you willing to refactor the application?",
    "Are you interested in moving to open source?"
  ]
  recommendations {
    selection_criteria: [
      "100% SQL Server compatible",
      "Supports legacy or packaged apps that need to run on SQL Server",
      "Data center exit"
    ]
    primary_destination: CLOUD_SQL_FOR_SQL_SERVER
    migration_complexity: [
      "Easy homogeneous migrations with Database Migration Service coming soon; Current solution is to use SQL Server technologies"
    ]
    best_when: "Existing SQL Server users are looking to stay on SQL Server, Cloud SQL for SQL Server is a great choice for straightforward migrations, offering an easy and accessible path to a fully managed, secure, and highly available cloud database."
    benefits: [
      "Fully managed",
      "Secure",
      "H/A & DR",
      "99.95% SLA",
      "Multi-regional DR"
    ]
  }
  recommendations {
    selection_criteria: [
      "Looking to break free from legacy, proprietary database with expensive licensing and modernize to open source",
      "Support for Hybrid Transactional and Analytical (HTAP) workloads via an open (PostgreSQL) interface"
    ]
    primary_destination: ALLOYDB_FOR_POSTGRESQL
    migration_complexity: [
      "Heterogeneous migration required with application code changes; No cost Database Migration Assessment via first-party tool"
    ]
    best_when: "(Modernization opportunity) For SQL Server customers looking to break free from legacy licensing costs, AlloyDB for PostgreSQL offers the premier path to modernization. It provides a fully managed, PostgreSQL-compatible experience that combines the freedom of open-source with performance far exceeding the standard version. AlloyDB is built to handle the most demanding enterprise workloads with its extreme speed for transactions and analytics (HTAP), a cloud-native elastic architecture, and a powerful, integrated AI platform."
    benefits: [
      "Fully PostgreSQL compatible, with no licensing costs or vendor lock-in",
      "Superior performance, columnar engine, improved manageability, autopilot optimizations",
      "Cloud-first architecture with complete disaggregation of compute and storage",
      "Vertex AI integration for real-time model inferencing, BigQuery integration with Datastream",
      "99.99% SLA",
      "Monetize your operational data with AI-driven insights: Build transformative applications with vector search, foundation models integration, and generative AI, while maintaining open-source compatibility",
      "Near zero maintenance downtime"
    ]
  }
  recommendations {
    selection_criteria: [
      "Highest scale and availability requirements (e.g. global payments workloads)",
      "Willing to modernize and migrate to a distributed database to eliminate legacy SQL Server licensing costs"
    ]
    primary_destination: SPANNER
    migration_complexity: [
      "Higher complexity. Requires heterogeneous migration and application rewrite from T-SQL to Google SQL or PostgreSQL dialect. We offer database migration assessment tools and expertise"
    ]
    best_when: "SQL Server customers with extreme scale, global availability, and strong consistency requirements that exceed the capabilities of traditional relational databases. Spanner provides virtually infinite horizontal scale, multi-region consistent writes, and an up to 99.999% SLA, making it the premier choice for mission-critical modernizations."
    benefits: [
      "Virtually infinite scale and global consistency",
      "99.999% SLA with no maintenance downtime",
      "Eliminate expensive SQL Server licensing costs",
      "Support for Google SQL and PostgreSQL dialects"
    ]
  }
}

# Oracle
source_recommendations {
  source: ORACLE
  discovery_questions: [
    "What Oracle Database version and do you have an existing ULA?",
    "What is the size of the database?",
    "Oracle Database options used?",
    "Are you willing to do some refactoring of the application?",
    "Are you running Oracle Apps and/or other COTS apps that use Oracle DB?",
    "Need to run databases on-premises and/or in any public cloud?"
  ]
  # source: ORACLE - recommendation #1
  recommendations {
    selection_criteria: [
      "Mission critical databases",
      "Runs Exadata today",
      "Highest performance or availability requirements",
      "Dedicated infrastructure requirements",
      "Needs to run DW or mixed workload with Oracle"
    ]
    primary_destination: ORACLE_AT_DATABASES
    migration_complexity: [
      "Low complexity, supports physical and logical migrations"
    ]
    benefits: [
      "Highest performance and availability of any Oracle database platform",
      "Deploy Oracle Database 19c or 23ai with automation from Oracle",
      "License included or BYOL pricing for flexible compliance",
      "Dedicated infrastructure provides highest levels of security and consistent performance",
      "Run the latest version of Oracle Database, including 23ai",
      "Take advantage of Google Cloud’s differentiated AI and analytics capabilities"
    ]
  }
  # source: ORACLE - recommendation #2
  recommendations {
    selection_criteria: [
      "Runs Oracle RAC today",
      "Needs access to operating system",
      "Has a limited number of Oracle licenses available",
      "Wants to run RAC without negotiating a contract with Oracle"
    ]
    primary_destination: ORACLE_AT_DATABASES
    migration_complexity: [
      "Low complexity, supports physical and logical migrations"
    ]
    benefits: [
      "Deploy Oracle Database 19c or 23ai with automation from Oracle",
      "High availability with the lowest cost of entry",
      "License included or BYOL pricing for flexible compliance",
      "Scalable deployments take advantage of cloud economics",
      "Run the latest version of Oracle Database, including 23ai",
      "Take advantage of Google Cloud’s differentiated AI and analytics capabilities",
      "Available with public offer to run month-to-month without long term contracts"
    ]
  }
  # source: ORACLE - recommendation #3
  recommendations {
    selection_criteria: [
      "Smaller departmental or dev/test databases",
      "Needs access to operating system",
      "Has a limited number of Oracle licenses available"
    ]
    primary_destination: ORACLE_AT_DATABASES
    migration_complexity: [
      "Low complexity, supports physical and logical migrations"
    ]
    benefits: [
      "Lowest cost of entry for Oracle Database",
      "License included or BYOL pricing for flexible compliance",
      "Run the latest version of Oracle Database, including 23ai",
      "Take advantage of Google Cloud’s differentiated AI and analytics capabilities"
    ]
  }
  # source: ORACLE - recommendation #4
  recommendations {
    selection_criteria: [
      "Smaller departmental or dev/test databases",
      "Looking for a fully managed database",
      "Has a limited number of Oracle licenses available"
    ]
    primary_destination: ORACLE_AT_DATABASES
    migration_complexity: [
      "Low complexity, supports physical and logical migrations"
    ]
    benefits: [
      "Fully managed deployment of Oracle database, including backup and recovery, patching, and system management",
      "License included or BYOL pricing for flexible compliance",
      "Scalable deployments ranging from 1 CPU to hundreds of cores",
      "Run the latest version of Oracle Database, including 23ai",
      "Take advantage of Google Cloud’s differentiated AI and analytics capabilities",
      "Available with public offer to run month-to-month without long term contracts"
    ]
  }
  # source: ORACLE - recommendation #5
  recommendations {
    selection_criteria: [
      "Lift and shift your Oracle database and associated workload to GCE/GKE",
      "Data center exit",
      "In-house and department app workloads running on Oracle database"
    ]
    primary_destination: ORACLE_SELF_MANAGED
    migration_complexity: [
      "Low complexity, lift and shift"
    ]
    benefits: [
      "Run Oracle in any Google Cloud region globally",
      "Maintain full control over database and OS versions, enabling support for critical legacy Oracle instances or non-Oracle Linux operating systems",
      "Elastic, on-demand infrastructure lets you scale compute and storage independently",
      "Ideal for applications moving to microservice architecture with GKE"
    ]
  }
  # source: ORACLE - recommendation #6
  recommendations {
    selection_criteria: [
      "Mission critical databases",
      "Highest performance or availability requirements",
      "100% open source compatible (need to reduce proprietary database license expenditures)",
      "Future proofing apps for AI",
      "Hybrid Transactional and Analytical (HTAP) workloads"
    ]
    primary_destination: ALLOYDB_FOR_POSTGRESQL
    migration_complexity: [
      "Heterogeneous migration with schema and data migration with Database Migration Service;",
      "Application code changes required and support for automated code conversion coming soon"
    ]
    best_when: "Oracle customers looking to move away from the expensive licensing and vendor lock-in technology to an open standards based database with a rich set of capabilities to meet their enterprise workloads needs. AlloyDB is built to handle the most demanding enterprise workloads with its extreme speed for transactions and analytics (HTAP), a cloud-native elastic architecture, and a powerful, integrated AI platform."
    benefits: [
      "Fully PostgreSQL compatible, with no vendor lock-in",
      "Superior performance, columnar engine, improved manageability, autopilot optimizations",
      "4x transaction throughput and up to 100x faster analytical queries compared to stock PostgreSQL",
      "Cloud-first architecture with complete disaggregation of compute and storage",
      "Vertex AI integration for real-time model inferencing, BigQuery integration with Datastream",
      "Monetize your operational data with AI-driven insights. Build transformative applications with vector search, foundation models integration, and generative AI, while maintaining open-source compatibility.",
      "Near zero maintenance downtime",
      "Run AlloyDB anywhere you run databases with AlloyDB Omni",
      "Suitable for edge computing, hybrid and multi-cloud, customers who have regulatory restrictions or data sovereignty requirements"
    ]
  }
  # source: ORACLE - recommendation #7
  recommendations {
    selection_criteria: [
      "Highest scale and availability requirements (e.g. global payments workloads)",
      "Looking to modernize and eliminate expensive Oracle licensing and vendor lock-in"
    ]
    primary_destination: SPANNER
    migration_complexity: [
      "Higher complexity. Requires heterogeneous migration and application rewrite from PL/SQL to Google SQL or PostgreSQL dialect. We offer database migration assessment tools and expertise"
    ]
    best_when: "Oracle customers with extreme scale, global availability, and strong consistency requirements that exceed the capabilities of traditional relational databases. Spanner provides virtually infinite horizontal scale, multi-region consistent writes, and an up to 99.999% SLA, making it the premier choice for mission-critical modernizations."
    benefits: [
      "Virtually infinite scale and global consistency",
      "99.999% SLA with no maintenance downtime",
      "Eliminate Oracle licensing costs and vendor lock-in",
      "Support for Google SQL and PostgreSQL dialects"
    ]
  }
}

# HBase
source_recommendations {
  source: HBASE
  discovery_questions: [
    "What distribution of HBase?",
    "What is the database size, number of nodes, CPU and disk per cluster, and hardware configuration?",
    "Are coprocessors being used, and for what purpose?"
  ]
  recommendations {
    selection_criteria: [
      "Looking to move from self managed to fully managed",
      "HBase compatible key-value store suitable for all your application",
      "Cost sensitive app with high write throughput & large data volumes",
      "Storage-driven apps needing low cost storage with moderate to high read/write throughput"
    ]
    primary_destination: BIGTABLE
    migration_complexity: [
      "Tools for assessment and migration.",
      "Support for live & offline migrations",
      "Direct import tools from HBase to Bigtable",
      "Ability to migrate coprocessor functionality"
    ]
    best_when: "For customers running HBase, Bigtable is the ideal migration destination, offering a seamless path to modernization with its native support for the HBase API. This allows customers the ability to migrate existing applications with minimal code changes while eliminating the operational burden of managing complex HBase clusters. By moving to a fully managed platform, you gain virtually infinite scaling with single-digit millisecond latency, an up to 99.999% SLA with no maintenance downtime, and a lower TCO at any scale, driven by a native autoscaler and flexible SSD/HDD storage options."
    benefits: [
      "Fully managed key-value DB",
      "Support for HBase APIs",
      "Lower TCO at any scale",
      "Single digit millisecond read and write latencies",
      "Multi-writer support",
      "Virtually infinite scaling including writes",
      "Global replication and 99.999% SLA",
      "Autoscaler to reduce costs",
      "No maintenance downtime",
      "Low storage costs with both SSD and HDD"
    ]
  }
}

# DynamoDB
source_recommendations {
  source: DYNAMODB
  discovery_questions: [
    "What is the read/write workload ratio?",
    "What are the latency requirements?",
    "What capacity mode: on-demand or provisioned capacity?",
    "Are secondary indexes being used?",
    "Are multi-row transactions being used?",
    "Are Global Tables being used?"
  ]
  recommendations {
    selection_criteria: [
      "High write ratio (for Clickstream or Time Series style workloads)",
      "Large storage volume, needing low cost storage",
      "Flexible schema",
      "Multi-primary eventually consistent writes",
      "Multi-region write latency sensitive and using DynamoDB Global Tables"
    ]
    primary_destination: BIGTABLE
    migration_complexity: [
      "Heterogeneous migration",
      "Application code conversion required"
    ]
    best_when: "Customers are looking for similar access patterns including retrieving data via a unique key that is identical in both systems.  Application logic designed for DynamoDB's key-based lookups translates naturally to Bigtable's row key model. This conceptual alignment means the migration effort is less about re-architecting the application's core logic and more about adapting to a platform designed for superior scale and performance, building upon the familiar principles of a wide-column, key-value data store."
    benefits: [
      "Virtually infinite scaling including writes",
      "Single digit millisecond read and write latencies",
      "Flexible single or multi-replica deployment",
      "Low storage costs with both SSD and HDD",
      "Lower TCO for most workloads"
    ]
  }
  recommendations {
    selection_criteria: [
      "High read ratio",
      "Application leverages advanced database capabilities (indexes, composite keys, typed values, constraints, JSON, views, ACID transactions, SQL)",
      "Need strong and/or eventual consistency options for reads",
      "Need replication with strong consistency guarantees"
    ]
    primary_destination: SPANNER
    migration_complexity: [
      "Heterogeneous migration",
      "Application code conversion required"
    ]
    best_when: "For DynamoDB users, migrating to Spanner is a strategic modernization that provides a significant upgrade in database capabilities for roughly half the cost. This move allows customers the ability to evolve from a NoSQL K/V store to a globally distributed multi-model database that unlocks advanced features not native to DynamoDB."
    benefits: [
      "Virtually infinite scaling including writes",
      "Advanced database capabilities (e.g. SQL query, indexes, transactions, ACID, and typed values)",
      "Single digit milliseconds regional read and write latencies (strongly consistent)",
      "Single-region and multi-region strong consistency",
      "1/2 cost of DynamoDB"
    ]
  }
}

# Cassandra
source_recommendations {
  source: CASSANDRA
  discovery_questions: [
    "What is the read/write workload ratio?",
    "What are the latency requirements?",
    "Are secondary indexes being used?",
    "Are strong consistency reads needed?",
    "How many replicas are needed?",
    "What is the quorum consistency?",
    "What is the data volume?",
    "Do you need CQL querying dialect?"
  ]
  recommendations {
    selection_criteria: [
      "High write ratio (for Clickstream or Time Series style workloads)",
      "Large storage volume, needing low cost storage",
      "Flexible schema",
      "Multi-primary eventually consistent writes",
      "Multi-region write latency sensitive"
    ]
    primary_destination: BIGTABLE
    migration_complexity: [
      "Heterogeneous migration",
      "Application code conversion required"
    ]
    best_when: "When users want to maintain a familiar architecture. Both are wide-column NoSQL databases, meaning the core concepts of schema design and key-based access patterns are highly transferable, simplifying the transition. The primary driver for migrating is to move from a self-managed cluster to a fully managed, auto-scaling service. This allows you to offload the complexities of maintenance and tuning, while gaining Bigtable’s consistent single-digit millisecond latency and a lower total cost of ownership at virtually any scale."
    benefits: [
      "Virtually infinite scaling including writes",
      "Single digit milliseconds read and write latency",
      "Flexible single or multi-replica deployment",
      "Low storage costs with both SSD and HDD",
      "Lower TCO for most workloads"
    ]
  }
  recommendations {
    selection_criteria: [
      "High read ratio",
      "Application leverages advanced database capabilities (indexes, composite keys, typed values, constraints, JSON, views, ACID transactions, SQL)",
      "Use SQL API",
      "Need strong and/or eventual consistency options for reads",
      "Need replication with strong consistency guarantees"
    ]
    primary_destination: SPANNER
    migration_complexity: [
      "Low complexity",
      "Near lift-and-shift migration using Spanner's native Cassandra-compatible interface (CQL and wire protocol support) with minimal application changes"
    ]
    best_when: "When users are looking to gain capabilities that are fundamentally impossible with a NoSQL architecture. The primary driver is upgrading from eventual consistency to Spanner's global, fully ACID-compliant transactions, which ensures absolute data integrity and simplifies application development. A key advantage of this modernization is Spanner's unified multi-model platform, allowing you to combine relational (SQL), full-text search, graph, and vector search queries directly on your live transactional data. This eliminates the need for separate specialized databases and complex data pipelines. Furthermore, the columnar storage engine in Spanner, which enables true HTAP (Hybrid Transactional/Analytical Processing) allows you to run fast, real-time analytical queries directly on your transactional data, a capability far beyond Cassandra's scope. The transition is also more practical than ever, as Spanner's native Cassandra interface allows developers to reuse their CQL queries and client libraries, minimizing code refactoring while eliminating the operational burden of Cassandra with a fully managed service."
    benefits: [
      "Virtually infinite scaling including writes",
      "Single digit milliseconds regional read and write latencies",
      "Single-region and multi-region strong consistency",
      "Advanced database capabilities (e.g. SQL query, indexes, transactions, ACID, and typed values)",
      "Lower TCO for most workloads"
    ]
  }
}

# Redis, Valkey
source_recommendations {
  source: [REDIS, VALKEY]
  discovery_questions: [
    "What is the primary use case (caching, session store, pub/sub, real-time data)?",
    "What are the latency and throughput requirements?",
    "Is high availability and automatic failover critical?",
    "Are you looking for a fully managed service to reduce operational overhead?",
    "Which version of Redis/Valkey?",
    "Are you using clustering?",
    "What is the read/write throughput?",
    "Size of data stored in cache?"
  ]
  recommendations {
    selection_criteria: [
      "Need for a fully managed, in-memory data store.",
      "High throughput and ultra-low latency required.",
      "Compatibility with existing Redis commands and clients.",
      "High availability (automatic failover, replication) is essential.",
      "Use cases include caching, session management, real-time analytics, leaderboards, message queues.",
      "Moving from Redis to Valkey for OSS or for better performance",
      "Moving from self managed to fully managed",
      "Looking for an integrated experience with IAM Auth and other services"
    ]
    primary_destination: MEMORYSTORE_FOR_VALKEY
    migration_complexity: [
      "Low complexity migrations.",
      "Compatible with existing Redis and Valkey APIs.",
      "Data migration typically using RIOT or import a RDB file using RIOT tooling.",
      "No application code changes required."
    ]
    best_when: "For customers running Redis or Valkey, Memorystore for Valkey is the best choice. Valkey is fully compatible with Redis 7.2, making migration easy and seamless with no application code changes required. It offers a fully open-source solution with no lock-in, while delivering substantial performance enhancements (such as 3x throughput improvements compared to Memorystore for Redis Cluster in Valkey 9.0) and extreme performance with sub-millisecond latency, high availability (99.99% SLA), and zero-downtime scaling."
    benefits: [
      "Fully managed service, reducing operational burden.",
      "Fully managed experience to accelerate innovation and reduce risk and TCO (usually customers save >40-50% from Redis Enterprise)",
      "Full open-source compatibility with no lock-in",
      "Extreme performance with sub-millisecond latency and millions of operations per second.",
      "High availability (99.99% SLA) with automatic failover and replicas.",
      "Scalable (zero-downtime scaling).",
      "Zero downtime maintenance",
      "Integrated with Google Cloud ecosystem (monitoring, logging, security).",
      "Open-source compatible (Redis 7.2 and below, Valkey 7.2, 8.0, and 9.0).",
      "Supports persistence (RDB snapshot, AOF logging). And backups",
      "Support cross regional replication",
      "Valkey supports both clustering and noncluster mode.",
      "Valkey 9.0 supports 3x throughput improvements compared to Memorystore for Redis Cluster.",
      "Valkey supports up to 14.5TB data in cache"
    ]
  }
}

# Memcached
source_recommendations {
  source: MEMCACHED
  discovery_questions: [
    "What is the read/write throughput?",
    "How many nodes?",
    "Size of data stored in Memcached?"
  ]
  recommendations {
    selection_criteria: [
      "Moving to the cloud?",
      "Moving from self managed to fully managed?",
      "Looking for a next-gen engine to replace deprecated Memcached"
    ]
    primary_destination: MEMORYSTORE_FOR_VALKEY
    migration_complexity: [
      "Medium complexity migration.",
      "Requires updating application code to use a Valkey- or Redis-compatible client library (RESP protocol) instead of Memcached protocol."
    ]
    best_when: "For customers running Memcached, Memorystore for Valkey is the recommended migration path as the Memcached service is being deprecated. Valkey serves as our next-generation engine, providing a modern, fully open-source in-memory solution."
    benefits: [
      "Fully open source engine with no vendor lock-in.",
      "Zero-downtime horizontal and vertical scaling (from 1.25 GB instances to 27.5TB clusters).",
      "High availability architecture with a 99.99% SLA.",
      "Rich and flexible data structures (beyond simple key-value).",
      "Supports multi-command transactions and Lua scripting.",
      "Access to advanced modules.",
      "Persistence options including RDB snapshots and AOF (Append Only File)."
    ]
  }
}

# Aerospike
source_recommendations {
  source: AEROSPIKE
  discovery_questions: [
    "How large is the data?",
    "What are latency requirements?",
    "Is multi-region or multi-writer deployment required?",
    "What are availability requirements?"
  ]
  recommendations {
    selection_criteria: [
      "Looking to move from self managed to fully managed",
      "Data needs to be persisted",
      "Data volume makes in-memory options cost-prohibitive",
      "Does not require sub-millisecond latencies"
    ]
    primary_destination: BIGTABLE
    migration_complexity: [
      "Heterogeneous migration",
      "Application code conversion required"
    ]
    best_when: "Bigtable is a great destination for Aerospike workloads as it delivers single-digit millisecond latency and with significantly lower TCO and reduced risk of a fully managed, auto-scaling platform. You get matching performance while completely eliminating the operational overhead of managing complex clusters."
    benefits: [
      "Fully managed experience and reduced risk and TCO",
      "Open-source compatibility with no lock-in",
      "Single digit millisecond read and write latency",
      "Globally replicated and up to 99.999% SLA",
      "Low storage cost and native autoscaler to reduce cost"
    ]
  }
  recommendations {
    selection_criteria: [
      "Moving from self managed to fully managed",
      "Non-volatile storage is not required",
      "Requires sub-millisecond latencies",
      "Dataset is relatively small"
    ]
    primary_destination: MEMORYSTORE_FOR_VALKEY
    migration_complexity: [
      "Heterogeneous migration",
      "Application code conversion required"
    ]
    best_when: "For Aerospike workloads used primarily as a high-speed cache where durable, persistent storage is not a requirement, Memorystore for Valkey is an excellent choice for modernization and cost reduction."
    benefits: [
      "Fully managed experience and reduced risk and TCO",
      "Open-source compatibility with no lock-in",
      "Sub-millisecond read and write latencies",
      "Clustering support for increased scale and throughput with 99.99% SLA"
    ]
  }
}

# MongoDB, Amazon DocumentDB, Azure CosmosDB
source_recommendations {
  source: [MONGODB, AMAZON_DOCUMENTDB, AZURE_COSMOSDB]
  discovery_questions: [
    "What is the size of your DocumentDB deployment?",
    "What is the read/write throughput?"
  ]
  recommendations {
    selection_criteria: [
      "Large instance or large storage requirements",
      "Lower combined costs for storage and I/O",
      "High availability"
    ]
    primary_destination: FIRESTORE
    migration_complexity: [
      "Heterogeneous migration",
      "Application code conversion required"
    ]
    best_when: "For customers with MongoDB workloads, Firestore is the best choice for modernizing your application and eliminating operational overhead. It provides a truly serverless platform that scales elastically to any size, which significantly lowers the total cost of ownership through a pay-for-what-you-use model. This simplicity is backed by enterprise-grade power, including an industry-leading 99.999% SLA and the ability to perform global, multi-document ACID transactions with strong consistency. With deep integration for event-driven architectures, Firestore allows you to build highly scalable and reliable applications without managing servers."
    benefits: [
      "Serverless, elastic capacity with no scaling limits",
      "Lower storage costs and no additional throughput (I/O) fees",
      "Up to 99.999% SLA with automated failure recovery through built-in data replication and zero RPO/zero RTO",
      "Global, ACID-compliant, multi-document transactions with strong consistency",
      "Event triggering support for GKE, Cloud Run and Cloud Functions"
    ]
  }
  recommendations {
    selection_criteria: [
      "Highest scale and availability requirements",
      "Complex query requirements, including indexes and JSON handling, at extreme scale"
    ]
    primary_destination: SPANNER
    migration_complexity: [
      "Higher complexity. Requires heterogeneous migration from NoSQL document model to relational/hybrid model, and application rewrite"
    ]
    best_when: "MongoDB customers with extreme scaling requirements, demanding strong consistency, high availability (up to 99.999% SLA), and complex query capabilities (including JSON support and indexing) that exceed MongoDB's capabilities at scale."
    benefits: [
      "Virtually infinite scale with global consistency",
      "99.999% SLA with no maintenance downtime",
      "Native support for JSON data type and indexing",
      "Strong consistency for multi-region deployments"
    ]
  }
}

# Neo4j, Amazon Neptune, Aerospike Graph
source_recommendations {
  source: [NEO4J, AEROSPIKE_GRAPH, AMAZON_NEPTUNE]
  discovery_questions: [
    "What is the size of your Neo4j/ Neptune deployment?",
    "Are you running into scaling/ performance issues with your existing graph database?",
    "What graph query language are you using?",
    "Are strong consistency reads needed?",
    "Are you looking for a fully managed solution?",
    "What are availability requirements?",
    "Are you looking for FTS and vector search capabilities to augment your Graph use-case?",
    "What is the source of your graph data?"
  ]
  recommendations {
    selection_criteria: [
      "Need fully managed solution that doesn't require downtime for upgrades/maintenance",
      "Want to use a graph query language (e.g. GQL; ISO standard) vs. a proprietary language like Cypher",
      "Need a solution whose QPS scales linearly and is virtually unlimited.",
      "Simpler solution that avoids managing pipelines from relational stores to build a graph",
      "Application leverages advanced database capabilities (indexes, composite keys, typed values, constraints, JSON, views, ACID transactions, SQL)",
      "Need strong and/or eventual consistency options for reads",
      "Need replication with strong consistency guarantees",
      "Need a graph solution without expensive licensing with a pay-as-you-go model."
    ]
    primary_destination: SPANNER_GRAPH
    migration_complexity: [
      "Medium complexity migration. Some work required for schema conversion and data transfer. (WIP utility to migrate data from Neo4j to Spanner Graph). Query conversion is more straightforward.",
      "Neo4j APOCs require work to be translated to GQL"
    ]
    best_when: "Spanner simplifies your data architecture by providing a high-performance, fully managed graph database that operates directly on your existing relational data. This zero-ETL approach eliminates the need to manage separate graph systems, which reduces cost, prevents data duplication, and allows you to run real-time graph analytics on live transactional data."
    benefits: [
      "Leverage a unified, zero-ETL architecture by running graph queries directly on your existing relational data, which eliminates the need for separate databases, complex ETL pipelines, and data duplication.",
      "Achieve massive scale and performance by efficiently querying graphs with hundreds of billions of nodes, with optimizations for high-speed traversal even on highly connected data.",
      "Execute seamless multi-model queries by combining graph analytics with relational (SQL), full-text search, and vector search on a single, unified platform.",
      "Built on an enterprise-grade foundation that includes all of Spanner’s core benefits, such as its industry-leading 99.999% availability, zero-downtime operations, and deep integration with GCP services like IAM and BigQuery."
    ]
  }
}

selection_prompts.md 1.0 KB
You are an expert Database Recommender AI Agent. Your task is to analyze the
user's requirements for a database and provide the top N={num_recommendations}
most suitable Google Cloud database services, unless a different number N is
requested.

You are given a recommendation matrix for deciding the suitable database for the
user.

Explanation of the recommendation matrix columns:

-   Source: The database source the user is coming from.
-   Discovery: The information you need to understand the user's requirements.
-   Selection Criteria: The criteria for providing this recommendation.
-   Primary Destination: The recommended database for the user's requirements.
-   Migration Complexity: The migration complexity from the user's current
    database to the recommended database.
-   Best When: The ideal scenarios or context for choosing the recommended
    database.
-   Benefits: The main benefits of using the recommended database.

Use the following recommendation matrix to provide the recommendations:
{recommendation_matrix}
scripts/
database_onboarding_skill.py 6.4 KB
"""Database Onboarding Skill validation and context utilities.

This module provides helper utilities to validate the skill reference files,
parse discovery questions from the recommendation matrix, and format reference
prompts for the database onboarding skill workflow.
"""

import argparse
import json
import os
import re
import sys


def _read_file_safe(relative_path: str) -> str:
  """Safely reads a reference file with descriptive standard error reporting."""
  current_dir = os.path.dirname(os.path.abspath(__file__))
  skill_root = os.path.dirname(current_dir)
  file_path = os.path.join(skill_root, relative_path)

  try:
    with open(file_path, "r", encoding="utf-8") as f:
      return f.read()
  except FileNotFoundError as e:
    err_msg = (
        f"[ERROR] Critical reference file missing: '{file_path}'.\n"
        "Self-Correction Action: Verify that the skill directory structure is"
        " intact and '{relative_path}' exists under '{skill_root}'.\n"
    )
    sys.stderr.write(err_msg)
    raise FileNotFoundError(err_msg) from e
  except IOError as e:
    err_msg = (
        f"[ERROR] Failed to read reference file '{file_path}': {e}.\n"
        "Self-Correction Action: Check local filesystem read permissions for"
        " the workspace.\n"
    )
    sys.stderr.write(err_msg)
    raise IOError(err_msg) from e


def _parse_discovery_questions(matrix_text: str) -> dict[str, list[str]]:
  """Parses discovery questions from the text proto matrix."""
  blocks = matrix_text.split("source_recommendations {")
  questions_map = {}

  for block in blocks[1:]:
    source_match = re.search(
        r"source:\s*\[?([A-Z0-9_, ]+?)\]?\s*(?:#.*)?\n", block
    )
    if not source_match:
      continue
    sources = [s.strip() for s in source_match.group(1).split(",")]

    dq_match = re.search(r"discovery_questions:\s*\[(.*?)\]", block, re.DOTALL)
    if dq_match:
      questions = re.findall(r'"(.*?)"', dq_match.group(1))
      for s in sources:
        questions_map[s] = questions
  return questions_map


def get_onboarding_system_instruction() -> str:
  """Returns the formatted onboarding discovery instructions."""
  instruction_template = _read_file_safe("references/onboarding_prompts.md")
  try:
    matrix_text = get_recommendation_matrix_context()
    discovery_dict = _parse_discovery_questions(matrix_text)
    discovery_questions_by_source = json.dumps(discovery_dict, indent=2)

    return instruction_template.format(
        resource_creation_agent_name="resource_creation_tool",
        database_selection_agent_name="database_selection_tool",
        discovery_questions_by_source=discovery_questions_by_source,
    )
  except KeyError as e:
    err_msg = (
        "[ERROR] Formatting error in 'references/onboarding_prompts.md':"
        f" Missing expected placeholder or unescaped brace {e}.\n"
        "Self-Correction Action: Ensure all literal curly braces in"
        " 'onboarding_prompts.md' are escaped appropriately or placeholders"
        " match `format(...)` keys.\n"
    )
    sys.stderr.write(err_msg)
    raise KeyError(err_msg) from e


def get_recommendation_matrix_context() -> str:
  """Returns the raw recommendation matrix as structured text format."""
  return _read_file_safe("references/recommendation_matrix.txt")


def get_database_selection_instruction(num_recommendations: int = 1) -> str:
  """Returns the instruction for performing database selection with the embedded matrix."""
  instruction_template = _read_file_safe("references/selection_prompts.md")
  try:
    return instruction_template.format(
        num_recommendations=num_recommendations,
        recommendation_matrix=get_recommendation_matrix_context(),
    )
  except KeyError as e:
    err_msg = (
        "[ERROR] Formatting error in 'references/selection_prompts.md':"
        f" Missing expected placeholder {e}.\n"
        "Self-Correction Action: Verify that `{num_recommendations}` and"
        " `{recommendation_matrix}` exist inside 'selection_prompts.md'.\n"
    )
    sys.stderr.write(err_msg)
    raise KeyError(err_msg) from e


def get_skill_definition() -> dict[str, str | dict[str, str]]:
  """Returns a dictionary representation of the skill components and reference context."""
  return {
      "name": "cloud-databases-onboarding",
      "description": (
          "Guides users through discovering their database requirements, "
          "recommends a GCP database based on a recommendation matrix, and "
          "assists in database creation by analyzing the workspace for "
          "Terraform scripts, validating infrastructure with "
          "Plan-Validate-Execute, and creating a Change List (CL) or Pull "
          "Request for the user."
      ),
      "onboarding_instruction": get_onboarding_system_instruction(),
      "context_data": {
          "recommendation_matrix": get_recommendation_matrix_context(),
      },
      "sub_tasks": {
          "selection_task_instruction": get_database_selection_instruction(),
      },
  }


def main():
  """CLI entrypoint to execute the skill script directly."""
  parser = argparse.ArgumentParser(
      description="Execute Database Onboarding Skill components and validation."
  )
  parser.add_argument(
      "--verify",
      action="store_true",
      help="Verify that all reference files exist and formatting succeeds.",
  )
  parser.add_argument(
      "--onboarding-prompt",
      action="store_true",
      help="Output the onboarding instruction prompts (Phases 1-3).",
  )
  parser.add_argument(
      "--selection-prompt",
      action="store_true",
      help="Output the database selection matrix instruction.",
  )
  parser.add_argument(
      "--definition",
      action="store_true",
      help="Output the JSON definition of the entire skill.",
  )

  args = parser.parse_args()

  try:
    if args.verify:
      get_onboarding_system_instruction()
      get_database_selection_instruction()
      print(
          "[SUCCESS] All database onboarding skill components and reference"
          " templates verified successfully."
      )
      sys.exit(0)
    elif args.onboarding_prompt:
      print(get_onboarding_system_instruction())
    elif args.selection_prompt:
      print(get_database_selection_instruction())
    elif args.definition:
      print(json.dumps(get_skill_definition(), indent=2))
    else:
      parser.print_help()
  except Exception as e:  # pylint: disable=broad-exception-caught
    sys.stderr.write(f"[FATAL] Skill execution failed: {e}\n")
    sys.exit(1)


if __name__ == "__main__":
  main()

License (Apache-2.0)

View full license text
Licensed under the Apache License, Version 2.0. See https://github.com/google/skills/blob/main/LICENSE