首页 > 解决方案 > 如何通过 Terraform 减少 RDS 实例的部署时间?

问题描述

resource "aws_db_instance" "mydb1_mishal2" {
  allocated_storage        = 20 # gigabytes
  backup_retention_period  = 7   # in days
  db_subnet_group_name     = "${var.rds_public_subnet_group}"
  engine                   = "mysql"
  engine_version           = "5.7"
  identifier               = "dbmishalsecond"
  instance_class           = "db.t2.micro"
  multi_az                 = false
  name                     = "mydbmishalsecond"
  parameter_group_name     = "default.mysql5.7" # if you have tuned it
  password                 = "mishal12345" #"${trimspace(file("${path.module}/secrets/mydb1-password.txt"))}"
  port                     = 3306
  publicly_accessible      = true
  storage_encrypted        = false # you should always do this
  storage_type             = "gp2"
  username                 = "mydb1"
  #vpc_security_group_ids   = ["${aws_security_group.mydb1.id}"]
}

我正在使用上面的代码在 AWS 中部署 RDS 实例。但是部署需要很长时间。下面的日志:

部署日志

我怎样才能减少部署时间或是否有必要邪恶?

标签: amazon-web-servicesterraformamazon-rds

解决方案


除了多可用数据库确实需要更长的时间才能启动之外,您实际上无法更改 RDS 需要多长时间才能可用。但这并不是您真正要考虑的启动时间。您应该考虑对该参数的可用性要求。


推荐阅读