Learn

How to mask a PostgreSQL database on Amazon RDS

Amazon RDS for PostgreSQL has no built-in way to make a masked copy of a database. You can write a script, build a pipeline with AWS Glue or AWS DMS, or use a tool that restores a snapshot, masks it and shares the masked copy with your dev and test accounts. Aurora PostgreSQL also has dynamic masking, which hides values from some readers and leaves them unchanged in storage.

From the latest snapshot to a masked copy

Source account (production)

  1. Snapshot

    The latest snapshot is copied.

  2. Check schema

    The run stops if there are new columns.

  3. Mask

    Washery applies the policy you approved.

  4. Verify

    The run stops if the check finds sensitive data.

Destination account (dev or test)

Masked copy

A snapshot, a database or backup files in your dev or test account.

What does PostgreSQL on Amazon RDS give you for masking?

OptionWhat it doesWhere it stops
PostgreSQL AnonymizerAn extension that masks data with rules you declare in the database.It is not in the list of extensions Amazon RDS supports for PostgreSQL 16, 17 or 18.
Dynamic masking in Aurora PostgreSQLThe pg_columnmask extension changes what a reader sees when they query a column, based on their role.The stored data does not change, so there is still no copy that developers can work on. It needs Aurora PostgreSQL 16.10 or 17.6 and later.
A scriptYou restore a snapshot and run UPDATE statements on the copy.You write a statement for every column and keep the script up to date.
AWS GlueA job reads the source database over JDBC and replaces sensitive values with ****. AWS showed it on Amazon RDS for PostgreSQL 13.You set up three accounts, VPC peering, connections, crawlers and the job, and the destination tables must already exist.
AWS DMSA replication task replaces digits, or replaces a value with a 64-character hash.Names and email addresses can only be hashed, and DMS creates tables and primary keys only.

What does a masking script have to get right in PostgreSQL?

WhatWhy it matters
Foreign keysThe same value has to become the same masked value in every table, or the joins stop matching.
Unique indexesTwo different values have to become two different masked values. An update can also fail part way when a new value matches an old value that has not been replaced yet.
StoragePostgreSQL keeps the old version of every row it updates until a vacuum removes it, so a table can need about twice its size while it is masked.
New columnsA column added after the script was written has no statement, so it is copied to dev unmasked.
Check digitsA card number or a tax ID with random digits fails validation in the application.

We know from years of running a script like this that it costs time, goes wrong, and is forgotten when the person who wrote it leaves.

How Washery does it

Washery masks PostgreSQL on Amazon RDS and Aurora PostgreSQL. Washery uses snapshots only. Running Washery does not impact your live database.

Washery writes the masking policy and you approve it. Washery sees column names and counts, never values.

The masking policy Washery proposed for a customers table, with a masking method chosen for the name, email, phone and date of birth columns
Washery found the sensitive data in each column and proposed a masking method for it.

Every run checks the schema first. If the database has a column the policy does not cover, the run stops until you approve a new policy.

Keys and check digits are handled for you. The same value becomes the same masked value in every table, unique columns stay unique, and card numbers and tax IDs keep a valid check digit.

Keeping developers out of production. For PostgreSQL the backup files are SQL files you load with psql. Runs can be scheduled, or started and followed through the API.

In our tests a 1 GB PostgreSQL database was masked and delivered as a shared snapshot in 39m 59s, and the run used $0.20 in AWS. Tested on 21 and 22 November 2026 on Amazon RDS, db.m5.large. Costs are what each run used in AWS, at US East (N. Virginia) list prices. See the full test report.

When is this not the right approach?

  • You only need to hide some columns from some people who read the live database. Dynamic masking in Aurora PostgreSQL does that.
  • You need every change replicated to dev continuously. AWS DMS does that and Washery does not.

Sources, checked 2 December 2026: extension versions for Amazon RDS for PostgreSQL, dynamic masking with Aurora PostgreSQL, copy and mask PII between Amazon RDS databases with AWS Glue, data masking in AWS DMS and the database objects AWS DMS migrates, all from AWS.

Related

Mask your first database today

Connect your account, review what Washery will mask, and pay only when you create the masked copy.

Want to talk it through first? Book a 20-minute demo.

Mask your first database