The Simplest Way to Make Dynamodb and Google Pub/Sub Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair dynamodb and google pub/sub to stream table changes across cloud accounts in real time. This workflow sends item updates from AWS tables straight to Google Cloud message topics. Many groups store core app state in AWS tables. They also run data tools on Google Cloud. Linking these two systems lets apps react to database events right away. You do not need slow batch jobs to move your data. Instead, a worker reads the table stream and pushes messages to a topic. How dynamodb and goog

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Teams pair dynamodb and google pub/sub to stream table changes across cloud accounts in real time. This workflow sends item updates from AWS tables straight to Google Cloud message topics.

Many groups store core app state in AWS tables. They also run data tools on Google Cloud. Linking these two systems lets apps react to database events right away. You do not need slow batch jobs to move your data. Instead, a worker reads the table stream and pushes messages to a topic.

How dynamodb and google pub/sub share data and roles

Data moves between these two clouds through an event stream and a worker function. First, you turn on change streams for your DynamoDB table. Every write or delete adds a new record to that stream. Next, an AWS compute worker reads those fresh stream records in order.

The worker then needs to log in to Google Cloud without static keys. Workload identity federation lets the AWS role trade its token for a Google token. This setup avoids storing long-lived JSON key files inside your AWS account. Once logged in, the worker sends the event payload to your Google Pub/Sub topic.

Permissions on both sides must stay tight for this pipeline to work well. The AWS role only needs permission to read the table stream. The Google Cloud service account only needs permission to publish to one topic. Downstream apps then read from a topic subscription at their own pace.

Common failure modes and how to scope roles

Cross-cloud pipelines often fail when teams use shared accounts or wide permissions. A single shared service account makes it hard to track who sent bad data. If an engineer uses that same account to test, audit logs get messy. Broad tokens also create big risks if a worker script leaks its credentials.

Unlogged reads and writes cause another major problem during outages or audits. When a script reads a DynamoDB table directly, you might miss who ran the query. Sensitive fields like emails, phone numbers, or card numbers can also spill into message topics. If you do not filter payloads, raw user data lands in every downstream log.

DynamoDB Fine-Grained Access + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

You can fix these issues by scoping roles to single tasks and clear network paths. Give each worker its own IAM role in AWS and its own Google account. Block wildcards in your policy rules so a worker can touch only one resource. Keep human engineers out of production service accounts during daily debug sessions.

Keeping human debug sessions safe and audited

Even automated pipelines need human checks when messages get stuck or dropped. Engineers often need to inspect a DynamoDB item or check a dead-letter topic. Giving every developer standing permissions to both clouds creates too much risk. Instead, tie every human session to your central identity provider.

Set up rules that require peer approval before someone runs a production check. Data masking can also rewrite matched fields like national IDs or emails in query results. This approach keeps debug work fast while protecting private user records across both clouds. Clear logs of every query and topic check help your security team sleep well.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

How do we avoid storing Google Cloud keys in AWS?

Use workload identity federation between your AWS account and Google Cloud. Your AWS worker exchanges its local role token for a short-lived Google token at runtime.

How can we keep message order from DynamoDB streams?

Use the item partition key as the ordering key when you publish to the topic. Google Pub/Sub will then deliver messages for that key in the exact order received.

What happens if Google Pub/Sub rejects a message batch?

Configure your AWS stream worker to retry failed sends and route bad records to a dead-letter queue. Your team can then inspect the failed payload and replay it later.

The query runs. The emails stay hidden.