getClusterSnapshot

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 aws.rds.Snapshot data source for DB Instance snapshots.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const developmentFinalSnapshot = aws.rds.getClusterSnapshot({
dbClusterIdentifier: "development_cluster",
mostRecent: true,
});
// Use the last snapshot of the dev database before it was destroyed to create
// a new dev database.
const aurora = new aws.rds.Cluster("aurora", {
clusterIdentifier: "development_cluster",
snapshotIdentifier: developmentFinalSnapshot.then(developmentFinalSnapshot => developmentFinalSnapshot.id),
dbSubnetGroupName: "my_db_subnet_group",
});
const auroraClusterInstance = new aws.rds.ClusterInstance("aurora", {
clusterIdentifier: aurora.id,
instanceClass: aws.rds.InstanceType.T2_Small,
dbSubnetGroupName: "my_db_subnet_group",
});
import pulumi
import pulumi_aws as aws
development_final_snapshot = aws.rds.get_cluster_snapshot(db_cluster_identifier="development_cluster",
most_recent=True)
# Use the last snapshot of the dev database before it was destroyed to create
# a new dev database.
aurora = aws.rds.Cluster("aurora",
cluster_identifier="development_cluster",
snapshot_identifier=development_final_snapshot.id,
db_subnet_group_name="my_db_subnet_group")
aurora_cluster_instance = aws.rds.ClusterInstance("aurora",
cluster_identifier=aurora.id,
instance_class=aws.rds.InstanceType.T2_SMALL,
db_subnet_group_name="my_db_subnet_group")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var developmentFinalSnapshot = Aws.Rds.GetClusterSnapshot.Invoke(new()
{
DbClusterIdentifier = "development_cluster",
MostRecent = true,
});
// Use the last snapshot of the dev database before it was destroyed to create
// a new dev database.
var aurora = new Aws.Rds.Cluster("aurora", new()
{
ClusterIdentifier = "development_cluster",
SnapshotIdentifier = developmentFinalSnapshot.Apply(getClusterSnapshotResult => getClusterSnapshotResult.Id),
DbSubnetGroupName = "my_db_subnet_group",
});
var auroraClusterInstance = new Aws.Rds.ClusterInstance("aurora", new()
{
ClusterIdentifier = aurora.Id,
InstanceClass = Aws.Rds.InstanceType.T2_Small,
DbSubnetGroupName = "my_db_subnet_group",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/rds"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
developmentFinalSnapshot, err := rds.LookupClusterSnapshot(ctx, &rds.LookupClusterSnapshotArgs{
DbClusterIdentifier: pulumi.StringRef("development_cluster"),
MostRecent: pulumi.BoolRef(true),
}, nil)
if err != nil {
return err
}
// Use the last snapshot of the dev database before it was destroyed to create
// a new dev database.
aurora, err := rds.NewCluster(ctx, "aurora", &rds.ClusterArgs{
ClusterIdentifier: pulumi.String("development_cluster"),
SnapshotIdentifier: pulumi.String(developmentFinalSnapshot.Id),
DbSubnetGroupName: pulumi.String("my_db_subnet_group"),
})
if err != nil {
return err
}
_, err = rds.NewClusterInstance(ctx, "aurora", &rds.ClusterInstanceArgs{
ClusterIdentifier: aurora.ID(),
InstanceClass: pulumi.String(rds.InstanceType_T2_Small),
DbSubnetGroupName: pulumi.String("my_db_subnet_group"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.rds.RdsFunctions;
import com.pulumi.aws.rds.inputs.GetClusterSnapshotArgs;
import com.pulumi.aws.rds.Cluster;
import com.pulumi.aws.rds.ClusterArgs;
import com.pulumi.aws.rds.ClusterInstance;
import com.pulumi.aws.rds.ClusterInstanceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var developmentFinalSnapshot = RdsFunctions.getClusterSnapshot(GetClusterSnapshotArgs.builder()
.dbClusterIdentifier("development_cluster")
.mostRecent(true)
.build());
// Use the last snapshot of the dev database before it was destroyed to create
// a new dev database.
var aurora = new Cluster("aurora", ClusterArgs.builder()
.clusterIdentifier("development_cluster")
.snapshotIdentifier(developmentFinalSnapshot.id())
.dbSubnetGroupName("my_db_subnet_group")
.build());
var auroraClusterInstance = new ClusterInstance("auroraClusterInstance", ClusterInstanceArgs.builder()
.clusterIdentifier(aurora.id())
.instanceClass("db.t2.small")
.dbSubnetGroupName("my_db_subnet_group")
.build());
}
}
resources:
# Use the last snapshot of the dev database before it was destroyed to create
# a new dev database.
aurora:
type: aws:rds:Cluster
properties:
clusterIdentifier: development_cluster
snapshotIdentifier: ${developmentFinalSnapshot.id}
dbSubnetGroupName: my_db_subnet_group
auroraClusterInstance:
type: aws:rds:ClusterInstance
name: aurora
properties:
clusterIdentifier: ${aurora.id}
instanceClass: db.t2.small
dbSubnetGroupName: my_db_subnet_group
variables:
developmentFinalSnapshot:
fn::invoke:
function: aws:rds:getClusterSnapshot
arguments:
dbClusterIdentifier: development_cluster
mostRecent: true

Return

A collection of values returned by getClusterSnapshot.

Parameters

argument

A collection of arguments for invoking getClusterSnapshot.


suspend fun getClusterSnapshot(dbClusterIdentifier: String? = null, dbClusterSnapshotIdentifier: String? = null, includePublic: Boolean? = null, includeShared: Boolean? = null, mostRecent: Boolean? = null, snapshotType: String? = null, tags: Map<String, String>? = null): GetClusterSnapshotResult

Return

A collection of values returned by getClusterSnapshot.

Parameters

dbClusterIdentifier

Returns the list of snapshots created by the specific db_cluster

dbClusterSnapshotIdentifier

Returns information on a specific snapshot_id.

includePublic

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.

includeShared

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.

mostRecent

If more than one result is returned, use the most recent Snapshot.

snapshotType

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.

tags

Mapping of tags, each pair of which must exactly match a pair on the desired DB cluster snapshot.

See also


Return

A collection of values returned by getClusterSnapshot.

Parameters

argument

Builder for com.pulumi.aws.rds.kotlin.inputs.GetClusterSnapshotPlainArgs.

See also