Skip to content

Resource: awsDbSnapshot

Manages an RDS database instance snapshot. 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 awsDbInstanceBar = new aws.dbInstance.DbInstance(this, "bar", {
  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",
});
new aws.dbSnapshot.DbSnapshot(this, "test", {
  dbInstanceIdentifier: awsDbInstanceBar.id,
  dbSnapshotIdentifier: "testsnapshot1234",
});

Argument Reference

The following arguments are supported:

  • dbInstanceIdentifier - (Required) The DB Instance Identifier from which to take the snapshot.
  • dbSnapshotIdentifier - (Required) The Identifier for the snapshot.
  • sharedAccounts - (Optional) List of AWS Account ids to share snapshot with, use all to make snaphot public.
  • 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:

  • 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.
  • status - Specifies the status of this DB snapshot.
  • 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

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

$ terraform import aws_db_snapshot.example my-snapshot