Closed18

TerraformでAurora MySQL 5.7 から 8.0 へ in-place upgrade してみる

木村明仁木村明仁

概要

タイトルの通り

この手順を使用してみる
https://learn.hashicorp.com/tutorials/terraform/rds-upgrade?in=terraform/aws#update-configuration

初期の状態

engine: Aurora MySQL 5.7
instance class: db.t4g.medium

resource "aws_rds_cluster_parameter_group" "rds" {
  family      = "aurora-mysql5.7"
  name_prefix = "pg-${var.name_suffix}"
  tags = {
    Name = "pg-${var.name_suffix}"
  }
}

resource "aws_db_parameter_group" "rds" {
  family      = "aurora-mysql5.7"
  name_prefix = "pg-${var.name_suffix}"
  tags = {
    Name = "pg-${var.name_suffix}"
  }
}

resource "aws_rds_cluster" "rds" {
  cluster_identifier               = "rds-${var.name_suffix}"
  backtrack_window                 = 0
  backup_retention_period          = 2
  copy_tags_to_snapshot            = true
  database_name                    = "sample"
  db_cluster_parameter_group_name  = aws_rds_cluster_parameter_group.rds.name
  db_instance_parameter_group_name = aws_db_parameter_group.rds.name
  db_subnet_group_name             = aws_db_subnet_group.rds.name
  deletion_protection              = false
  engine                           = "aurora-mysql"
  master_username                  = "admin"
  master_password                  = random_password.password.result
  port                             = 3306
  preferred_backup_window          = "17:10-17:40"
  preferred_maintenance_window     = "sun:19:03-sun:19:33"
  storage_encrypted                = true
  vpc_security_group_ids           = [aws_security_group.rds.id]
  skip_final_snapshot              = var.skip_final_snapshot
  apply_immediately                = var.apply_immediately
  enabled_cloudwatch_logs_exports  = ["error", "slowquery"]
  kms_key_id                       = aws_kms_key.rds.arn

  tags = {
    Name = "rds-${var.name_suffix}"
  }

  depends_on = [
    aws_cloudwatch_log_group.rds_error,
    aws_cloudwatch_log_group.rds_slowquery
  ]
}

resource "aws_rds_cluster_instance" "rds_instances" {
  count                           = 2
  cluster_identifier              = aws_rds_cluster.rds.id
  identifier                      = "rds-${count.index}"
  instance_class                  = var.instance_class # -> db.t4g.medium
  engine                          = aws_rds_cluster.rds.engine
  engine_version                  = aws_rds_cluster.rds.engine_version
  performance_insights_enabled    = true
  performance_insights_kms_key_id = aws_kms_key.rds.arn
}
木村明仁木村明仁

RDS クラスターパラメータグループとDBパラメータグループ,RDS クラスタ,インスタンスのエンジンバージョンを8.0に変更する

resource "aws_rds_cluster_parameter_group" "rds" {
  family      = "aurora-mysql8.0" # 変更
  name_prefix = "pg-${var.name_suffix}"
  tags = {
    Name = "pg-${var.name_suffix}"
  }
  # ---------- 追加 ここから----------
  lifecycle {
    create_before_destroy = true
  }
  # ---------- 追加 ここまで----------
}

resource "aws_db_parameter_group" "rds" {
  family      = "aurora-mysql8.0" # 変更
  name_prefix = "pg-${var.name_suffix}"
  tags = {
    Name = "pg-${var.name_suffix}"
  }
  # ---------- 追加 ここから----------
  lifecycle {
    create_before_destroy = true
  }
  # ---------- 追加 ここまで----------
}

resource "aws_rds_cluster" "rds" {
  cluster_identifier               = "rds-${var.name_suffix}"
  backtrack_window                 = 0
  backup_retention_period          = 2
  copy_tags_to_snapshot            = true
  database_name                    = "sample"
  db_cluster_parameter_group_name  = aws_rds_cluster_parameter_group.rds.name
  db_instance_parameter_group_name = aws_db_parameter_group.rds.name
  db_subnet_group_name             = aws_db_subnet_group.rds.name
  deletion_protection              = false
  engine                           = "aurora-mysql"
  # ---------- 追加 ここから----------
  engine_version                   = "8.0.mysql_aurora.3.02.0"
  allow_major_version_upgrade      = true
  # ---------- 追加 ここまで----------
  master_username                  = "admin"
  master_password                  = random_password.password.result
  port                             = 3306
  preferred_backup_window          = "17:10-17:40"
  preferred_maintenance_window     = "sun:19:03-sun:19:33"
  storage_encrypted                = true
  vpc_security_group_ids           = [aws_security_group.rds.id]
  skip_final_snapshot              = var.skip_final_snapshot
  apply_immediately                = var.apply_immediately
  enabled_cloudwatch_logs_exports  = ["error", "slowquery"]
  kms_key_id                       = aws_kms_key.rds.arn

  tags = {
    Name = "rds-${var.name_suffix}"
  }

  depends_on = [
    aws_cloudwatch_log_group.rds_error,
    aws_cloudwatch_log_group.rds_slowquery
  ]
}

