Skip to content

Commit d93b748

Browse files
committed
aws rds iam
1 parent ad763a5 commit d93b748

File tree

1 file changed

+58
-1
lines changed

1 file changed

+58
-1
lines changed

docs/advanced/1_self_host/aws_eks_ecs.mdx

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,71 @@ Familiar with Terraform? The terraform files are available [here in Windmill's G
104104
- We advise to use a certificate authority
105105
- The port can be left to the default: `5432`
106106
1. Database authentication
107-
- Windmill uses Password authentication
107+
- Windmill supports both Password authentication and IAM authentication. See [IAM database authentication](#iam-database-authentication) below for details on using IAM auth.
108108
1. Monitoring
109109
- Choose whatever you prefer to monitor your database
110110
1. Additional configuration
111111
- Initial database name should be set to `windmill`
112112
- It is advised to enable automated backups
113113
- Encryption can be set depending on your requirement, same for log export and maintenance.
114114

115+
### IAM database authentication
116+
117+
Windmill Enterprise supports IAM database authentication for RDS, eliminating the need to store database passwords. Windmill uses temporary IAM tokens that are automatically refreshed.
118+
119+
:::info Enterprise feature
120+
IAM RDS authentication is only available in Windmill Enterprise Edition.
121+
:::
122+
123+
#### Prerequisites
124+
125+
1. **Enable IAM authentication on your RDS instance**
126+
- In RDS Console → Your instance → Modify → Enable "IAM database authentication"
127+
128+
2. **Grant the `rds_iam` role to the postgres user**
129+
```sql
130+
GRANT rds_iam TO postgres;
131+
```
132+
This tells RDS to accept IAM tokens for authentication. See [AWS documentation](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.DBAccounts.html).
133+
134+
3. **Add IAM policy for database access**
135+
```json
136+
{
137+
"Effect": "Allow",
138+
"Action": "rds-db:connect",
139+
"Resource": "arn:aws:rds-db:<region>:<account-id>:dbuser:<dbi-resource-id>/postgres"
140+
}
141+
```
142+
The `<dbi-resource-id>` is found in RDS Console → Configuration → Resource ID (starts with `db-`).
143+
144+
#### Configuration
145+
146+
Set the `DATABASE_URL` with `iamrds` as the password:
147+
```
148+
postgresql://postgres:iamrds@<rds-endpoint>:5432/windmill
149+
```
150+
151+
:::warning
152+
The port (`:5432`) is required for IAM authentication.
153+
:::
154+
155+
Set the `AWS_REGION` environment variable:
156+
```yaml
157+
env:
158+
- name: AWS_REGION
159+
value: "eu-west-1"
160+
```
161+
162+
On EKS, configure [IRSA](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html) to provide AWS credentials to the pods.
163+
164+
#### Troubleshooting
165+
166+
| Error | Solution |
167+
|-------|----------|
168+
| `PAM authentication failed` | Check `AWS_REGION` is set and password is exactly `iamrds` |
169+
| No `iamrds mode detected` log | Ensure you're using `windmill-ee` image |
170+
| Token generation fails | Verify IRSA setup and `rds-db:connect` IAM policy |
171+
115172
### Create the ECS cluster
116173

117174
As said in the introduction, the architecture of your stack depends of your needs. The only requires parts are one Windmill server at least one multi-purpose worker.

0 commit comments

Comments
 (0)