Skip to content

Resource: awsDbSnapshotCopy

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

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsDbInstanceExample = new aws.dbInstance.DbInstance(this, "example", {
  allocatedStorage: 10,
  backupRetentionPeriod: 0,
  engine: "mysql",
  engineVersion: "5.6.21",
  instanceClass: "db.t2.micro",
  maintenanceWindow: "Fri:09:00-Fri:09:30",
  name: "baz",
  parameterGroupName: "default.mysql5.6",
  password: "barbarbarbar",
  username: "foo",
});
const awsDbSnapshotExample = new aws.dbSnapshot.DbSnapshot(this, "example_1", {
  dbInstanceIdentifier: awsDbInstanceExample.id,
  dbSnapshotIdentifier: "testsnapshot1234",
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsDbSnapshotExample.overrideLogicalId("example");
const awsDbSnapshotCopyExample = new aws.dbSnapshotCopy.DbSnapshotCopy(
  this,
  "example_2",
  {
    sourceDbSnapshotIdentifier: awsDbSnapshotExample.dbSnapshotArn,
    targetDbSnapshotIdentifier: "testsnapshot1234-copy",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsDbSnapshotCopyExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • copyTags - (Optional) Whether to copy existing tags. Defaults to false.
  • destinationRegion - (Optional) The Destination region to place snapshot copy.
  • kmsKeyId - (Optional) KMS key ID.
  • optionGroupName- (Optional) The name of an option group to associate with the copy of the snapshot.
  • presignedUrl - (Optional) he URL that contains a Signature Version 4 signed request.
  • sourceDbSnapshotIdentifier - (Required) Snapshot identifier of the source snapshot.
  • targetCustomAvailabilityZone - (Optional) The external custom Availability Zone.
  • targetDbSnapshotIdentifier - (Required) The Identifier for the snapshot.
  • tags - (Optional) Key-value map of resource tags. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - Snapshot Identifier.
  • allocatedStorage - Specifies the allocated storage size in gigabytes (GB).
  • availabilityZone - Specifies the name of the Availability Zone the DB instance was located in at the time of the DB snapshot.
  • dbSnapshotArn - The Amazon Resource Name (ARN) for the DB snapshot.
  • encrypted - Specifies whether the DB snapshot is encrypted.
  • engine - Specifies the name of the database engine.
  • engineVersion - Specifies the version of the database engine.
  • iops - Specifies the Provisioned IOPS (I/O operations per second) value of the DB instance at the time of the snapshot.
  • kmsKeyId - The ARN for the KMS encryption key.
  • licenseModel - License model information for the restored DB instance.
  • optionGroupName - Provides the option group name for the DB snapshot.
  • sourceDbSnapshotIdentifier - The DB snapshot Arn that the DB snapshot was copied from. It only has value in case of cross customer or cross region copy.
  • sourceRegion - The region that the DB snapshot was created in or copied from.
  • storageType - Specifies the storage type associated with DB snapshot.
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
  • vpcId - Provides the VPC ID associated with the DB snapshot.

Timeouts

Configuration options:

  • create - (Default 20M)

Import

awsDbSnapshotCopy can be imported by using the snapshot identifier, e.g.,

$ terraform import aws_db_snapshot_copy.example my-snapshot