Description
On supported RDS for MariaDB, MySQL and PostgreSQL instances, applications can sign in with short-lived IAM tokens.
Potential impact
If several applications store the same database password, you must replace every copy after a leak.
Remediation
Check support for the engine version, instance class and client, then set enable_iam_database_authentication to true. Configure the database user for IAM authentication and grant the application’s IAM principal rds-db:connect for that user.
Examples
The examples change only the setting on test-db. Test that the application can obtain a token and connect over TLS before migrating existing logins.
Before
yaml
- name: Create the RDS instance
amazon.aws.rds_instance:
engine: mariadb
id: test-db
state: present
db_instance_class: "{{ db_instance_class }}"
username: "{{ username }}"
password: "{{ password }}"
allocated_storage: "{{ allocated_storage }}"
enable_iam_database_authentication: false
After
yaml
- name: Create the RDS instance
amazon.aws.rds_instance:
engine: mariadb
id: test-db
state: present
db_instance_class: "{{ db_instance_class }}"
username: "{{ username }}"
password: "{{ password }}"
allocated_storage: "{{ allocated_storage }}"
enable_iam_database_authentication: true