How to Configure Dynamodb Replication User

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up a dynamodb replication user by building an identity role with stream read permissions. This role also needs write permissions on the destination table to copy item changes. Many teams start by assigning broad admin roles to get data moving fast. Broad roles create big risks if a worker script fails or someone steals a key. A bad script can wipe out production tables when it has too many permissions. How a dynamodb replication user works in practice Data copying relies on change str

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.

You set up a dynamodb replication user by building an identity role with stream read permissions. This role also needs write permissions on the destination table to copy item changes. Many teams start by assigning broad admin roles to get data moving fast. Broad roles create big risks if a worker script fails or someone steals a key. A bad script can wipe out production tables when it has too many permissions.

How a dynamodb replication user works in practice

Data copying relies on change streams and an active identity role. When an app updates a source table, the database writes that event to a stream. A worker service assumes the dynamodb replication user role to read those stream records. The worker then writes the exact same changes to a second table in another region. If you use native global tables, the cloud provider handles this role behind the scenes. If you run custom sync jobs across accounts, you must build this role yourself.

To keep the setup safe, teams scope permissions down to exact table names. The role should only read stream records from the source table. It should only write, update, or delete items in the destination table. If the tables use encryption keys, the role also needs permissions to use those keys. The source key needs decrypt rights, and the destination key needs encrypt rights. This setup keeps the sync job from touching other tables in your cloud account.

Why static replication roles leave security gaps

Native roles decide who can log in, not what individual requests do in flight. Once a worker or engineer assumes the role, every allowed action runs without extra checks. A bug in a sync script can trigger thousands of bad deletes in seconds. Native cloud roles cannot inspect the payload of a write request before it hits storage.

This gap grows worse when engineers use the same role to fix broken sync jobs. During an outage, a team member might assume the replication role to patch missing items. If they run a bad command, the database accepts it because the role allows writes. In shared data workflows, sensitive fields like emails or phone numbers also move without filters. Data masking rewrites matched fields in results, such as card numbers or national IDs. Native cloud permissions cannot mask these fields on the fly during a live session.

User Provisioning (SCIM) + DynamoDB Fine-Grained Access: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Managing human sessions alongside automated sync jobs

Separating machine roles from human fixing sessions reduces the chance of accidental data loss. Automated workers should use scoped roles that humans never touch directly. When an engineer needs to inspect a stream or fix a record, they need guardrails. Teams should log every query and check write commands before they run against production data.

Reviewing individual actions in flight stops bad deletes before they break downstream tables. It also gives audit teams a clear record of who changed what during an incident. Instead of relying only on broad cloud roles, teams gain control over every single request.

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 sits inline in the wire protocol beside those services as an open-source proxy, a sidecar for your Postgres or API. On every query an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run, and hoop.dev data masking rewrites matched sensitive values in responses 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

Do native global tables need a manual replication role?

No, native global tables use a service-linked role managed by the cloud provider. You only build a custom role for cross-account syncs or custom stream workers.

What permissions does a custom stream worker need?

The role needs permissions to describe and read the source stream records. It also needs permissions to put, update, and delete items in the destination table.

Why did my cross-account sync job fail with an encryption error?

Encrypted tables require explicit permissions on the encryption keys in both accounts. The replication role needs decrypt rights on the source key and encrypt rights on the destination.

The query runs. The emails stay hidden.