GetSnapshot
Use this data source to get information about a DB Snapshot for use when provisioning DB instances
NOTE: This data source does not apply to snapshots created on Aurora DB clusters. See the
aws.rds.ClusterSnapshotdata source for DB Cluster snapshots.
Example Usage
Coming soon!
Coming soon!
import pulumi
import pulumi_aws as aws
prod = aws.rds.Instance("prod",
allocated_storage=10,
db_subnet_group_name="my_database_subnet_group",
engine="mysql",
engine_version="5.6.17",
instance_class="db.t2.micro",
name="mydb",
parameter_group_name="default.mysql5.6",
password="bar",
username="foo")
latest_prod_snapshot = prod.id.apply(lambda id: aws.rds.get_snapshot(db_instance_identifier=id,
most_recent=True))
# Use the latest production snapshot to create a dev instance.
dev = aws.rds.Instance("dev",
instance_class="db.t2.micro",
lifecycle={
"ignoreChanges": ["snapshotIdentifier"],
},
name="mydbdev",
snapshot_identifier=latest_prod_snapshot.id)import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const prod = new aws.rds.Instance("prod", {
allocatedStorage: 10,
dbSubnetGroupName: "my_database_subnet_group",
engine: "mysql",
engineVersion: "5.6.17",
instanceClass: "db.t2.micro",
name: "mydb",
parameterGroupName: "default.mysql5.6",
password: "bar",
username: "foo",
});
const latestProdSnapshot = prod.id.apply(id => aws.rds.getSnapshot({
dbInstanceIdentifier: id,
mostRecent: true,
}, { async: true }));
// Use the latest production snapshot to create a dev instance.
const dev = new aws.rds.Instance("dev", {
instanceClass: "db.t2.micro",
name: "mydbdev",
snapshotIdentifier: latestProdSnapshot.id,
}, { ignoreChanges: ["snapshotIdentifier"] });Using GetSnapshot
function getSnapshot(args: GetSnapshotArgs, opts?: InvokeOptions): Promise<GetSnapshotResult>function get_snapshot(db_instance_identifier=None, db_snapshot_identifier=None, include_public=None, include_shared=None, most_recent=None, snapshot_type=None, opts=None)func LookupSnapshot(ctx *Context, args *LookupSnapshotArgs, opts ...InvokeOption) (*LookupSnapshotResult, error)Note: This function is named
LookupSnapshotin the Go SDK.
public static class GetSnapshot {
public static Task<GetSnapshotResult> InvokeAsync(GetSnapshotArgs args, InvokeOptions? opts = null)
}The following arguments are supported:
- Db
Instance stringIdentifier Returns the list of snapshots created by the specific db_instance
- Db
Snapshot stringIdentifier Returns information on a specific snapshot_id.
- Include
Public bool Set this value to true to include manual DB 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 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 The type of snapshots to be returned. If you don’t specify a SnapshotType value, then both automated and manual snapshots are returned. Shared and public DB snapshots are not included in the returned results by default. Possible values are,
automated,manual,sharedandpublic.
- Db
Instance stringIdentifier Returns the list of snapshots created by the specific db_instance
- Db
Snapshot stringIdentifier Returns information on a specific snapshot_id.
- Include
Public bool Set this value to true to include manual DB 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 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 The type of snapshots to be returned. If you don’t specify a SnapshotType value, then both automated and manual snapshots are returned. Shared and public DB snapshots are not included in the returned results by default. Possible values are,
automated,manual,sharedandpublic.
- db
Instance stringIdentifier Returns the list of snapshots created by the specific db_instance
- db
Snapshot stringIdentifier Returns information on a specific snapshot_id.
- include
Public boolean Set this value to true to include manual DB 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 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 The type of snapshots to be returned. If you don’t specify a SnapshotType value, then both automated and manual snapshots are returned. Shared and public DB snapshots are not included in the returned results by default. Possible values are,
automated,manual,sharedandpublic.
- db_
instance_ stridentifier Returns the list of snapshots created by the specific db_instance
- db_
snapshot_ stridentifier Returns information on a specific snapshot_id.
- include_
public bool Set this value to true to include manual DB 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 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 snapshots are returned. Shared and public DB snapshots are not included in the returned results by default. Possible values are,
automated,manual,sharedandpublic.
GetSnapshot Result
The following output properties are available:
- Allocated
Storage int Specifies the allocated storage size in gigabytes (GB).
- Availability
Zone string Specifies the name of the Availability Zone the DB instance was located in at the time of the DB snapshot.
- Db
Snapshot stringArn The Amazon Resource Name (ARN) for the DB snapshot.
- Encrypted bool
Specifies whether the DB snapshot is encrypted.
- Engine string
Specifies the name of the database engine.
- Engine
Version string Specifies the version of the database engine.
- Id string
The provider-assigned unique ID for this managed resource.
- Iops int
Specifies the Provisioned IOPS (I/O operations per second) value of the DB instance at the time of the snapshot.
- Kms
Key stringId The ARN for the KMS encryption key.
- License
Model string License model information for the restored DB instance.
- Option
Group stringName Provides the option group name for the DB snapshot.
- Port int
- Snapshot
Create stringTime Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC).
- Source
Db stringSnapshot Identifier The DB snapshot Arn that the DB snapshot was copied from. It only has value in case of cross customer or cross region copy.
- Source
Region string The region that the DB snapshot was created in or copied from.
- Status string
Specifies the status of this DB snapshot.
- Storage
Type string Specifies the storage type associated with DB snapshot.
- Vpc
Id string Specifies the ID of the VPC associated with the DB snapshot.
- Db
Instance stringIdentifier - Db
Snapshot stringIdentifier - Include
Public bool - bool
- Most
Recent bool - Snapshot
Type string
- Allocated
Storage int Specifies the allocated storage size in gigabytes (GB).
- Availability
Zone string Specifies the name of the Availability Zone the DB instance was located in at the time of the DB snapshot.
- Db
Snapshot stringArn The Amazon Resource Name (ARN) for the DB snapshot.
- Encrypted bool
Specifies whether the DB snapshot is encrypted.
- Engine string
Specifies the name of the database engine.
- Engine
Version string Specifies the version of the database engine.
- Id string
The provider-assigned unique ID for this managed resource.
- Iops int
Specifies the Provisioned IOPS (I/O operations per second) value of the DB instance at the time of the snapshot.
- Kms
Key stringId The ARN for the KMS encryption key.
- License
Model string License model information for the restored DB instance.
- Option
Group stringName Provides the option group name for the DB snapshot.
- Port int
- Snapshot
Create stringTime Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC).
- Source
Db stringSnapshot Identifier The DB snapshot Arn that the DB snapshot was copied from. It only has value in case of cross customer or cross region copy.
- Source
Region string The region that the DB snapshot was created in or copied from.
- Status string
Specifies the status of this DB snapshot.
- Storage
Type string Specifies the storage type associated with DB snapshot.
- Vpc
Id string Specifies the ID of the VPC associated with the DB snapshot.
- Db
Instance stringIdentifier - Db
Snapshot stringIdentifier - Include
Public bool - bool
- Most
Recent bool - Snapshot
Type string
- allocated
Storage number Specifies the allocated storage size in gigabytes (GB).
- availability
Zone string Specifies the name of the Availability Zone the DB instance was located in at the time of the DB snapshot.
- db
Snapshot stringArn The Amazon Resource Name (ARN) for the DB snapshot.
- encrypted boolean
Specifies whether the DB snapshot is encrypted.
- engine string
Specifies the name of the database engine.
- engine
Version string Specifies the version of the database engine.
- id string
The provider-assigned unique ID for this managed resource.
- iops number
Specifies the Provisioned IOPS (I/O operations per second) value of the DB instance at the time of the snapshot.
- kms
Key stringId The ARN for the KMS encryption key.
- license
Model string License model information for the restored DB instance.
- option
Group stringName Provides the option group name for the DB snapshot.
- port number
- snapshot
Create stringTime Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC).
- source
Db stringSnapshot Identifier The DB snapshot Arn that the DB snapshot was copied from. It only has value in case of cross customer or cross region copy.
- source
Region string The region that the DB snapshot was created in or copied from.
- status string
Specifies the status of this DB snapshot.
- storage
Type string Specifies the storage type associated with DB snapshot.
- vpc
Id string Specifies the ID of the VPC associated with the DB snapshot.
- db
Instance stringIdentifier - db
Snapshot stringIdentifier - include
Public boolean - boolean
- most
Recent boolean - snapshot
Type string
- allocated_
storage float Specifies the allocated storage size in gigabytes (GB).
- availability_
zone str Specifies the name of the Availability Zone the DB instance was located in at the time of the DB snapshot.
- db_
snapshot_ strarn The Amazon Resource Name (ARN) for the DB snapshot.
- encrypted bool
Specifies whether the DB snapshot is encrypted.
- engine str
Specifies the name of the database engine.
- engine_
version str Specifies the version of the database engine.
- id str
The provider-assigned unique ID for this managed resource.
- iops float
Specifies the Provisioned IOPS (I/O operations per second) value of the DB instance at the time of the snapshot.
- kms_
key_ strid The ARN for the KMS encryption key.
- license_
model str License model information for the restored DB instance.
- option_
group_ strname Provides the option group name for the DB snapshot.
- port float
- snapshot_
create_ strtime Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC).
- source_
db_ strsnapshot_ identifier The DB snapshot Arn that the DB snapshot was copied from. It only has value in case of cross customer or cross region copy.
- source_
region str The region that the DB snapshot was created in or copied from.
- status str
Specifies the status of this DB snapshot.
- storage_
type str Specifies the storage type associated with DB snapshot.
- vpc_
id str Specifies the ID of the VPC associated with the DB snapshot.
- db_
instance_ stridentifier - db_
snapshot_ stridentifier - include_
public bool - bool
- most_
recent bool - snapshot_
type str
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.