Provides an RDS instance resource. A DB instance is an isolated database environment in the cloud. A DB instance can contain multiple user-created databases.

Changes to a DB instance can occur when you manually change a parameter, such as allocated_storage, and are reflected in the next maintenance window. Because of this, Terraform may report a difference in its planning phase because a modification has not yet taken place. You can use the apply_immediately flag to instruct the service to apply the change immediately (see documentation below).

When upgrading the major version of an engine, allow_major_version_upgrade must be set to true

~> Note: using apply_immediately can result in a brief downtime as the server reboots. See the AWS Docs on RDS Maintenance for more information.

Example Usage

resource "aws_db_instance" "default" {
  allocated_storage    = 10
  engine               = "mysql"
  engine_version       = "5.6.17"
  instance_class       = "db.t1.micro"
  name                 = "mydb"
  username             = "foo"
  password             = "bar"
  db_subnet_group_name = "my_database_subnet_group"
  parameter_group_name = "default.mysql5.6"

Argument Reference

For more detailed documentation about each argument, refer to the AWS official documentation.

The following arguments are supported:

~> NOTE: Removing the replicate_source_db attribute from an existing RDS Replicate database managed by Terraform will promote the database to a fully standalone database.

Attributes Reference

The following attributes are exported:

On Oracle instances the following is exported additionally:


DB Instances can be imported using the identifier, e.g.

$ terraform import aws_db_instance.default mydb-rds-instance

See the source of this document at Terraform.io