Working with snapshots and recovery points - Amazon Redshift
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Working with snapshots and recovery points

A backup in Amazon Redshift Serverless is a point-in-time representation of the objects and data in your namespace. There are two types of backups: snapshots that are manually created and recovery points that Amazon Redshift Serverless automatically creates for you. Recovery points are created every 30 minutes and are kept for 24 hours.

If you find that you want to retrieve the data in a snapshot or a recovery point, you can restore a snapshot to a serverless namespace or to a provisioned cluster. There are three scenarios in which you can restore snapshots:

  • Restore a serverless snapshot to a serverless namespace.

  • Restore a serverless snapshot to a provisioned cluster.

  • Restore a provisioned cluster snapshot to a serverless namespace.

When you restore a serverless snapshot to a provisioned cluster, you must choose the node type to use, such as RA3, and the number of nodes, letting you control settings at the cluster or node level.

To restore a provisioned cluster snapshot to a serverless namespace, start from the Redshift provisioned console, choose the snapshot to restore, then choose Restore from snapshot, Restore to serverless namespace. Amazon Redshift converts tables with interleaved keys into compound sort keys when you restore a provisioned cluster snapshot to a serverless namespace. For more information about sort keys, see Working with sort keys.

If you want to add additional context, you can tag snapshots and recovery points with key-value pairs that provide metadata and information to snapshots and recovery points. For more information about tagging resources, see Tagging resources overview.

Finally, you can also share snapshots with other Amazon accounts, which lets them access data within the snapshot and run queries.

Snapshots

You can restore a snapshot that you created on the Amazon Redshift Serverless console to an available namespace that's associated with a workgroup. A namespace is available once it is ready for querying and/or modifying. You can restore a snapshot encrypted with an Amazon managed KMS key to a serverless namespace.

To see a list of all of your snapshots, on the Amazon Redshift Serverless console, choose Data backup.

To create a snapshot
  1. On the Amazon Redshift Serverless console, choose Data backup.

  2. Choose Create snapshot.

  3. Choose a namespace to create a snapshot of.

  4. Enter a snapshot identifier.

  5. (Optional) Choose a retention period. If you choose Custom value, choose the number of days. The amount you choose must be between 1-3653 days, inclusive. The default is retain indefinitely.

  6. Choose Create.

To create a snapshot from namespace configuration
  1. On the Amazon Redshift Serverless console, choose Namespace configuration.

  2. Choose the namespace to create a snapshot of. You can only create snapshots of namespaces that are associated with a workgroup and whose statuses are Available.

  3. Choose the Data backup tab.

  4. Choose Create snapshot.

  5. Enter a snapshot identifier.

  6. (Optional) Choose a retention period. If you choose Custom value, choose the number of days. The amount you choose must be between 1-3653 days, inclusive.

  7. Choose Create.

To update a snapshot's retention period
  1. On the Amazon Redshift Serverless console, choose Data backup.

  2. Choose a snapshot to update.

  3. Choose Actions, Set manual snapshot settings.

  4. Choose a retention period. If you choose Custom value, choose the number of days.

  5. Choose Save changes.

To delete a snapshot
Note

You can't delete a snapshot that's been shared with another account. You must first remove that account's access to the snapshot before deleting the snapshot.

  1. On the Amazon Redshift Serverless console, choose Data backup.

  2. Choose a snapshot to delete.

  3. Choose Actions, Delete.

  4. Choose Delete.

To create a final snapshot of all data within a namespace before deleting the namespace.
  1. On the Amazon Redshift Serverless console, choose Namespace configuration.

  2. Choose the namespace to delete.

  3. Choose Actions, Delete.

  4. Choose Create final snapshot.

  5. Enter a name for the snapshot.

  6. Enter delete.

  7. Choose Delete.

To share a snapshot with another Amazon account or remove an account's access to a snapshot
  1. On the Amazon Redshift Serverless console, choose Data backup.

  2. Choose a snapshot to share.

  3. Choose Actions, Manage access.

  4. To share a snapshot with another account, enter an Amazon Web Services account ID. To remove access from an account, choose Remove.

  5. Choose Save changes.

Restoring a snapshot

