get Snapshot
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.ClusterSnapshot
data source for DB Cluster snapshots.
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.rds.Instance;
import com.pulumi.aws.rds.InstanceArgs;
import com.pulumi.aws.rds.RdsFunctions;
import com.pulumi.aws.rds.inputs.GetSnapshotArgs;
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) {
var prod = new Instance("prod", InstanceArgs.builder()
.allocatedStorage(10)
.engine("mysql")
.engineVersion("5.6.17")
.instanceClass("db.t2.micro")
.name("mydb")
.username("foo")
.password("bar")
.dbSubnetGroupName("my_database_subnet_group")
.parameterGroupName("default.mysql5.6")
.build());
final var latestProdSnapshot = RdsFunctions.getSnapshot(GetSnapshotArgs.builder()
.dbInstanceIdentifier(prod.id())
.mostRecent(true)
.build());
var dev = new Instance("dev", InstanceArgs.builder()
.instanceClass("db.t2.micro")
.name("mydbdev")
.snapshotIdentifier(latestProdSnapshot.applyValue(getSnapshotResult -> getSnapshotResult).applyValue(latestProdSnapshot -> latestProdSnapshot.applyValue(getSnapshotResult -> getSnapshotResult.id())))
.build());
}
}
Return
A collection of values returned by getSnapshot.
Parameters
A collection of arguments for invoking getSnapshot.
Return
A collection of values returned by getSnapshot.
Parameters
Returns the list of snapshots created by the specific db_instance
Returns information on a specific snapshot_id.
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
.
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
.
If more than one result is returned, use the most recent Snapshot.
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
, shared
, public
and awsbackup
.
See also
Return
A collection of values returned by getSnapshot.
Parameters
Builder for com.pulumi.aws.rds.kotlin.inputs.GetSnapshotPlainArgs.