Resource: aws_db_instance_automated_backups_replication

Manage cross-region replication of automated backups to a different AWS Region. Documentation for cross-region automated backup replication can be found at:

Example Usage

resource "aws_db_instance_automated_backups_replication" "default" {
  source_db_instance_arn = "arn:aws:rds:us-west-2:123456789012:db:mydatabase"
  retention_period       = 14
}

Encrypting the automated backup with KMS

resource "aws_db_instance_automated_backups_replication" "default" {
  source_db_instance_arn = "arn:aws:rds:us-west-2:123456789012:db:mydatabase"
  kms_key_id             = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
}

Example including a RDS DB instance

provider "aws" {
  region = "us-east-1"
}

provider "aws" {
  region = "us-west-2"
  alias  = "replica"
}

resource "aws_db_instance" "default" {
  allocated_storage       = 10
  identifier              = "mydb"
  engine                  = "postgres"
  engine_version          = "13.4"
  instance_class          = "db.t3.micro"
  db_name                 = "mydb"
  username                = "masterusername"
  password                = "mustbeeightcharacters"
  backup_retention_period = 7
  storage_encrypted       = true
  skip_final_snapshot     = true
}

resource "aws_kms_key" "default" {
  description = "Encryption key for automated backups"

  provider = aws.replica
}

resource "aws_db_instance_automated_backups_replication" "default" {
  source_db_instance_arn = aws_db_instance.default.arn
  kms_key_id             = aws_kms_key.default.arn

  provider = aws.replica
}

Argument Reference

This resource supports the following arguments:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Timeouts

Configuration options:

Import

In Terraform v1.5.0 and later, use an import block to import RDS instance automated backups replication using the arn. For example:

import {
  to = aws_db_instance_automated_backups_replication.default
  id = "arn:aws:rds:us-east-1:123456789012:auto-backup:ab-faaa2mgdj1vmp4xflr7yhsrmtbtob7ltrzzz2my"
}

Using terraform import, import RDS instance automated backups replication using the arn. For example:

% terraform import aws_db_instance_automated_backups_replication.default arn:aws:rds:us-east-1:123456789012:auto-backup:ab-faaa2mgdj1vmp4xflr7yhsrmtbtob7ltrzzz2my