Restoring a snapshot to a serverless namespace replaces the current database with the database in the snapshot.

Restoring a snapshot to a serverless namespace is completed in two phases. The first phase completes in a few minutes, restores the data to your namespace, and makes it available for queries. The second phase of restoration is where your database is tuned, which can cause minor performance issues. This second phase can last from a few hours to several days, and in some cases, a couple of weeks. The amount of time depends on the size of the data, but performance progressively improves as the database gets tuned. At the end of this phase, your serverless namespace is fully tuned, and you can submit queries without performance issues.

To restore a snapshot to a serverless namespace
  1. On the Amazon Redshift Serverless console, choose Data backup.

  2. Choose the snapshot to restore. You can only restore one snapshot at a time.

  3. Choose Actions, Restore to serverless namespace.

  4. Choose an available namespace to restore to. You can only restore to namespaces whose statuses are Available.

  5. Choose Restore.

To restore a snapshot to a provisioned cluster
  1. On the Amazon Redshift Serverless console, choose Data backup.

  2. Choose a snapshot to restore.

  3. Choose Action, Restore to provisioned cluster.

  4. Enter a cluster identifier.

  5. Choose a Node type. The number of nodes depends on the node type.

  6. Follow the instructions on the page on the console page to enter the properties for Cluster configuration. See Creating a cluster for more information.

For more information about snapshots on provisioned clusters, see Amazon Redshift snapshots and backups.

Recovery points

Recovery points in Amazon Redshift Serverless are created approximately every 30 minutes and saved for 24 hours.

On the Amazon Redshift Serverless console, choose Data backup to manage recovery points. You can do the following operations:

  • Restore a recovery point to a serverless namespace.

  • Convert a recovery point to a snapshot.

To restore a recovery point to a serverless namespace
  1. On the Amazon Redshift Serverless console, choose Data backup.

  2. Under Recovery points, choose the Creation time of the recovery point that you want to restore.

  3. Choose Restore. You can only restore to namespaces whose statuses are Available.

  4. Enter restore in the text input field and choose Restore.

To convert a recovery point to a snapshot
  1. On the Amazon Redshift Serverless console, choose Data backup.

  2. Under Recovery points, choose the Creation time of the recovery point that you want to convert to a snapshot.

  3. Choose Create snapshot from recovery point.

  4. Enter a Snapshot identifier.

  5. Choose Create.

Scheduling snapshots

To precisely control when to take a snapshot, you can create a snapshot schedule for specific namepsaces. When scheduling snapshot creation, you can create either a one-time event or use Unix cron expressions to create a recurring schedule. Cron expressions support three fields and are separated by white space.

cron(Minutes Hours Day-of-month Month Day-of-week Year)
Fields Values Wildcards

Minutes

0–59

, - * /

Hours

0–23

, - * /

Day-of-month

1–31

, - * ? / L W

Month

1–12 or JAN-DEC

, - * /

Day-of-week

1–7 or SUN-SAT

, - * ? L #

Year

1970–2199

, - * /

Wildcards
  • The , (comma) wildcard includes additional values. In the Day-of-week field, MON,WED,FRI would include Monday, Wednesday, and Friday. Total values are limited to 24 per field.

  • The - (dash) wildcard specifies ranges. In the Hour field, 1–15 would include hours 1 through 15 of the specified day.

  • The * (asterisk) wildcard includes all values in the field. In the Hours field, * would include every hour.

  • The / (forward slash) wildcard specifies increments. In the Hours field, you could enter 1/10 to specify every 10th hour, starting from the first hour of the day (for example, the 01:00, 11:00, and 21:00).

  • The ? (question mark) wildcard specifies one or another. In the Day-of-month field you could enter 7, and if you didn't care what day of the week the seventh was, you could enter ? in the Day-of-week field.

  • The L wildcard in the Day-of-month or Day-of-week fields specifies the last day of the month or week.

  • The W wildcard in the Day-of-month field specifies a weekday. In the Day-of-month field, 3W specifies the day closest to the third weekday of the month.

  • The # wildcard in the Day-of-week field specifies a certain instance of the specified day of the week within a month. For example, 3#2 would be the second Tuesday of the month: the 3 refers to Tuesday because it is the third day of each week, and the 2 refers to the second day of that type within the month.

    Note

    If you use a '#' character, you can define only one expression in the day-of-week field. For example, "3#1,6#3" is not valid because it is interpreted as two expressions.

