AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi
aws.rds.getClusterSnapshot
Explore with Pulumi AI
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")
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
})
}
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 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.applyValue(getClusterSnapshotResult -> getClusterSnapshotResult.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
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:
- Db
Cluster stringIdentifier - Returns the list of snapshots created by the specific db_cluster
- Db
Cluster stringSnapshot Identifier - 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
. - 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 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
andawsbackup
. - Dictionary<string, string>
- Mapping of tags, each pair of which must exactly match a pair on the desired DB cluster snapshot.
- Db
Cluster stringIdentifier - Returns the list of snapshots created by the specific db_cluster
- Db
Cluster stringSnapshot Identifier - 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
. - 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 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
andawsbackup
. - map[string]string
- Mapping of tags, each pair of which must exactly match a pair on the desired DB cluster snapshot.
- db
Cluster StringIdentifier - Returns the list of snapshots created by the specific db_cluster
- db
Cluster StringSnapshot Identifier - Returns information on a specific snapshot_id.
- include
Public 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
. - 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
. - most
Recent Boolean - If more than one result is returned, use the most recent Snapshot.
- snapshot
Type 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
andawsbackup
. - Map<String,String>
- Mapping of tags, each pair of which must exactly match a pair on the desired DB cluster snapshot.
- db
Cluster stringIdentifier - Returns the list of snapshots created by the specific db_cluster
- db
Cluster stringSnapshot Identifier - Returns information on a specific snapshot_id.
- include
Public 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
. - 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
. - most
Recent boolean - If more than one result is returned, use the most recent Snapshot.
- snapshot
Type 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
andawsbackup
. - {[key: string]: string}
- Mapping of tags, each pair of which must exactly match a pair on the desired DB cluster snapshot.
- db_
cluster_ stridentifier - Returns the list of snapshots created by the specific db_cluster
- db_
cluster_ strsnapshot_ identifier - 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
. - 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
andawsbackup
. - Mapping[str, str]
- Mapping of tags, each pair of which must exactly match a pair on the desired DB cluster snapshot.
- db
Cluster StringIdentifier - Returns the list of snapshots created by the specific db_cluster
- db
Cluster StringSnapshot Identifier - Returns information on a specific snapshot_id.
- include
Public 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
. - 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
. - most
Recent Boolean - If more than one result is returned, use the most recent Snapshot.
- snapshot
Type 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
andawsbackup
. - 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:
- Allocated
Storage int - Allocated storage size in gigabytes (GB).
- Availability
Zones List<string> - List of EC2 Availability Zones that instances in the DB cluster snapshot can be restored in.
- Db
Cluster stringSnapshot Arn - The ARN for the DB Cluster Snapshot.
- Engine string
- Name of the database engine.
- Engine
Version string - Version of the database engine for this DB cluster snapshot.
- Id string
- The provider-assigned unique ID for this managed resource.
- Kms
Key stringId - If storage_encrypted is true, the AWS KMS key identifier for the encrypted DB cluster snapshot.
- License
Model 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.
- Snapshot
Create stringTime - Time when the snapshot was taken, in Universal Coordinated Time (UTC).
- Source
Db stringCluster Snapshot Arn - Status string
- Status of this DB Cluster Snapshot.
- Storage
Encrypted bool - Whether the DB cluster snapshot is encrypted.
- Dictionary<string, string>
- Map of tags for the resource.
- Vpc
Id string - VPC ID associated with the DB cluster snapshot.
- Db
Cluster stringIdentifier - Specifies the DB cluster identifier of the DB cluster that this DB cluster snapshot was created from.
- Db
Cluster stringSnapshot Identifier - Include
Public bool - bool
- Most
Recent bool - Snapshot
Type string
- Allocated
Storage int - Allocated storage size in gigabytes (GB).
- Availability
Zones []string - List of EC2 Availability Zones that instances in the DB cluster snapshot can be restored in.
- Db
Cluster stringSnapshot Arn - The ARN for the DB Cluster Snapshot.
- Engine string
- Name of the database engine.
- Engine
Version string - Version of the database engine for this DB cluster snapshot.
- Id string
- The provider-assigned unique ID for this managed resource.
- Kms
Key stringId - If storage_encrypted is true, the AWS KMS key identifier for the encrypted DB cluster snapshot.
- License
Model 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.
- Snapshot
Create stringTime - Time when the snapshot was taken, in Universal Coordinated Time (UTC).
- Source
Db stringCluster Snapshot Arn - Status string
- Status of this DB Cluster Snapshot.
- Storage
Encrypted bool - Whether the DB cluster snapshot is encrypted.
- map[string]string
- Map of tags for the resource.
- Vpc
Id string - VPC ID associated with the DB cluster snapshot.
- Db
Cluster stringIdentifier - Specifies the DB cluster identifier of the DB cluster that this DB cluster snapshot was created from.
- Db
Cluster stringSnapshot Identifier - Include
Public bool - bool
- Most
Recent bool - Snapshot
Type string
- allocated
Storage Integer - Allocated storage size in gigabytes (GB).
- availability
Zones List<String> - List of EC2 Availability Zones that instances in the DB cluster snapshot can be restored in.
- db
Cluster StringSnapshot Arn - The ARN for the DB Cluster Snapshot.
- engine String
- Name of the database engine.
- engine
Version String - Version of the database engine for this DB cluster snapshot.
- id String
- The provider-assigned unique ID for this managed resource.
- kms
Key StringId - If storage_encrypted is true, the AWS KMS key identifier for the encrypted DB cluster snapshot.
- license
Model 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.
- snapshot
Create StringTime - Time when the snapshot was taken, in Universal Coordinated Time (UTC).
- source
Db StringCluster Snapshot Arn - status String
- Status of this DB Cluster Snapshot.
- storage
Encrypted Boolean - Whether the DB cluster snapshot is encrypted.
- Map<String,String>
- Map of tags for the resource.
- vpc
Id String - VPC ID associated with the DB cluster snapshot.
- db
Cluster StringIdentifier - Specifies the DB cluster identifier of the DB cluster that this DB cluster snapshot was created from.
- db
Cluster StringSnapshot Identifier - include
Public Boolean - Boolean
- most
Recent Boolean - snapshot
Type String
- allocated
Storage number - Allocated storage size in gigabytes (GB).
- availability
Zones string[] - List of EC2 Availability Zones that instances in the DB cluster snapshot can be restored in.
- db
Cluster stringSnapshot Arn - The ARN for the DB Cluster Snapshot.
- engine string
- Name of the database engine.
- engine
Version string - Version of the database engine for this DB cluster snapshot.
- id string
- The provider-assigned unique ID for this managed resource.
- kms
Key stringId - If storage_encrypted is true, the AWS KMS key identifier for the encrypted DB cluster snapshot.
- license
Model 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.
- snapshot
Create stringTime - Time when the snapshot was taken, in Universal Coordinated Time (UTC).
- source
Db stringCluster Snapshot Arn - status string
- Status of this DB Cluster Snapshot.
- storage
Encrypted boolean - Whether the DB cluster snapshot is encrypted.
- {[key: string]: string}
- Map of tags for the resource.
- vpc
Id string - VPC ID associated with the DB cluster snapshot.
- db
Cluster stringIdentifier - Specifies the DB cluster identifier of the DB cluster that this DB cluster snapshot was created from.
- db
Cluster stringSnapshot Identifier - include
Public boolean - boolean
- most
Recent boolean - snapshot
Type 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_ strsnapshot_ arn - 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_ strid - 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_ strtime - Time when the snapshot was taken, in Universal Coordinated Time (UTC).
- source_
db_ strcluster_ snapshot_ arn - status str
- Status of this DB Cluster Snapshot.
- storage_
encrypted bool - Whether the DB cluster snapshot is encrypted.
- Mapping[str, str]
- Map of tags for the resource.
- vpc_
id str - VPC ID associated with the DB cluster snapshot.
- db_
cluster_ stridentifier - Specifies the DB cluster identifier of the DB cluster that this DB cluster snapshot was created from.
- db_
cluster_ strsnapshot_ identifier - include_
public bool - bool
- most_
recent bool - snapshot_
type str
- allocated
Storage Number - Allocated storage size in gigabytes (GB).
- availability
Zones List<String> - List of EC2 Availability Zones that instances in the DB cluster snapshot can be restored in.
- db
Cluster StringSnapshot Arn - The ARN for the DB Cluster Snapshot.
- engine String
- Name of the database engine.
- engine
Version String - Version of the database engine for this DB cluster snapshot.
- id String
- The provider-assigned unique ID for this managed resource.
- kms
Key StringId - If storage_encrypted is true, the AWS KMS key identifier for the encrypted DB cluster snapshot.
- license
Model 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.
- snapshot
Create StringTime - Time when the snapshot was taken, in Universal Coordinated Time (UTC).
- source
Db StringCluster Snapshot Arn - status String
- Status of this DB Cluster Snapshot.
- storage
Encrypted Boolean - Whether the DB cluster snapshot is encrypted.
- Map<String>
- Map of tags for the resource.
- vpc
Id String - VPC ID associated with the DB cluster snapshot.
- db
Cluster StringIdentifier - Specifies the DB cluster identifier of the DB cluster that this DB cluster snapshot was created from.
- db
Cluster StringSnapshot Identifier - include
Public Boolean - Boolean
- most
Recent Boolean - snapshot
Type String
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.