Use encryption, data masking, row-level security, and deletion routines in Amazon Redshift to meet GDPR requirements.
GDPR requires that personal data stored in Amazon Redshift be encrypted, access-controlled, auditable, and erasable on request. Redshift offers cluster-level encryption, column- and row-level security, data masking, and audit logging to meet these duties.
Create or modify the cluster with AWS KMS encryption turned on. All tables, system metadata, and snapshots become encrypted automatically. Verify with SELECT encrypted FROM stl_encrypted;
.
Use CREATE MASKING POLICY
to hide sensitive values from unauthorized roles while keeping them selectable for privileged roles.
CREATE MASKING POLICY mask_email (text)
RETURNS text
USING ('xxxxx@redacted.com');
ALTER TABLE Customers
ALTER COLUMN email
ADD MASKING POLICY mask_email
FOR PUBLIC; -- all non-privileged users
Row-level security (RLS) ensures users only see rows they are allowed to process, fulfilling GDPR’s purpose-limitation rule.
CREATE SECURITY POLICY eu_customer_only
USING (country = 'EU');
ALTER TABLE Customers ENABLE ROW LEVEL SECURITY;
ALTER TABLE Customers ATTACH SECURITY POLICY eu_customer_only;
Build a delete procedure that removes customer data from all related tables and logs the request for audit.
BEGIN;
DELETE FROM OrderItems USING Orders
WHERE Orders.id = OrderItems.order_id
AND Orders.customer_id = :cust_id;
DELETE FROM Orders WHERE customer_id = :cust_id;
DELETE FROM Customers WHERE id = :cust_id;
COMMIT;
ENCRYPTED
for secure exports.Minimal. AWS encrypts data blocks in hardware, so query latency changes are usually under 5%.
Yes. Enable system logging and query stl_
tables to see which user attempted to access masked columns.
Authorized roles can still query the raw column. Non-privileged users only receive the masked value defined in the policy.