Limits
  • You can't specify the Day-of-month and Day-of-week fields in the same cron expression. If you specify a value in one of the fields, you must use a ? (question mark) in the other.

  • Snapshot schedules don't support the following frequencies:

    • Snapshots scheduled more frequently than 1 per hour.

    • Snapshots scheduled less frequently than 1 per day (24 hours).

    If you have overlapping schedules that result in scheduling snapshots within a 1 hour window, a validation error results.

The following table has some sample cron strings.

Minutes Hours Day of week Meaning

0

14-20/1

TUE

Every hour between 2pm and 8pm on Tuesday.

0

21

MON-FRI

Every night at 9pm Monday–Friday.

30

0/6

SAT-SUN

Every 6 hour increment on Saturday and Sunday starting at 30 minutes after midnight (00:30) that day. This results in a snapshot at [00:30, 06:30, 12:30, and 18:30] each day.

30

12/4

*

Every 4 hour increment starting at 12:30 each day. This resolves to [12:30, 16:30, 20:30].

The following example demonstrates how to create a schedule that runs in 2-hour increments starting at 15:15 each day.

cron(15 15/2 *)

Currently, you can only use the Amazon Redshift Serverless API or Amazon CLI to create a snapshot schedule. For more information about those operations, see Using the Amazon CLI and Amazon Redshift Serverless API.

Copying backups to another Amazon Web Services Region

You can configure Amazon Redshift Serverless to automatically copy snapshots and recovery points to another Amazon Web Services Region. When you create a snapshot in the source Amazon Web Services Region, it's copied to a destination Region. You can configure your namespace so that it only copies snapshots and recovery points to one destination Amazon Web Services Region at a time. For a list of Amazon Web Services Regions where Amazon Redshift Serverless is available, see the endpoints listed for Redshift Serverless API in the Amazon Web Services General Reference.

When you configure copying backups, you can also specify a retention period of how long Amazon Redshift Serverless should keep the copied snapshot. You can't change the retention periods of recovery points, which must be 1 day. The retention periods of snapshots in the destination Region is separate from the retention period of the snapshot in the source Region. By default, the retention period is to keep the snapshot indefinitely. If you choose Custom value choose the number of days. This amount you choose must be between 1-3653 days, inclusive.

To change the destination Region to copy snapshots to, first disable copying backups, and then specify the new destination Region when you re-enable copying.

Once a snapshot or recovery point is copied to a destination Region, you can use it to restore data to the Region.

By default, your data is encrypted with a key that Amazon manages for you. To use a different key, choose the key that you want to use when configuring backup copying in the source Amazon Web Services Region, and Amazon Redshift Serverless automatically creates a grant, which enables snapshot encryption in the destination Amazon Web Services Region.

To copy backups to another Region, make sure that you have the following IAM permissions:

redshift-serverless:CreateSnapshotCopyConfiguration redshift-serverless:UpdateSnapshotCopyConfiguration redshift-serverless:ListSnapshotCopyConfigurations redshift-serverless:DeleteSnapshotCopyConfiguration

If you're using your own KMS key to encrypt your backups, you also need the following permissions:

kms:CreateGrant kms:DescribeKey

To configure copying your snapshots or recovery points to another Amazon Web Services Region

  1. On the Amazon Redshift Serverless console, choose the namespace for which you want to configure copying snapshots or recovery points.

  2. Choose the Actions, Configure cross-Region backup.

  3. Choose the destination Amazon Web Services Region to copy the snapshot to.

  4. (Optional) Choose how long to retain the snapshot. If you choose Custom value choose the number of days The amount you choose must be between 1-3653 days, inclusive. The default is to retain indefinitely.

  5. (Optional) Choose a different Amazon KMS key to use to encrypt for encryption in the destination Region.

  6. Choose Save configuration.

Restoring a table

