How a migration works
You move one topic at a time, or a wave of topics. While a topic moves, lowtide mirrors it back to Pub/Sub: every message published to lowtide is also published to the Pub/Sub topic of the same name. Subscriptions still on Pub/Sub keep receiving everything, and you move them one at a time.
before during afterpublishers ──▶ Pub/Sub publishers ──▶ lowtide ──mirror──▶ Pub/Sub publishers ──▶ lowtide │ │ │ │ consumers moved consumers consumers not moved yet consumersNothing is lost at any step, some messages arrive twice at a hand-over, and every step can be undone until a subscription is detached in Pub/Sub.
What can move
Section titled “What can move”Run the assessment first. It sorts every topic of a project into one of three groups:
| Group | Meaning |
|---|---|
| Ready | lowtide supports everything the topic and its subscriptions use. |
| Stays on Pub/Sub | Google services publish to the topic: Cloud Storage notifications, log sinks, Cloud Scheduler, Eventarc, Cloud Build and others. They can’t publish to another endpoint, so the topic stays on Pub/Sub. |
| Blocked | The topic or a subscription uses a feature lowtide doesn’t support yet: schemas, exactly-once delivery, single-message transforms or Bigtable subscriptions. |
The steps for one topic
Section titled “The steps for one topic”| Step | What happens | Undo |
|---|---|---|
| 1. Create resources | The topic, its subscriptions and their dead-letter topics are created in lowtide with the same names and settings. Push, BigQuery and Cloud Storage subscriptions start as pull subscriptions, so nothing is delivered twice. | Delete them again in lowtide. |
| 2. Mirror on | lowtide starts copying every message published to the lowtide topic to the Pub/Sub topic. | Turn the mirror off. Nothing is published to lowtide yet. |
| 3. Move the publishers | You switch publishers to lowtide’s endpoint, one deployment at a time, and record when the last one moved. Pub/Sub subscriptions still get every message through the mirror. | Move publishers back to Pub/Sub. |
| 4. Hand over each subscription | The lowtide subscription starts where the Pub/Sub subscription stands. You start its consumers on lowtide and stop them on Pub/Sub. | Move the consumers back; Pub/Sub kept every message. |
| 5. Finish each subscription | Once lowtide’s consumers keep up, the Pub/Sub subscription is detached, so Pub/Sub stops delivering and charging for it. | Not reversible. A rollback needs a new Pub/Sub subscription. |
| 6. Mirror off | When no subscription is left attached in Pub/Sub, mirroring stops. | Turn it on again. |
Hand over subscriptions explains steps 4 and 5. Roll back, costs and failures covers what can go wrong.
Two ways to run it
Section titled “Two ways to run it”- From the console (recommended). The Migration page runs each step through the cluster’s agent, checks that the next step is safe, shows live rates and backlogs, and records everything in the audit log. See Migrate from the console.
- From your shell with
lowtide-migrate, gcloud or Terraform. See the CLI reference.
Both run the same steps and can be mixed for different topics.
Before you start
Section titled “Before you start”- A cluster with Cloud IAM authorization. With it on, the original Pub/Sub resources become the shadows that hold IAM policies, so your bindings keep applying unchanged (Cloud IAM and shadows).
- Services read the endpoint from configuration. Then moving a publisher or consumer, and moving it back, is a configuration change (Client libraries).
- Access for the mirror and the steps. The gateway needs Pub/Sub Publisher in each project you move topics from. For console-driven steps, the agent needs its migration role there (Permissions).
- The mirror’s region. Set
config.mirror.pubsubRegionto the cluster’s region, so ordered messages keep their order in Pub/Sub (Mirroring).
After the last topic
Section titled “After the last topic”- Compare lowtide’s publish counts with your publishers’ own metrics.
- Alert on any publish to the original Pub/Sub topics, to catch a publisher that was missed.
- Keep the Pub/Sub topics and the detached subscriptions. With Cloud IAM authorization, they hold the IAM policies lowtide checks, so keep them for as long as the cluster serves those names.
- Remove the gateway’s Pub/Sub Publisher grant and the agent’s migration role (
pubsub_mirror_projectsandpubsub_migration_projectsin the module).