Currently I have an existing Aurora PostgreSQL cluster running in Serverless v2 mode created by terraform.
# AWS Aurora Cluster
resource "aws_rds_cluster" "aurora_cluster" {
tags = var.tags
cluster_identifier = "my-db-${var.environment}"
engine = "aurora-postgresql"
engine_mode = "provisioned"
engine_version = var.engine_version
db_subnet_group_name = aws_db_subnet_group.subnet_group.name
database_name = "my-db"
manage_master_user_password = true
master_username = "postgres"
port = 5432
storage_encrypted = true
vpc_security_group_ids = [aws_security_group.allow_db_connection.id]
apply_immediately = true
skip_final_snapshot = true
availability_zones = var.availability_zones
enabled_cloudwatch_logs_exports = [
"postgresql"
]
backup_retention_period = "7"
serverlessv2_scaling_configuration {
max_capacity = 10.0
min_capacity = 1.0
}
}
# AWS Aurora Instance
resource "aws_rds_cluster_instance" "aurora_instance" {
tags = var.tags
cluster_identifier = "my-db-${var.environment}"
identifier = "my-db-${var.environment}"
instance_class = var.instance_class
availability_zone = var.availability_zone
engine = aws_rds_cluster.aurora_cluster.engine
engine_version = aws_rds_cluster.aurora_cluster.engine_version
db_subnet_group_name = aws_db_subnet_group.subnet_group.name
}
AWS security hub is showing me following issues for it: RDS Database Clusters should use a custom administrator username RDS database instances should use a custom administrator username
I want to change it from "postgres" to custom name for cluster and instance. What should be the steps for it? I dont think we can simply modify the value of existing cluster. Should i create the new one ? take the snapshot of the exiting cluster and restore it ? but then restored snapshot will be new DB cluster i think.
Can someone help me with the process ?
According to AWS documentation you can't:
https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/UsingWithRDS.MasterAccounts.html