That mistake should never have been possible.
AWS database access security in Kubernetes is a tightrope. You balance database credentials, Kubernetes RBAC, IAM roles, and network policies while production waits for no one. Get it wrong, and the blast radius is measured in data loss, downtime, or leaked customer records. Get it right, and you have guardrails that make security the default instead of the afterthought.
The first guardrail is clear separation between AWS IAM permissions and Kubernetes RBAC. Never let a pod inherit wildcard IAM privileges. Bind service accounts to the exact AWS role needed for one job and nothing more. Use IRSA (IAM Roles for Service Accounts) to map these identities directly without leaking long-lived keys.
The second guardrail is RBAC minimization. Most clusters start with overpowered default roles that grant broad get, list, or exec rights across namespaces. Remove them. Define namespace-scoped roles that align with the principle of least privilege. Audit them weekly.
The third guardrail is database-side enforcement. AWS RDS or Aurora knows nothing about your Kubernetes RBAC. This means even if your pods can reach the database, credentials still define what happens inside. Create database accounts per application. Limit each to the queries it truly needs. Rotate passwords, or better yet, use AWS Secrets Manager with rotation. Grant no single identity both schema modification and data access unless absolutely required.