The Simplest Way to Make AWS RDS and Gitlab Work Like They Should
You pair aws rds and gitlab to run database schema changes from your build pipelines. GitLab runners log in to your AWS database to test code and apply updates. This workflow keeps database changes in version control right next to your app code. Every merge request can test schema updates before those changes reach your live database. Teams avoid manual SQL work and ship code faster with fewer mistakes. How aws rds and gitlab pass keys and data A GitLab runner needs two things to reach an AW
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 pair aws rds and gitlab to run database schema changes from your build pipelines. GitLab runners log in to your AWS database to test code and apply updates.
This workflow keeps database changes in version control right next to your app code. Every merge request can test schema updates before those changes reach your live database. Teams avoid manual SQL work and ship code faster with fewer mistakes.
How aws rds and gitlab pass keys and data
A GitLab runner needs two things to reach an AWS RDS instance. First, it needs a clear network path to the database port. Second, it needs a valid key or password to log in.
In a standard setup, the runner sits inside the same virtual network as the database. You set up security groups on AWS to let the runner IP talk to RDS. This stops public traffic from hitting your database port.
For login keys, many teams move away from static passwords stored in GitLab variables. Instead, GitLab issues an open identity token during a pipeline job. AWS checks this token and trades it for a temporary cloud role. The runner then uses that role to ask RDS for a short-lived database token. Once the database checks the token, the runner sends SQL commands and reads the output.
Common failure modes and how to scope access
The biggest risk in this setup is a shared admin account. Teams often put one master database password into a group variable in GitLab. Every pipeline and every developer with project access can then use that master password. If a bad script runs in a build, it can drop tables or steal data.
Another common issue is a lack of clear audit logs. When ten pipelines share one database user, RDS logs show the same username for all queries. You cannot tell which GitLab job or developer ran a slow or broken query. Also, test jobs might pull real customer emails or card numbers into build logs.
AWS IAM Policies + GitLab CI Security: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
To fix this, split your database roles by job type. Give build pipelines a role that can only change tables in a staging database. Give read-only check jobs a role that can only read table names and status. Never let a standard branch pipeline touch your production database.
Lock down your network paths just as tight. Put your runners in a private subnet and block all outside traffic. Use data masking to rewrite emails, phone numbers, and national IDs in query results. This keeps sensitive data out of your GitLab job logs while tests run.
Managing manual database tasks from pipelines
Automated scripts handle most schema changes well. Still, teams still need to run one-off data fixes or check live rows during an outage. Running these manual queries through a standard GitLab job is slow and risky.
Instead of pasting raw SQL into a pipeline script, treat manual queries as a separate flow. Require a peer review step before any live query runs against RDS. Log the exact user identity next to every SQL command for your security audits. This gives engineers fast ways to fix bugs while keeping your data safe.
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 I store my RDS password in GitLab variables?
Static passwords in GitLab variables are hard to rotate and easy to leak in logs. Use short-lived tokens tied to a cloud role instead of long-term passwords.
How can a cloud GitLab runner reach a private RDS database?
You can place a self-hosted GitLab runner inside your private AWS network. That runner can talk to RDS over local network routes without opening public ports.
How do I stop test pipelines from exposing customer data?
Use distinct database roles for testing and apply data masking to your query results. Masking rewrites emails, card numbers, and phone numbers before they hit your GitLab logs.
Related guides
In this post