IAM database authentication is not enabled for an RDS cluster

Manage connection permissions with IAM token authentication on supported database clusters.

Description

On supported Aurora clusters, applications can sign in with IAM tokens. Database users that do not use IAM continue with their configured authentication methods.

Potential impact

Long-lived passwords stored by multiple applications can leak or be missed during rotation.

Remediation

Check support for the engine, version, Region and instance class, then set iam_database_authentication_enabled = true. Configure the database user for IAM and grant the application rds-db:connect for that user. Limit data privileges in the database. Depending on the engine, a user switched to IAM may lose password login, so test the application’s token-based TLS connection.

Examples

Check the sample Aurora MySQL version and Availability Zones, and configure the DB instances and network separately. Supply db_password securely and restrict access to the Terraform state that stores it.

Before

hcl
resource "aws_rds_cluster" "example" {
  cluster_identifier = "example-cluster"

  engine         = "aurora-mysql"
  engine_version = "8.0.mysql_aurora.3.05.2"

  master_username = "username"
  master_password = var.db_password

  iam_database_authentication_enabled = false

  availability_zones = ["us-east-1a", "us-east-1b", "us-east-1c"]

  skip_final_snapshot = true
}

After

hcl
resource "aws_rds_cluster" "example" {
  cluster_identifier = "example-cluster"

  engine         = "aurora-mysql"
  engine_version = "8.0.mysql_aurora.3.05.2"

  master_username = "username"
  master_password = var.db_password

  iam_database_authentication_enabled = true

  availability_zones = ["us-east-1a", "us-east-1b", "us-east-1c"]

  skip_final_snapshot = true
}

References