resource "aws_rds_cluster_instance" "rds_instances" {
  count                           = 2
  cluster_identifier              = aws_rds_cluster.rds.id
  identifier                      = "rds-${count.index}"
  instance_class                  = var.instance_class
  engine                          = aws_rds_cluster.rds.engine
  engine_version                  = aws_rds_cluster.rds.engine_version
  performance_insights_enabled    = true
  performance_insights_kms_key_id = aws_kms_key.rds.arn
}

木村明仁木村明仁

terraform apply 結果

エラーメッセージが出る

内容

Error: updating RDS Cluster (rds-first-fargate-dev): InvalidDBInstanceState: Cannot modify engine version because instance rds-1 has Performance Insights enabled and the new version doesn't support this feature.

  • Performance Insight が有効
    かつ
  • 新バージョンは Performance Insightsをサポートしない
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place
+/- create replacement and then destroy

Terraform will perform the following actions:

  # module.database.aws_db_parameter_group.rds must be replaced
+/- resource "aws_db_parameter_group" "rds" {
      ~ arn         = "arn:aws:rds:ap-northeast-1:470926947163:pg:pg-first-fargate-dev20220929045402116200000001" -> (known after apply)
      ~ family      = "aurora-mysql5.7" -> "aurora-mysql8.0" # forces replacement
      ~ id          = "pg-first-fargate-dev20220929045402116200000001" -> (known after apply)
      ~ name        = "pg-first-fargate-dev20220929045402116200000001" -> (known after apply)
        tags        = {
            "Name" = "pg-first-fargate-dev"
        }
        # (3 unchanged attributes hidden)
    }

  # module.database.aws_rds_cluster.rds will be updated in-place
  ~ resource "aws_rds_cluster" "rds" {
      ~ allow_major_version_upgrade         = false -> true
      ~ db_cluster_parameter_group_name     = "pg-first-fargate-dev20220929045402116600000002" -> (known after apply)
      ~ db_instance_parameter_group_name    = "pg-first-fargate-dev20220929045402116200000001" -> (known after apply)
      ~ engine_version                      = "5.7.mysql_aurora.2.10.2" -> "8.0.mysql_aurora.3.02.0"
        id                                  = "rds-first-fargate-dev"
        tags                                = {
            "Name" = "rds-first-fargate-dev"
        }
        # (40 unchanged attributes hidden)
    }

  # module.database.aws_rds_cluster_instance.rds_instances[0] will be updated in-place
  ~ resource "aws_rds_cluster_instance" "rds_instances" {
      ~ engine_version                        = "5.7.mysql_aurora.2.10.2" -> "8.0.mysql_aurora.3.02.0"
        id                                    = "rds-0"
        tags                                  = {}
        # (28 unchanged attributes hidden)
    }

  # module.database.aws_rds_cluster_instance.rds_instances[1] will be updated in-place
  ~ resource "aws_rds_cluster_instance" "rds_instances" {
      ~ engine_version                        = "5.7.mysql_aurora.2.10.2" -> "8.0.mysql_aurora.3.02.0"
        id                                    = "rds-1"
        tags                                  = {}
        # (28 unchanged attributes hidden)
    }

  # module.database.aws_rds_cluster_parameter_group.rds must be replaced
+/- resource "aws_rds_cluster_parameter_group" "rds" {
      ~ arn         = "arn:aws:rds:ap-northeast-1:470926947163:cluster-pg:pg-first-fargate-dev20220929045402116600000002" -> (known after apply)
      ~ family      = "aurora-mysql5.7" -> "aurora-mysql8.0" # forces replacement
      ~ id          = "pg-first-fargate-dev20220929045402116600000002" -> (known after apply)
      ~ name        = "pg-first-fargate-dev20220929045402116600000002" -> (known after apply)
        tags        = {
            "Name" = "pg-first-fargate-dev"
        }
        # (3 unchanged attributes hidden)
    }

