1. Packages
  2. AWS Classic
  3. API Docs
  4. rds
  5. getClusterSnapshot

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.3.0 published on Thursday, Sep 28, 2023 by Pulumi

aws.rds.getClusterSnapshot

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.3.0 published on Thursday, Sep 28, 2023 by Pulumi

    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 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 auroraCluster = new Aws.Rds.Cluster("auroraCluster", new()
        {
            ClusterIdentifier = "development_cluster",
            SnapshotIdentifier = developmentFinalSnapshot.Apply(getClusterSnapshotResult => getClusterSnapshotResult.Id),
            DbSubnetGroupName = "my_db_subnet_group",
        });
    
        var auroraClusterInstance = new Aws.Rds.ClusterInstance("auroraClusterInstance", new()
        {
            ClusterIdentifier = auroraCluster.Id,
            InstanceClass = "db.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
    		}
    		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 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());
    
            var auroraCluster = new Cluster("auroraCluster", ClusterArgs.builder()        
                .clusterIdentifier("development_cluster")
                .snapshotIdentifier(developmentFinalSnapshot.applyValue(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:
      # Use the last snapshot of the dev database before it was destroyed to create
      # a new dev database.
      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

    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>

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

    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

    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

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

    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

    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>

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

    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

    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}

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

    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

    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]

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

    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

    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>

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

    getClusterSnapshot Result

    The following output properties are available:

    AllocatedStorage int

    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 ARN for the DB Cluster Snapshot.

    Engine string

    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

    Status of this DB Cluster Snapshot.

    StorageEncrypted bool

    Whether the DB cluster snapshot is encrypted.

    Tags Dictionary<string, string>

    Map of tags for the resource.

    VpcId string

    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

    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 ARN for the DB Cluster Snapshot.

    Engine string

    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

    Status of this DB Cluster Snapshot.

    StorageEncrypted bool

    Whether the DB cluster snapshot is encrypted.

    Tags map[string]string

    Map of tags for the resource.

    VpcId string

    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

    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 ARN for the DB Cluster Snapshot.

    engine String

    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

    Status of this DB Cluster Snapshot.

    storageEncrypted Boolean

    Whether the DB cluster snapshot is encrypted.

    tags Map<String,String>

    Map of tags for the resource.

    vpcId String

    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

    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 ARN for the DB Cluster Snapshot.

    engine string

    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

    Status of this DB Cluster Snapshot.

    storageEncrypted boolean

    Whether the DB cluster snapshot is encrypted.

    tags {[key: string]: string}

    Map of tags for the resource.

    vpcId string

    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

    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 ARN for the DB Cluster Snapshot.

    engine str

    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

    Status of this DB Cluster Snapshot.

    storage_encrypted bool

    Whether the DB cluster snapshot is encrypted.

    tags Mapping[str, str]

    Map of tags for the resource.

    vpc_id str

    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

    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 ARN for the DB Cluster Snapshot.

    engine String

    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

    Status of this DB Cluster Snapshot.

    storageEncrypted Boolean

    Whether the DB cluster snapshot is encrypted.

    tags Map<String>

    Map of tags for the resource.

    vpcId String

    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
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes

    This Pulumi package is based on the aws Terraform Provider.

    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.3.0 published on Thursday, Sep 28, 2023 by Pulumi