AWS Classic

Pulumi Official
Package maintained by Pulumi
v5.10.0 published on Monday, Jul 11, 2022 by Pulumi

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

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var developmentFinalSnapshot = Output.Create(Aws.Rds.GetClusterSnapshot.InvokeAsync(new Aws.Rds.GetClusterSnapshotArgs
        {
            DbClusterIdentifier = "development_cluster",
            MostRecent = true,
        }));
        // Use the last snapshot of the dev database before it was destroyed to create
        // a new dev database.
        var auroraCluster = new Aws.Rds.Cluster("auroraCluster", new Aws.Rds.ClusterArgs
        {
            ClusterIdentifier = "development_cluster",
            SnapshotIdentifier = developmentFinalSnapshot.Apply(developmentFinalSnapshot => developmentFinalSnapshot.Id),
            DbSubnetGroupName = "my_db_subnet_group",
        });
        var auroraClusterInstance = new Aws.Rds.ClusterInstance("auroraClusterInstance", new Aws.Rds.ClusterInstanceArgs
        {
            ClusterIdentifier = auroraCluster.Id,
            InstanceClass = "db.t2.small",
            DbSubnetGroupName = "my_db_subnet_group",
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/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
		}
		auroraCluster, err := rds.NewCluster(ctx, "auroraCluster", &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, "auroraClusterInstance", &rds.ClusterInstanceArgs{
			ClusterIdentifier: auroraCluster.ID(),
			InstanceClass:     pulumi.String("db.t2.small"),
			DbSubnetGroupName: pulumi.String("my_db_subnet_group"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var developmentFinalSnapshot = Output.of(RdsFunctions.getClusterSnapshot(GetClusterSnapshotArgs.builder()
            .dbClusterIdentifier("development_cluster")
            .mostRecent(true)
            .build()));

        var auroraCluster = new Cluster("auroraCluster", ClusterArgs.builder()        
            .clusterIdentifier("development_cluster")
            .snapshotIdentifier(developmentFinalSnapshot.apply(getClusterSnapshotResult -> getClusterSnapshotResult.id()))
            .dbSubnetGroupName("my_db_subnet_group")
            .build());

        var auroraClusterInstance = new ClusterInstance("auroraClusterInstance", ClusterInstanceArgs.builder()        
            .clusterIdentifier(auroraCluster.id())
            .instanceClass("db.t2.small")
            .dbSubnetGroupName("my_db_subnet_group")
            .build());

    }
}
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_cluster = aws.rds.Cluster("auroraCluster",
    cluster_identifier="development_cluster",
    snapshot_identifier=development_final_snapshot.id,
    db_subnet_group_name="my_db_subnet_group")
aurora_cluster_instance = aws.rds.ClusterInstance("auroraClusterInstance",
    cluster_identifier=aurora_cluster.id,
    instance_class="db.t2.small",
    db_subnet_group_name="my_db_subnet_group")
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 auroraCluster = new aws.rds.Cluster("auroraCluster", {
    clusterIdentifier: "development_cluster",
    snapshotIdentifier: developmentFinalSnapshot.then(developmentFinalSnapshot => developmentFinalSnapshot.id),
    dbSubnetGroupName: "my_db_subnet_group",
});
const auroraClusterInstance = new aws.rds.ClusterInstance("auroraClusterInstance", {
    clusterIdentifier: auroraCluster.id,
    instanceClass: "db.t2.small",
    dbSubnetGroupName: "my_db_subnet_group",
});
resources:
  auroraCluster:
    type: aws:rds:Cluster
    properties:
      clusterIdentifier: development_cluster
      snapshotIdentifier: ${developmentFinalSnapshot.id}
      dbSubnetGroupName: my_db_subnet_group
  auroraClusterInstance:
    type: aws:rds:ClusterInstance
    properties:
      clusterIdentifier: ${auroraCluster.id}
      instanceClass: db.t2.small
      dbSubnetGroupName: my_db_subnet_group
variables:
  developmentFinalSnapshot:
    Fn::Invoke:
      Function: aws:rds:getClusterSnapshot
      Arguments:
        dbClusterIdentifier: development_cluster
        mostRecent: true

Using getClusterSnapshot

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getClusterSnapshot(args: GetClusterSnapshotArgs, opts?: InvokeOptions): Promise<GetClusterSnapshotResult>
function getClusterSnapshotOutput(args: GetClusterSnapshotOutputArgs, opts?: InvokeOptions): Output<GetClusterSnapshotResult>
def get_cluster_snapshot(db_cluster_identifier: Optional[str] = None,
                         db_cluster_snapshot_identifier: Optional[str] = None,
                         include_public: Optional[bool] = None,
                         include_shared: Optional[bool] = None,
                         most_recent: Optional[bool] = None,
                         snapshot_type: Optional[str] = None,
                         tags: Optional[Mapping[str, str]] = None,
                         opts: Optional[InvokeOptions] = None) -> GetClusterSnapshotResult
def get_cluster_snapshot_output(db_cluster_identifier: Optional[pulumi.Input[str]] = None,
                         db_cluster_snapshot_identifier: Optional[pulumi.Input[str]] = None,
                         include_public: Optional[pulumi.Input[bool]] = None,
                         include_shared: Optional[pulumi.Input[bool]] = None,
                         most_recent: Optional[pulumi.Input[bool]] = None,
                         snapshot_type: Optional[pulumi.Input[str]] = None,
                         tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetClusterSnapshotResult]
func LookupClusterSnapshot(ctx *Context, args *LookupClusterSnapshotArgs, opts ...InvokeOption) (*LookupClusterSnapshotResult, error)
func LookupClusterSnapshotOutput(ctx *Context, args *LookupClusterSnapshotOutputArgs, opts ...InvokeOption) LookupClusterSnapshotResultOutput

> Note: This function is named LookupClusterSnapshot in the Go SDK.

public static class GetClusterSnapshot 
{
    public static Task<GetClusterSnapshotResult> InvokeAsync(GetClusterSnapshotArgs args, InvokeOptions? opts = null)
    public static Output<GetClusterSnapshotResult> Invoke(GetClusterSnapshotInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetClusterSnapshotResult> getClusterSnapshot(GetClusterSnapshotArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: aws:rds/getClusterSnapshot:getClusterSnapshot
  Arguments:
    # Arguments dictionary

The following arguments are supported:

DbClusterIdentifier string

Returns the list of snapshots created by the specific db_cluster

DbClusterSnapshotIdentifier string

Returns information on a specific snapshot_id.

IncludePublic bool

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 bool

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 bool

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

SnapshotType string

The 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 Dictionary<string, string>

A map of tags for the resource.

DbClusterIdentifier string

Returns the list of snapshots created by the specific db_cluster

DbClusterSnapshotIdentifier string

Returns information on a specific snapshot_id.

IncludePublic bool

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 bool

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 bool

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

SnapshotType string

The 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 map[string]string

A map of tags for the resource.

dbClusterIdentifier String

Returns the list of snapshots created by the specific db_cluster

dbClusterSnapshotIdentifier String

Returns information on a specific snapshot_id.

includePublic Boolean

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 Boolean

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 Boolean

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

snapshotType String

The 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 Map<String,String>

A map of tags for the resource.

dbClusterIdentifier string

Returns the list of snapshots created by the specific db_cluster

dbClusterSnapshotIdentifier string

Returns information on a specific snapshot_id.

includePublic boolean

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 boolean

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 boolean

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

snapshotType string

The 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 {[key: string]: string}

A map of tags for the resource.

db_cluster_identifier str

Returns the list of snapshots created by the specific db_cluster

db_cluster_snapshot_identifier str

Returns information on a specific snapshot_id.

include_public bool

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.

include_shared bool

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.

most_recent bool

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

snapshot_type str

The 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[str, str]

A map of tags for the resource.

dbClusterIdentifier String

Returns the list of snapshots created by the specific db_cluster

dbClusterSnapshotIdentifier String

Returns information on a specific snapshot_id.

includePublic Boolean

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 Boolean

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 Boolean

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

snapshotType String

The 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 Map<String>

A map of tags for the resource.

getClusterSnapshot Result

The following output properties are available:

AllocatedStorage int

Specifies the allocated storage size in gigabytes (GB).

AvailabilityZones List<string>

List of EC2 Availability Zones that instances in the DB cluster snapshot can be restored in.

DbClusterSnapshotArn string

The Amazon Resource Name (ARN) for the DB Cluster Snapshot.

Engine string

Specifies the name of the database engine.

EngineVersion string

Version of the database engine for this DB cluster snapshot.

Id string

The provider-assigned unique ID for this managed resource.

KmsKeyId string

If storage_encrypted is true, the AWS KMS key identifier for the encrypted DB cluster snapshot.

LicenseModel string

License model information for the restored DB cluster.

Port int

Port that the DB cluster was listening on at the time of the snapshot.

SnapshotCreateTime string

Time when the snapshot was taken, in Universal Coordinated Time (UTC).

SourceDbClusterSnapshotArn string
Status string

The status of this DB Cluster Snapshot.

StorageEncrypted bool

Specifies whether the DB cluster snapshot is encrypted.

Tags Dictionary<string, string>

A map of tags for the resource.

VpcId string

The VPC ID associated with the DB cluster snapshot.

DbClusterIdentifier string

Specifies the DB cluster identifier of the DB cluster that this DB cluster snapshot was created from.

DbClusterSnapshotIdentifier string
IncludePublic bool
IncludeShared bool
MostRecent bool
SnapshotType string
AllocatedStorage int

Specifies the allocated storage size in gigabytes (GB).

AvailabilityZones []string

List of EC2 Availability Zones that instances in the DB cluster snapshot can be restored in.

DbClusterSnapshotArn string

The Amazon Resource Name (ARN) for the DB Cluster Snapshot.

Engine string

Specifies the name of the database engine.

EngineVersion string

Version of the database engine for this DB cluster snapshot.

Id string

The provider-assigned unique ID for this managed resource.

KmsKeyId string

If storage_encrypted is true, the AWS KMS key identifier for the encrypted DB cluster snapshot.

LicenseModel string

License model information for the restored DB cluster.

Port int

Port that the DB cluster was listening on at the time of the snapshot.

SnapshotCreateTime string

Time when the snapshot was taken, in Universal Coordinated Time (UTC).

SourceDbClusterSnapshotArn string
Status string

The status of this DB Cluster Snapshot.

StorageEncrypted bool

Specifies whether the DB cluster snapshot is encrypted.

Tags map[string]string

A map of tags for the resource.

VpcId string

The VPC ID associated with the DB cluster snapshot.

DbClusterIdentifier string

Specifies the DB cluster identifier of the DB cluster that this DB cluster snapshot was created from.

DbClusterSnapshotIdentifier string
IncludePublic bool
IncludeShared bool
MostRecent bool
SnapshotType string
allocatedStorage Integer

Specifies the allocated storage size in gigabytes (GB).

availabilityZones List<String>

List of EC2 Availability Zones that instances in the DB cluster snapshot can be restored in.

dbClusterSnapshotArn String

The Amazon Resource Name (ARN) for the DB Cluster Snapshot.

engine String

Specifies the name of the database engine.

engineVersion String

Version of the database engine for this DB cluster snapshot.

id String

The provider-assigned unique ID for this managed resource.

kmsKeyId String

If storage_encrypted is true, the AWS KMS key identifier for the encrypted DB cluster snapshot.

licenseModel String

License model information for the restored DB cluster.

port Integer

Port that the DB cluster was listening on at the time of the snapshot.

snapshotCreateTime String

Time when the snapshot was taken, in Universal Coordinated Time (UTC).

sourceDbClusterSnapshotArn String
status String

The status of this DB Cluster Snapshot.

storageEncrypted Boolean

Specifies whether the DB cluster snapshot is encrypted.

tags Map<String,String>

A map of tags for the resource.

vpcId String

The VPC ID associated with the DB cluster snapshot.

dbClusterIdentifier String

Specifies the DB cluster identifier of the DB cluster that this DB cluster snapshot was created from.

dbClusterSnapshotIdentifier String
includePublic Boolean
includeShared Boolean
mostRecent Boolean
snapshotType String
allocatedStorage number

Specifies the allocated storage size in gigabytes (GB).

availabilityZones string[]

List of EC2 Availability Zones that instances in the DB cluster snapshot can be restored in.

dbClusterSnapshotArn string

The Amazon Resource Name (ARN) for the DB Cluster Snapshot.

engine string

Specifies the name of the database engine.

engineVersion string

Version of the database engine for this DB cluster snapshot.

id string

The provider-assigned unique ID for this managed resource.

kmsKeyId string

If storage_encrypted is true, the AWS KMS key identifier for the encrypted DB cluster snapshot.

licenseModel string

License model information for the restored DB cluster.

port number

Port that the DB cluster was listening on at the time of the snapshot.

snapshotCreateTime string

Time when the snapshot was taken, in Universal Coordinated Time (UTC).

sourceDbClusterSnapshotArn string
status string

The status of this DB Cluster Snapshot.

storageEncrypted boolean

Specifies whether the DB cluster snapshot is encrypted.

tags {[key: string]: string}

A map of tags for the resource.

vpcId string

The VPC ID associated with the DB cluster snapshot.

dbClusterIdentifier string

Specifies the DB cluster identifier of the DB cluster that this DB cluster snapshot was created from.

dbClusterSnapshotIdentifier string
includePublic boolean
includeShared boolean
mostRecent boolean
snapshotType string
allocated_storage int

Specifies the allocated storage size in gigabytes (GB).

availability_zones Sequence[str]

List of EC2 Availability Zones that instances in the DB cluster snapshot can be restored in.

db_cluster_snapshot_arn str

The Amazon Resource Name (ARN) for the DB Cluster Snapshot.

engine str

Specifies the name of the database engine.

engine_version str

Version of the database engine for this DB cluster snapshot.

id str

The provider-assigned unique ID for this managed resource.

kms_key_id str

If storage_encrypted is true, the AWS KMS key identifier for the encrypted DB cluster snapshot.

license_model str

License model information for the restored DB cluster.

port int

Port that the DB cluster was listening on at the time of the snapshot.

snapshot_create_time str

Time when the snapshot was taken, in Universal Coordinated Time (UTC).

source_db_cluster_snapshot_arn str
status str

The status of this DB Cluster Snapshot.

storage_encrypted bool

Specifies whether the DB cluster snapshot is encrypted.

tags Mapping[str, str]

A map of tags for the resource.

vpc_id str

The VPC ID associated with the DB cluster snapshot.

db_cluster_identifier str

Specifies the DB cluster identifier of the DB cluster that this DB cluster snapshot was created from.

db_cluster_snapshot_identifier str
include_public bool
include_shared bool
most_recent bool
snapshot_type str
allocatedStorage Number

Specifies the allocated storage size in gigabytes (GB).

availabilityZones List<String>

List of EC2 Availability Zones that instances in the DB cluster snapshot can be restored in.

dbClusterSnapshotArn String

The Amazon Resource Name (ARN) for the DB Cluster Snapshot.

engine String

Specifies the name of the database engine.

engineVersion String

Version of the database engine for this DB cluster snapshot.

id String

The provider-assigned unique ID for this managed resource.

kmsKeyId String

If storage_encrypted is true, the AWS KMS key identifier for the encrypted DB cluster snapshot.

licenseModel String

License model information for the restored DB cluster.

port Number

Port that the DB cluster was listening on at the time of the snapshot.

snapshotCreateTime String

Time when the snapshot was taken, in Universal Coordinated Time (UTC).

sourceDbClusterSnapshotArn String
status String

The status of this DB Cluster Snapshot.

storageEncrypted Boolean

Specifies whether the DB cluster snapshot is encrypted.

tags Map<String>

A map of tags for the resource.

vpcId String

The VPC ID associated with the DB cluster snapshot.

dbClusterIdentifier String

Specifies the DB cluster identifier of the DB cluster that this DB cluster snapshot was created from.

dbClusterSnapshotIdentifier String
includePublic Boolean
includeShared Boolean
mostRecent Boolean
snapshotType String

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.