SnapshotCopy class

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/v7/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
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_rds_instance" "example" {
  allocated_storage       = 10
  engine                  = "mysql"
  engine_version          = "5.6.21"
  instance_class          = "db.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"
}
resource "aws_rds_snapshot" "example" {
  db_instance_identifier = aws_rds_instance.example.identifier
  db_snapshot_identifier = "testsnapshot1234"
}
resource "aws_rds_snapshotcopy" "example" {
  source_db_snapshot_identifier = aws_rds_snapshot.example.db_snapshot_arn
  target_db_snapshot_identifier = "testsnapshot1234-copy"
}
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.ArrayList;
import java.util.Arrays;
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.rds.SnapshotCopy using the snapshot identifier. For example:

$ pulumi import aws:rds/snapshotCopy:SnapshotCopy example my-snapshot

Constructors

SnapshotCopy(String name, {SnapshotCopyArgs? args, CustomResourceOptions? options})
Creates a new SnapshotCopy. name The Pulumi resource name. args Arguments used to configure this SnapshotCopy. The set of arguments for SnapshotCopy. options Resource options controlling this resource's behavior.
SnapshotCopy.reference(String urn)
Creates a typed reference to an existing SnapshotCopy resource.

Properties

allocatedStorage ↔ Output<int>
Specifies the allocated storage size in gigabytes (GB).
latefinal
availabilityZone ↔ Output<String>
Specifies the name of the Availability Zone the DB instance was located in at the time of the DB snapshot.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
copyTags ↔ Output<bool?>
Whether to copy existing tags. Defaults to false.
latefinal
dbSnapshotArn ↔ Output<String>
ARN for the DB snapshot.
latefinal
destinationRegion ↔ Output<String?>
The Destination region to place snapshot copy.
latefinal
encrypted ↔ Output<bool>
Specifies whether the DB snapshot is encrypted.
latefinal
engine ↔ Output<String>
Specifies the name of the database engine.
latefinal
engineVersion ↔ Output<String>
Specifies the version of the database engine.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
iops ↔ Output<int>
Specifies the Provisioned IOPS (I/O operations per second) value of the DB instance at the time of the snapshot.
latefinal
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
kmsKeyId ↔ Output<String?>
KMS key ID.
latefinal
licenseModel ↔ Output<String>
License model information for the restored DB instance.
latefinal
optionGroupName ↔ Output<String>
The name of an option group to associate with the copy of the snapshot.
latefinal
port ↔ Output<int>
latefinal
presignedUrl ↔ Output<String?>
he URL that contains a Signature Version 4 signed request.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sharedAccounts ↔ Output<List<String>?>
List of AWS Account IDs to share the snapshot with. Use all to make the snapshot public.
latefinal
snapshotType ↔ Output<String>
latefinal
sourceDbSnapshotIdentifier ↔ Output<String>
Snapshot identifier of the source snapshot.
latefinal
sourceRegion ↔ Output<String>
The region that the DB snapshot was created in or copied from.
latefinal
storageType ↔ Output<String>
Specifies the storage type associated with DB snapshot.
latefinal
tags ↔ Output<Map<String, String>?>
Key-value map of resource tags. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
latefinal
tagsAll ↔ Output<Map<String, String>>
A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
targetCustomAvailabilityZone ↔ Output<String?>
The external custom Availability Zone.
latefinal
targetDbSnapshotIdentifier ↔ Output<String>
The Identifier for the snapshot.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited
vpcId ↔ Output<String>
Provides the VPC ID associated with the DB snapshot.
latefinal

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {SnapshotCopyState? state, CustomResourceOptions? options}) → SnapshotCopy
Gets an existing SnapshotCopy resource's state with the given name and id.