The Simplest Way to Make AWS RDS and Mercurial Work Like They Should
Teams pair aws rds and mercurial to track database changes alongside app code. Mercurial stores migration files while AWS RDS runs those updates on your cloud database. This setup keeps schema updates and code changes in lockstep across every build. When a developer pushes a commit, a worker runner applies the database changes. How aws rds and mercurial handle identity and data flow Mercurial holds the history of every schema script and seed file in your repo. Developers commit SQL files to
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 aws rds and mercurial to track database changes alongside app code. Mercurial stores migration files while AWS RDS runs those updates on your cloud database.
This setup keeps schema updates and code changes in lockstep across every build. When a developer pushes a commit, a worker runner applies the database changes.
How aws rds and mercurial handle identity and data flow
Mercurial holds the history of every schema script and seed file in your repo. Developers commit SQL files to a branch and push them to a central server.
A build runner watches the Mercurial repo for new commits or tags. When it sees a change, the runner pulls the latest SQL scripts down.
Next, the runner logs in to the AWS RDS instance to run those scripts. You can set up AWS RDS to check identity with cloud IAM roles.
Standard database passwords also work, though cloud roles reduce secret sprawl in your runner. The database checks the role permissions before it lets the runner write tables.
Data flows one way from the Mercurial repo into the cloud database engine. Your repo never stores live customer rows, such as emails or card numbers.
Instead, the repo only holds table definitions, index rules, and small test fixtures. AWS RDS records the schema change and updates the live storage volumes.
Common failure modes and how to scope roles
Many teams fail by putting a master database password inside the Mercurial build runner. If someone leaks that secret, an attacker can drop every table in production.
Shared database accounts also ruin your audit logs during a security review. When five runners share one login, you cannot tell which job broke a table.
AWS IAM Policies + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Another common mistake is leaving the AWS RDS network port open to the public. Build runners and developer laptops should only reach the database over private network routes.
You can fix these risks by scoping roles for each task and user. Give your Mercurial build runner a dedicated role that only runs schema changes.
Create separate read roles for engineers who need to check live data during bugs. Turn on query logging in AWS RDS so you have a record of changes.
When engineers query production tables, data masking rewrites matched fields in results. Masking turns emails, phone numbers, and national IDs into safe placeholder text during queries.
Keeping schema history and database state in sync
Even with good roles, manual database edits can break your Mercurial migration flow. If an engineer alters a column by hand, the next repo push might fail.
To prevent drift, use a migration table inside AWS RDS to track versions. Each row in that table matches a revision hash from your Mercurial repo.
Before running a script, the build runner checks which hashes are already in place. It skips old files and only runs the new scripts from the latest push.
Keep your migration scripts small so they do not lock tables for long periods. Test every Mercurial branch against a staging database before you run it on production.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
Should we store database credentials inside a Mercurial repository?
No, never commit passwords or keys to your repo history. Store secrets in a cloud secret manager and pass them to the build runner.
How do we roll back a bad schema change from Mercurial?
Write a reverse SQL script and commit it as a new Mercurial revision. Pushing a new fix forward is safer than deleting history on a live database.
Can developers run ad-hoc queries on AWS RDS without breaking migrations?
Yes, if you assign read-only roles to developer accounts for daily checks. Only allow schema edits through your tracked workflow or approved emergency access sessions.
Related guides
In this post