You can also restore a specific table from a snapshot or a recovery point When you do so, you specify the source snapshot or recovery point, database, schema, table, the target database, schema, and new table name. This new table can't have the same name as an existing table. If you want to replace an existing table by restoring a table, you must first rename or drop the table before you restore the table.

The target table is created using the source table's column definitions, table attributes, and column attributes except for foreign keys. To prevent conflicts due to dependencies, the target table doesn't inherit foreign keys from the source table. Any dependencies, such as views or permissions granted on the source table, aren't applied to the target table.

If the owner of the source table exists, then that user is the owner of the restored table, provided that the user has sufficient permissions to become the owner of a relation in the specified database and schema. Otherwise, the restored table is owned by the admin user that was created when the cluster was launched.

The restored table returns to the state it was in at the time the backup was taken. This includes transaction visibility rules defined by the Amazon Redshift adherence to serializable isolation, meaning that data will be immediately visible to in flight transactions started after the backup.

You can use the Amazon Redshift Serverless console to restore tables from a snapshot.

Restoring a table from data backup has the following limitations:

  • You can only restore one table at a time.

  • Any dependencies, such as views or permissions granted on the source table, aren't applied to the target table.

  • If row-level security is turned on for a table being restored, Amazon Redshift Serverless restores the table with row-level security turned on.

To restore a table using the Amazon Redshift Serverless console

  1. On the Amazon Redshift Serverless console, choose Data backup.

  2. Choose the snapshot or recovery point that has the table to restore.

  3. Choose Actions, Restore table from snapshot or Restore table from recovery point.

  4. Enter information about the source snapshot or recovery point and target table, then choose Restore table.

Using the Amazon Command Line Interface and Amazon Redshift Serverless API

Aside from using the Amazon console, you can also use the Amazon CLI or the Amazon Redshift Serverless API to interact with snapshots and recovery points. The table below lists the API and CLI operations you can use to manage snapshots and recovery points.

API operation CLI command Description

CreateSnapshot

create-snapshot

Creates a snapshot. Snapshots must be associated with a namespace, so you must include the name of a namespace in your request. By default, Amazon Redshift Serverless keeps snapshots for an indefinite period, but you can specify a retention period.

RestoreFromSnapshot

restore-from-snapshot

Restores the databases in a snapshot to your namespace. If you're restoring a snapshot from Amazon Redshift Serverless to a provisioned cluster, you must specify the snapshotArn of the snapshot you're restoring. Otherwise, if you're restoring from serverless to serverless, you can specify snapshotArn or snapshotName, but not both.

RestoreTableFromSnapshot

restore-table-from-snapshot

Restores a table from a snapshot to your Amazon Redshift Serverless namespace. You can't use this operation to restore tables with interleaved sort keys.

GetSnapshot

get-snapshot

Retrieves information about a snapshot.

ListSnapshots

list-snapshots

Retrieves information about multiple snapshots.

DeleteSnapshot

delete-snapshot

Deletes a snapshot.

RestoreFromRecoveryPoint

restore-from-recovery-point

Restores the data within a recovery point to your namespace.

RestoreTableFromRecoveryPoint

restore-table-from-recovery-point

Restores a table from a recovery point to your Amazon Redshift Serverless namespace. You can't use this operation to restore tables with interleaved sort keys.

ConvertRecoveryPointToSnapshot

convert-recovery-point-to-snapshot

Converts a recovery point to a snapshot.

GetRecoveryPoint

get-recovery-point

Retrieves information about a recovery point.

ListRecoveryPoints

list-recovery-points

Retrieves information about multiple recovery points.

To schedule snapshot creation, use the following API operations.

API operation CLI command Description

CreateScheduledAction

create-scheduled-action

Creates a scheduled action, which contains a schedule and an Amazon Redshift Serverless action. For example, you can create a schedule of when to run the CreateSnapshot API operation.

DeleteScheduledAction

delete-scheduled-action

Deletes a scheduled action.

GetScheduledAction

get-scheduled-action

Retrieves information about a scheduled action.

ListScheduledActions

list-scheduled-actions

Retrieves information about a list of scheduled actions.

UpdateScheduledAction

update-scheduled-action

Updates a scheduled action.