Resource: aws_db_snapshot_copy

Manages an RDS database instance snapshot copy. For managing RDS database cluster snapshots, see the aws_db_cluster_snapshot resource.

Example Usage

resource "aws_db_instance" "example" {
  allocated_storage = 10
  engine            = "mysql"
  engine_version    = "5.6.21"
  instance_class    = "db.t2.micro"
  db_name           = "baz"
  password          = "barbarbarbar"
  username          = "foo"

  maintenance_window      = "Fri:09:00-Fri:09:30"
  backup_retention_period = 0
  parameter_group_name    = "default.mysql5.6"
}

resource "aws_db_snapshot" "example" {
  db_instance_identifier = aws_db_instance.example.identifier
  db_snapshot_identifier = "testsnapshot1234"
}

resource "aws_db_snapshot_copy" "example" {
  source_db_snapshot_identifier = aws_db_snapshot.example.db_snapshot_arn
  target_db_snapshot_identifier = "testsnapshot1234-copy"
}

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 aws_db_snapshot_copy using the snapshot identifier. For example:

import {
  to = aws_db_snapshot_copy.example
  id = "my-snapshot"
}

Using terraform import, import aws_db_snapshot_copy using the snapshot identifier. For example:

% terraform import aws_db_snapshot_copy.example my-snapshot