Skip to content

Data Source: awsDbClusterSnapshot

Use this data source to get information about a DB Cluster Snapshot for use when provisioning DB clusters.

\~> NOTE: This data source does not apply to snapshots created on DB Instances. See the awsDbSnapshot data source for DB Instance snapshots.

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 dataAwsDbClusterSnapshotDevelopmentFinalSnapshot =
  new aws.dataAwsDbClusterSnapshot.DataAwsDbClusterSnapshot(
    this,
    "development_final_snapshot",
    {
      dbClusterIdentifier: "development_cluster",
      mostRecent: true,
    }
  );
const awsRdsClusterAurora = new aws.rdsCluster.RdsCluster(this, "aurora", {
  clusterIdentifier: "development_cluster",
  dbSubnetGroupName: "my_db_subnet_group",
  snapshotIdentifier: dataAwsDbClusterSnapshotDevelopmentFinalSnapshot.id,
});
awsRdsClusterAurora.addOverride("lifecycle", [
  {
    ignore_changes: ["${snapshot_identifier}"],
  },
]);
const awsRdsClusterInstanceAurora =
  new aws.rdsClusterInstance.RdsClusterInstance(this, "aurora_2", {
    clusterIdentifier: awsRdsClusterAurora.id,
    dbSubnetGroupName: "my_db_subnet_group",
    instanceClass: "db.t2.small",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsRdsClusterInstanceAurora.overrideLogicalId("aurora");

Argument Reference

The following arguments are supported:

  • mostRecent - (Optional) If more than one result is returned, use the most recent Snapshot.

  • dbClusterIdentifier - (Optional) Returns the list of snapshots created by the specific db_cluster

  • dbClusterSnapshotIdentifier - (Optional) Returns information on a specific snapshot_id.

  • snapshotType - (Optional) Type of snapshots to be returned. If you don't specify a SnapshotType value, then both automated and manual DB cluster snapshots are returned. Shared and public DB Cluster Snapshots are not included in the returned results by default. Possible values are, automated, manual, shared, public and awsbackup.

  • includeShared - (Optional) Set this value to true to include shared manual DB Cluster Snapshots from other AWS accounts that this AWS account has been given permission to copy or restore, otherwise set this value to false. The default is false.

  • includePublic - (Optional) Set this value to true to include manual DB Cluster Snapshots that are public and can be copied or restored by any AWS account, otherwise set this value to false. The default is false.

Attributes Reference

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

  • allocatedStorage - Allocated storage size in gigabytes (GB).
  • availabilityZones - List of EC2 Availability Zones that instances in the DB cluster snapshot can be restored in.
  • dbClusterIdentifier - Specifies the DB cluster identifier of the DB cluster that this DB cluster snapshot was created from.
  • dbClusterSnapshotArn - The ARN for the DB Cluster Snapshot.
  • engineVersion - Version of the database engine for this DB cluster snapshot.
  • engine - Name of the database engine.
  • id - Snapshot ID.
  • kmsKeyId - If storage_encrypted is true, the AWS KMS key identifier for the encrypted DB cluster snapshot.
  • licenseModel - License model information for the restored DB cluster.
  • port - Port that the DB cluster was listening on at the time of the snapshot.
  • snapshotCreateTime - Time when the snapshot was taken, in Universal Coordinated Time (UTC).
  • sourceDbClusterSnapshotIdentifier - DB Cluster Snapshot ARN that the DB Cluster Snapshot was copied from. It only has value in case of cross customer or cross region copy.
  • status - Status of this DB Cluster Snapshot.
  • storageEncrypted - Whether the DB cluster snapshot is encrypted.
  • vpcId - VPC ID associated with the DB cluster snapshot.
  • tags - Map of tags for the resource.