Menu

1 / 2

Passwordless Authentication to Aurora PostgreSQL from EKS pods with IRSA and Terraform

DEV Community: terraform·Ajinkya·about 20 hours ago
#qk6MRXMx
#devtoterraform#devto#dev#user#fullscreen
Reading 0:00
15s threshold

Stop storing database passwords in secrets

A database password in a Kubernetes Secret has to be created, synced, rotated and kept out of Git. Every one of those steps is a place for it to leak.

With IAM database authentication and IRSA (IAM Roles for Service Accounts) , there is no password to store. The pod proves its identity to AWS, gets a short-lived token, and uses that token as the Postgres password.

This post wires it up with Terraform on Aurora PostgreSQL 17 and EKS.

How it works

Pod (ServiceAccount backend-sa) │ 1. projected OIDC token ▼ AWS STS verifies the token against the EKS OIDC provider │ 2. temporary credentials for the IAM role ▼ Pod calls rds:GenerateDBAuthToken → token valid for 15 minutes │ 3.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.