Plan: 2 to add, 3 to change, 2 to destroy.
module.database.aws_rds_cluster_parameter_group.rds: Creating...
module.database.aws_db_parameter_group.rds: Creating...
module.database.aws_db_parameter_group.rds: Creation complete after 1s [id=pg-first-fargate-dev20220929045653953000000001]
module.database.aws_rds_cluster_parameter_group.rds: Creation complete after 1s [id=pg-first-fargate-dev20220929045653953600000002]
module.database.aws_rds_cluster.rds: Modifying... [id=rds-first-fargate-dev]
╷
│ Error: updating RDS Cluster (rds-first-fargate-dev): InvalidDBInstanceState: Cannot modify engine version because instance rds-1 has Performance Insights enabled and the new version doesn't support this feature.
│       status code: 400, request id: 5cc4aa74-87a8-4332-a59a-7441d431eddc
│ 
│   with module.database.aws_rds_cluster.rds,
│   on ../../modules/database/main.tf line 82, in resource "aws_rds_cluster" "rds":
│   82: resource "aws_rds_cluster" "rds" {
│ 
木村明仁木村明仁

サポートはされていそう

Amazon Aurora MySQL 互換エディション

Parallel Query が有効でない場合にサポートされるエンジンバージョン

Performance Insights は、次のエンジンバージョンでサポートされています。
バージョン 3.0 以降の 3 バージョン (MySQL 8.0 互換)
バージョン 2.04.2 以降の 2 バージョン (MySQL 5.7 互換)
バージョン 1.17.3 以降の 1 バージョン (MySQL 5.6 互換)

https://docs.aws.amazon.com/ja_jp/AmazonRDS/latest/AuroraUserGuide/USER_PerfInsights.Overview.Engines.html

木村明仁木村明仁

Parallel Query は 作成時に指定していないので Terraform のデフォルト provisioned になってる

engine_mode - (Optional) The database engine mode. Valid values: global (only valid for Aurora MySQL 1.21 and earlier), multimaster, parallelquery, provisioned, serverless. Defaults to: provisioned. See the RDS User Guide for limitations when using serverless.

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/rds_cluster#engine_mode

木村明仁木村明仁

Performance Insightsを無効にして再度 terraform apply 実行

途中省略

20分ほど所要した

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place
+/- create replacement and then destroy

Terraform will perform the following actions:

  # module.database.aws_db_parameter_group.rds must be replaced
+/- resource "aws_db_parameter_group" "rds" {
      ~ arn         = "arn:aws:rds:ap-northeast-1:470926947163:pg:pg-first-fargate-dev20220929053147768500000001" -> (known after apply)
      ~ family      = "aurora-mysql5.7" -> "aurora-mysql8.0" # forces replacement
      ~ id          = "pg-first-fargate-dev20220929053147768500000001" -> (known after apply)
      ~ name        = "pg-first-fargate-dev20220929053147768500000001" -> (known after apply)
        tags        = {
            "Name" = "pg-first-fargate-dev"
        }
        # (3 unchanged attributes hidden)
    }

  # module.database.aws_rds_cluster.rds will be updated in-place
  ~ resource "aws_rds_cluster" "rds" {
      ~ allow_major_version_upgrade         = false -> true
      ~ db_cluster_parameter_group_name     = "pg-first-fargate-dev20220929053147768500000002" -> (known after apply)
      ~ db_instance_parameter_group_name    = "pg-first-fargate-dev20220929053147768500000001" -> (known after apply)
      ~ engine_version                      = "5.7.mysql_aurora.2.10.2" -> "8.0.mysql_aurora.3.02.0"
        id                                  = "rds-first-fargate-dev"
        tags                                = {
            "Name" = "rds-first-fargate-dev"
        }
        # (40 unchanged attributes hidden)
    }

  # module.database.aws_rds_cluster_instance.rds_instances[0] will be updated in-place
  ~ resource "aws_rds_cluster_instance" "rds_instances" {
      ~ engine_version                        = "5.7.mysql_aurora.2.10.2" -> "8.0.mysql_aurora.3.02.0"
        id                                    = "rds-0"
        tags                                  = {}
        # (28 unchanged attributes hidden)
    }

  # module.database.aws_rds_cluster_instance.rds_instances[1] will be updated in-place
  ~ resource "aws_rds_cluster_instance" "rds_instances" {
      ~ engine_version                        = "5.7.mysql_aurora.2.10.2" -> "8.0.mysql_aurora.3.02.0"
        id                                    = "rds-1"
        tags                                  = {}
        # (28 unchanged attributes hidden)
    }

  # module.database.aws_rds_cluster_parameter_group.rds must be replaced
+/- resource "aws_rds_cluster_parameter_group" "rds" {
      ~ arn         = "arn:aws:rds:ap-northeast-1:470926947163:cluster-pg:pg-first-fargate-dev20220929053147768500000002" -> (known after apply)
      ~ family      = "aurora-mysql5.7" -> "aurora-mysql8.0" # forces replacement
      ~ id          = "pg-first-fargate-dev20220929053147768500000002" -> (known after apply)
      ~ name        = "pg-first-fargate-dev20220929053147768500000002" -> (known after apply)
        tags        = {
            "Name" = "pg-first-fargate-dev"
        }
        # (3 unchanged attributes hidden)
    }

Plan: 2 to add, 3 to change, 2 to destroy.
module.database.aws_rds_cluster_parameter_group.rds: Creating...
module.database.aws_db_parameter_group.rds: Creating...
module.database.aws_db_parameter_group.rds: Creation complete after 1s [id=pg-first-fargate-dev20220929053753338700000001]
module.database.aws_rds_cluster_parameter_group.rds: Creation complete after 1s [id=pg-first-fargate-dev20220929053753338800000002]
module.database.aws_rds_cluster.rds: Modifying... [id=rds-first-fargate-dev]
module.database.aws_rds_cluster.rds: Still modifying... [id=rds-first-fargate-dev, 10s elapsed]
module.database.aws_rds_cluster.rds: Still modifying... [id=rds-first-fargate-dev, 20m10s elapsed]
module.database.aws_rds_cluster.rds: Modifications complete after 20m17s [id=rds-first-fargate-dev]
module.database.aws_rds_cluster_instance.rds_instances[1]: Modifying... [id=rds-1]
module.database.aws_rds_cluster_instance.rds_instances[0]: Modifying... [id=rds-0]
module.database.aws_rds_cluster_instance.rds_instances[1]: Still modifying... [id=rds-1, 10s elapsed]
module.database.aws_rds_cluster_instance.rds_instances[0]: Still modifying... [id=rds-0, 10s elapsed]
module.database.aws_rds_cluster_instance.rds_instances[0]: Still modifying... [id=rds-0, 20s elapsed]
module.database.aws_rds_cluster_instance.rds_instances[1]: Still modifying... [id=rds-1, 20s elapsed]
module.database.aws_rds_cluster_instance.rds_instances[1]: Still modifying... [id=rds-1, 30s elapsed]
module.database.aws_rds_cluster_instance.rds_instances[0]: Still modifying... [id=rds-0, 30s elapsed]
module.database.aws_rds_cluster_instance.rds_instances[0]: Modifications complete after 31s [id=rds-0]
module.database.aws_rds_cluster_instance.rds_instances[1]: Modifications complete after 31s [id=rds-1]
module.database.aws_rds_cluster_parameter_group.rds (deposed object 0f917123): Destroying... [id=pg-first-fargate-dev20220929053147768500000002]
module.database.aws_db_parameter_group.rds (deposed object 5d0e3764): Destroying... [id=pg-first-fargate-dev20220929053147768500000001]
module.database.aws_rds_cluster_parameter_group.rds: Destruction complete after 0s
module.database.aws_db_parameter_group.rds: Destruction complete after 0s

Apply complete! Resources: 2 added, 3 changed, 2 destroyed.```
木村明仁木村明仁

Performance Insightsを再度有効にしてみる

エラーメッセージが出る

Error: updating RDS Cluster Instance (rds-0): InvalidParameterCombination: Performance Insights not supported for this configuration, please disable this feature.

サポートされていないというメッセージ

AWS CLIで後ほど試す

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # module.database.aws_rds_cluster_instance.rds_instances[0] will be updated in-place
  ~ resource "aws_rds_cluster_instance" "rds_instances" {
        id                                    = "rds-0"
      ~ performance_insights_enabled          = false -> true
        tags                                  = {}
        # (28 unchanged attributes hidden)
    }

  # module.database.aws_rds_cluster_instance.rds_instances[1] will be updated in-place
  ~ resource "aws_rds_cluster_instance" "rds_instances" {
        id                                    = "rds-1"
      ~ performance_insights_enabled          = false -> true
        tags                                  = {}
        # (28 unchanged attributes hidden)
    }

Plan: 0 to add, 2 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

module.database.aws_rds_cluster_instance.rds_instances[1]: Modifying... [id=rds-1]
module.database.aws_rds_cluster_instance.rds_instances[0]: Modifying... [id=rds-0]
╷
│ Error: updating RDS Cluster Instance (rds-1): InvalidParameterCombination: Performance Insights not supported for this configuration, please disable this feature.
│       status code: 400, request id: 716ab165-2e71-4717-91f3-c6b61b1fffbb
│ 
│   with module.database.aws_rds_cluster_instance.rds_instances[1],
│   on ../../modules/database/main.tf line 117, in resource "aws_rds_cluster_instance" "rds_instances":
│  117: resource "aws_rds_cluster_instance" "rds_instances" {
│ 
╵
╷
│ Error: updating RDS Cluster Instance (rds-0): InvalidParameterCombination: Performance Insights not supported for this configuration, please disable this feature.
│       status code: 400, request id: cc03edc2-9e3c-4b88-afdd-4eb213df7518
│ 
│   with module.database.aws_rds_cluster_instance.rds_instances[0],
│   on ../../modules/database/main.tf line 117, in resource "aws_rds_cluster_instance" "rds_instances":
│  117: resource "aws_rds_cluster_instance" "rds_instances" {
│ 
╵
木村明仁木村明仁

AWS CLIも同じエラーが出る

[22-09-29 16:24:15] ~ % aws rds modify-db-instance --db-instance-identifier rds-0 --enable-performance-insights

An error occurred (InvalidParameterCombination) when calling the ModifyDBInstance operation: Performance Insights not supported for this configuration, please disable this feature.
木村明仁木村明仁

Instance classが怪しいので serverless にしてみる

aws_rds_clusterengine_mode, serverlessv2_scaling_configuration を追加

resource "aws_rds_cluster" "rds" {
  cluster_identifier               = "rds-${var.name_suffix}"
  backtrack_window                 = 0
  backup_retention_period          = 2
  copy_tags_to_snapshot            = true
  database_name                    = "sample"
  db_cluster_parameter_group_name  = aws_rds_cluster_parameter_group.rds.name
  db_instance_parameter_group_name = aws_db_parameter_group.rds.name
  db_subnet_group_name             = aws_db_subnet_group.rds.name
  deletion_protection              = false
  engine                           = "aurora-mysql"
  engine_version                   = "8.0.mysql_aurora.3.02.0"
  engine_mode                      = "provisioned" # 追加
  allow_major_version_upgrade      = true
  master_username                  = "admin"
  master_password                  = random_password.password.result
  port                             = 3306
  preferred_backup_window          = "17:10-17:40"
  preferred_maintenance_window     = "sun:19:03-sun:19:33"
  storage_encrypted                = true
  vpc_security_group_ids           = [aws_security_group.rds.id]
  skip_final_snapshot              = var.skip_final_snapshot
  apply_immediately                = var.apply_immediately
  enabled_cloudwatch_logs_exports  = ["error", "slowquery"]
  kms_key_id                       = aws_kms_key.rds.arn

  # ---------- 追加 ここから----------
  serverlessv2_scaling_configuration {
    max_capacity = 10
    min_capacity = 0.5
  }
  # ---------- 追加 ここまで----------

  tags = {
    Name = "rds-${var.name_suffix}"
  }

  depends_on = [
    aws_cloudwatch_log_group.rds_error,
    aws_cloudwatch_log_group.rds_slowquery
  ]
}

instance_classdb.t4g.medium から db.serverless に変更する
performance_insights_enabledtrue に変更して terraform apply 実行

resource "aws_rds_cluster_instance" "rds_instances" {
  count                           = 2
  cluster_identifier              = aws_rds_cluster.rds.id
  identifier                      = "rds-${count.index}"
  instance_class                  = var.instance_class # -> db.serverless
  engine                          = aws_rds_cluster.rds.engine
  engine_version                  = aws_rds_cluster.rds.engine_version
  performance_insights_enabled    =true
  performance_insights_kms_key_id = aws_kms_key.rds.arn
}
木村明仁木村明仁

うまくいった模様

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # module.database.aws_rds_cluster_instance.rds_instances[0] will be updated in-place
  ~ resource "aws_rds_cluster_instance" "rds_instances" {
        id                                    = "rds-0"
      ~ instance_class                        = "db.t4g.medium" -> "db.serverless"
      ~ performance_insights_enabled          = false -> true
        tags                                  = {}
        # (27 unchanged attributes hidden)
    }

  # module.database.aws_rds_cluster_instance.rds_instances[1] will be updated in-place
  ~ resource "aws_rds_cluster_instance" "rds_instances" {
        id                                    = "rds-1"
      ~ instance_class                        = "db.t4g.medium" -> "db.serverless"
      ~ performance_insights_enabled          = false -> true
        tags                                  = {}
        # (27 unchanged attributes hidden)
    }

Plan: 0 to add, 2 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

module.database.aws_rds_cluster_instance.rds_instances[1]: Modifying... [id=rds-1]
module.database.aws_rds_cluster_instance.rds_instances[0]: Modifying... [id=rds-0]
module.database.aws_rds_cluster_instance.rds_instances[0]: Still modifying... [id=rds-0, 10s elapsed]
module.database.aws_rds_cluster_instance.rds_instances[1]: Still modifying... [id=rds-1, 10s elapsed]
module.database.aws_rds_cluster_instance.rds_instances[0]: Modifications complete after 2m25s [id=rds-0]
module.database.aws_rds_cluster_instance.rds_instances[1]: Still modifying... [id=rds-1, 2m30s elapsed]
module.database.aws_rds_cluster_instance.rds_instances[1]: Still modifying... [id=rds-1, 2m40s elapsed]
module.database.aws_rds_cluster_instance.rds_instances[1]: Modifications complete after 2m45s [id=rds-1]

Apply complete! Resources: 0 added, 2 changed, 0 destroyed.
木村明仁木村明仁

performance_insights が対応しているかどうかの確認

Aurora MySQL 5.7, db.t4g.medium で有効化できている

木村明仁木村明仁

Aurora MySQL 8.0, db.t4g.medium で新規に作成するも Performance Insights 未サポートのエラーが出る
→ in-place upgrade は関係なく,Performance Insights と, Aurora MySQLバージョン, instance class の組み合わせで起きる模様

│ Error: creating RDS Cluster (rds2-kimura) Instance (rds2-1): InvalidParameterCombination: Performance Insights not supported for this configuration.
│       status code: 400, request id: b09c83b4-88fa-4624-b0c0-af535ab6a693
│ 
│   with module.database.aws_rds_cluster_instance.rds2_instances[1],
│   on modules/database/main.tf line 230, in resource "aws_rds_cluster_instance" "rds2_instances":
│  230: resource "aws_rds_cluster_instance" "rds2_instances" {
│ 
╵
╷
│ Error: creating RDS Cluster (rds2-kimura) Instance (rds2-0): InvalidParameterCombination: Performance Insights not supported for this configuration.
│       status code: 400, request id: 065f3680-6305-47e6-b064-c4f502804cc1
│ 
│   with module.database.aws_rds_cluster_instance.rds2_instances[0],
│   on modules/database/main.tf line 230, in resource "aws_rds_cluster_instance" "rds2_instances":
│  230: resource "aws_rds_cluster_instance" "rds2_instances" {
木村明仁木村明仁

サポートに問い合わせ中

不具合である回答もらった

現状 db.t4g と Aurora MySQL 3.02.x の組み合わせでは Performance Insights が有効化できない状況

回避策
インスタンスタイプを変更してin-place upgradeする必要あり

木村明仁木村明仁

サポートから補足

将来的に Aurora MySQL の最新バージョンにて Performance Insights が使用できるインスタンスクラスが変更される可能性があるかもしれませんため、他のインスタンスクラスに変更して再実行してもメッセージが表示される場合にはお手数でございますが、以下の英語版ドキュメントの "Instance class restrictions" の箇所をご確認いただくようお願いいたします。
[Amazon Aurora DB engine and instance class support for Performance Insights]
https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_PerfInsights.Overview.Engines.html

木村明仁木村明仁

ドキュメントに反映された模様

Performance Insights has the following engine class restrictions:
db.t2 – Not supported
db.t3 – Not supported
db.t4g – Supported for 2.10.1 and higher version 2 (compatible with MySQL 5.7).
db.t4g – Supported only for 3 versions (compatible with MySQL 8.0) and 2.10.1 and higher 2 versions (compatible with MySQL 5.7).
db.t4g – Supported only for 3 versions (compatible with MySQL 8.0) and 2.10.1 and higher 2 versions (compatible with MySQL 5.7).
db.t4g – Supported only for 3 versions (compatible with MySQL 8.0) and 2.10.1 and higher 2 versions (compatible with MySQL 5.7).

https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_PerfInsights.Overview.Engines.html

このスクラップは2022/10/11にクローズされました