Snapshot Copy
Manages an RDS database instance snapshot copy. For managing RDS database cluster snapshots, see the aws.rds.ClusterSnapshot
resource.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.rds.Instance("example", {
allocatedStorage: 10,
engine: "mysql",
engineVersion: "5.6.21",
instanceClass: aws.rds.InstanceType.T2_Micro,
dbName: "baz",
password: "barbarbarbar",
username: "foo",
maintenanceWindow: "Fri:09:00-Fri:09:30",
backupRetentionPeriod: 0,
parameterGroupName: "default.mysql5.6",
});
const exampleSnapshot = new aws.rds.Snapshot("example", {
dbInstanceIdentifier: example.identifier,
dbSnapshotIdentifier: "testsnapshot1234",
});
const exampleSnapshotCopy = new aws.rds.SnapshotCopy("example", {
sourceDbSnapshotIdentifier: exampleSnapshot.dbSnapshotArn,
targetDbSnapshotIdentifier: "testsnapshot1234-copy",
});
import pulumi
import pulumi_aws as aws
example = aws.rds.Instance("example",
allocated_storage=10,
engine="mysql",
engine_version="5.6.21",
instance_class=aws.rds.InstanceType.T2_MICRO,
db_name="baz",
password="barbarbarbar",
username="foo",
maintenance_window="Fri:09:00-Fri:09:30",
backup_retention_period=0,
parameter_group_name="default.mysql5.6")
example_snapshot = aws.rds.Snapshot("example",
db_instance_identifier=example.identifier,
db_snapshot_identifier="testsnapshot1234")
example_snapshot_copy = aws.rds.SnapshotCopy("example",
source_db_snapshot_identifier=example_snapshot.db_snapshot_arn,
target_db_snapshot_identifier="testsnapshot1234-copy")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Rds.Instance("example", new()
{
AllocatedStorage = 10,
Engine = "mysql",
EngineVersion = "5.6.21",
InstanceClass = Aws.Rds.InstanceType.T2_Micro,
DbName = "baz",
Password = "barbarbarbar",
Username = "foo",
MaintenanceWindow = "Fri:09:00-Fri:09:30",
BackupRetentionPeriod = 0,
ParameterGroupName = "default.mysql5.6",
});
var exampleSnapshot = new Aws.Rds.Snapshot("example", new()
{
DbInstanceIdentifier = example.Identifier,
DbSnapshotIdentifier = "testsnapshot1234",
});
var exampleSnapshotCopy = new Aws.Rds.SnapshotCopy("example", new()
{
SourceDbSnapshotIdentifier = exampleSnapshot.DbSnapshotArn,
TargetDbSnapshotIdentifier = "testsnapshot1234-copy",
});
});
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 {
example, err := rds.NewInstance(ctx, "example", &rds.InstanceArgs{
AllocatedStorage: pulumi.Int(10),
Engine: pulumi.String("mysql"),
EngineVersion: pulumi.String("5.6.21"),
InstanceClass: pulumi.String(rds.InstanceType_T2_Micro),
DbName: pulumi.String("baz"),
Password: pulumi.String("barbarbarbar"),
Username: pulumi.String("foo"),
MaintenanceWindow: pulumi.String("Fri:09:00-Fri:09:30"),
BackupRetentionPeriod: pulumi.Int(0),
ParameterGroupName: pulumi.String("default.mysql5.6"),
})
if err != nil {
return err
}
exampleSnapshot, err := rds.NewSnapshot(ctx, "example", &rds.SnapshotArgs{
DbInstanceIdentifier: example.Identifier,
DbSnapshotIdentifier: pulumi.String("testsnapshot1234"),
})
if err != nil {
return err
}
_, err = rds.NewSnapshotCopy(ctx, "example", &rds.SnapshotCopyArgs{
SourceDbSnapshotIdentifier: exampleSnapshot.DbSnapshotArn,
TargetDbSnapshotIdentifier: pulumi.String("testsnapshot1234-copy"),
})
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.Instance;
import com.pulumi.aws.rds.InstanceArgs;
import com.pulumi.aws.rds.Snapshot;
import com.pulumi.aws.rds.SnapshotArgs;
import com.pulumi.aws.rds.SnapshotCopy;
import com.pulumi.aws.rds.SnapshotCopyArgs;
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 example = new Instance("example", InstanceArgs.builder()
.allocatedStorage(10)
.engine("mysql")
.engineVersion("5.6.21")
.instanceClass("db.t2.micro")
.dbName("baz")
.password("barbarbarbar")
.username("foo")
.maintenanceWindow("Fri:09:00-Fri:09:30")
.backupRetentionPeriod(0)
.parameterGroupName("default.mysql5.6")
.build());
var exampleSnapshot = new Snapshot("exampleSnapshot", SnapshotArgs.builder()
.dbInstanceIdentifier(example.identifier())
.dbSnapshotIdentifier("testsnapshot1234")
.build());
var exampleSnapshotCopy = new SnapshotCopy("exampleSnapshotCopy", SnapshotCopyArgs.builder()
.sourceDbSnapshotIdentifier(exampleSnapshot.dbSnapshotArn())
.targetDbSnapshotIdentifier("testsnapshot1234-copy")
.build());
}
}
resources:
example:
type: aws:rds:Instance
properties:
allocatedStorage: 10
engine: mysql
engineVersion: 5.6.21
instanceClass: db.t2.micro
dbName: baz
password: barbarbarbar
username: foo
maintenanceWindow: Fri:09:00-Fri:09:30
backupRetentionPeriod: 0
parameterGroupName: default.mysql5.6
exampleSnapshot:
type: aws:rds:Snapshot
name: example
properties:
dbInstanceIdentifier: ${example.identifier}
dbSnapshotIdentifier: testsnapshot1234
exampleSnapshotCopy:
type: aws:rds:SnapshotCopy
name: example
properties:
sourceDbSnapshotIdentifier: ${exampleSnapshot.dbSnapshotArn}
targetDbSnapshotIdentifier: testsnapshot1234-copy
Import
Using pulumi import
, import aws_db_snapshot_copy
using the snapshot identifier. For example:
$ pulumi import aws:rds/snapshotCopy:SnapshotCopy example my-snapshot
Properties
Specifies the allocated storage size in gigabytes (GB).
Specifies the name of the Availability Zone the DB instance was located in at the time of the DB snapshot.
The Amazon Resource Name (ARN) for the DB snapshot.
The Destination region to place snapshot copy.
Specifies the version of the database engine.
License model information for the restored DB instance.
The name of an option group to associate with the copy of the snapshot.
he URL that contains a Signature Version 4 signed request.
List of AWS Account IDs to share the snapshot with. Use all
to make the snapshot public.
Snapshot identifier of the source snapshot.
The region that the DB snapshot was created in or copied from.
Specifies the storage type associated with DB snapshot.
The external custom Availability Zone.
The Identifier for the snapshot.