Migrating a provisioned cluster to Amazon Redshift Serverless - 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).

Migrating a provisioned cluster to Amazon Redshift Serverless

To migrate from a provisioned cluster to Amazon Redshift Serverless, see the following steps.

Creating a snapshot of your provisioned cluster

To transfer data from your provisioned cluster to Amazon Redshift Serverless, create a snapshot of your provisioned cluster, and then restore the snapshot in Amazon Redshift Serverless. Amazon Redshift automatically converts interleaved keys to compound keys when you restore a provisioned cluster snapshot to a serverless namespace.

Note

Before you migrate your data to a serverless workgroup, ensure that your provisioned cluster needs are compatible with the amount of RPU you choose in Amazon Redshift Serverless.

To create a snapshot of your provisioned cluster

  1. Sign in to the Amazon Web Services Management Console and open the Amazon Redshift console at https://console.amazonaws.cn/redshiftv2/.

  2. On the navigation menu, choose Clusters, Snapshots, and then choose Create snapshot.

  3. Enter the properties of the snapshot definition, then choose Create snapshot. It might take some time for the snapshot to be available.

To restore a provisioned cluster snapshot to a serverless namespace:

  1. Sign in to the Amazon Web Services Management Console and open the Amazon Redshift console at https://console.amazonaws.cn/redshiftv2/.

  2. Start on the Amazon Redshift provisioned cluster console and navigate to the Clusters, Snapshots page.

  3. Choose a snapshot to use.

  4. Choose Restore snapshot, Restore to serverless namespace.

  5. Choose a namespace to restore your snapshot to.

  6. Confirm you want to restore from your snapshot. This action replaces all the databases in your serverless endpoint with the data from your provisioned cluster. Choose Restore.

For more information about provisioned cluster snapshots, see Amazon Redshift snapshots.

Connecting to Amazon Redshift Serverless using a driver

To connect to Amazon Redshift Serverless with your preferred SQL client, you can use the Amazon Redshift provided JDBC driver version 2 driver. We recommend connecting using JDBC driver version 2.1.x or later. The port number is optional. If you don’t include it, Amazon Redshift Serverless defaults to port number 5439. You can change to another port from the port range of 5431-5455 or 8191-8215. To change the default port for a serverless endpoint, use the Amazon CLI and Amazon Redshift API.

To find the exact endpoint to use for the JDBC, ODBC, or Python driver, see Workgroup configuration in Amazon Redshift Serverless. You can also use the Amazon Redshift Serverless API operation GetWorkgroup or the Amazon CLI operation get-workgroups to return information about your workgroup, and then connect.

Connecting using password-based authentication

To connect using password-based authentication, use the following syntax.

jdbc:redshift://<workgroup-name>.<account-number>.<aws-region>.redshift-serverless.amazonaws.com:5439/?username=enter a username&password=enter a password

To connect using the Amazon Redshift Python driver, use the following syntax.

import redshift_connector with redshift_connector.connect( host='<workgroup-name>.<account-number>.<aws-region>.redshift-serverless.amazonaws.com', database='<database-name>', user='enter a user', password='enter a password' # port value of 5439 is specified by default ) as conn: pass

Connecting using IAM

If you prefer logging in with IAM, use the following driver endpoint. This driver endpoint lets you connect to a specific database and uses the Amazon Redshift Serverless GetCredentials API operation.

jdbc:redshift:iam://<workgroup-name>.<account-number>.<aws-region>.redshift-serverless.amazonaws.com:5439/<database-name>

This driver endpoint doesn’t support customizing dbUser, dbGroup and auto-create. By default, the driver automatically creates database users at login and assigns them to groups according to the groups you defined in IAM. Note: Group names you specify in IAM must contain only lowercase letters, numbers, underscore ('_'), plus sign ('+'), period (dot), at symbol (@), or hyphen ('-'). Otherwise, the driver might not connect to dbGroup.

Ensure that your Amazon identity has the correct IAM policy for the RedshiftServerlessGetCredentials action. The following is an example IAM policy that grants the correct permissions to an Amazon identity to connect to Amazon Redshift Serverless. For more information about IAM permissions, see Add IAM Identity Permissions.

{ "Version": "2012-10-17", "Statement": [ { "Sid": "", "Effect": "Allow", "Action": "redshift-serverless:GetCredentials", "Resource": "*" } ] }

Connecting using IAM with dbUser and dbGroups

If you want to use custom dbUser and dbGroups connection options, use the following driver endpoint. Like the other Amazon Redshift Serverless driver endpoint, this syntax automatically creates database users at login. This driver endpoint uses the Amazon Redshift Serverless GetCredentials API operation. dbUser must begin with a letter, must contain only alphanumeric characters, underscore ('_'), plus sign ('+'), dot ('.'), at ('@'), or hyphen ('-'), and must be less than 128 characters. dbGroups must contain only lowercase letters, numbers, underscore ('_'), plus sign ('+'), period (dot), at symbol (@), or hyphen.

jdbc:redshift:iam://redshift-serverless-<workgroup-name>:<aws-region>/<database-name>

To connect using the Amazon Redshift Python driver, use the following syntax.

import redshift_connector with redshift_connector.connect( iam=True, host='<workgroup-name>.<account-number>.<aws-region>.redshift-serverless.amazonaws.com', database='<database-name>', db_user='enter a user', password='enter a password', db_groups='<db-groups>' # port value of 5439 is specified by default ) as conn: pass

Connecting using ODBC

To connect using ODBC, use the following syntax.

Driver={Amazon Redshift (x64)}; Server=<workgroup-name>.<account-number>.<aws-region>.redshift-serverless.amazonaws.com; Database=dev

Using the Amazon Redshift Serverless SDK

If you wrote any management scripts using the Amazon Redshift SDK, you must use the new Amazon Redshift Serverless SDK to manage Amazon Redshift Serverless and associated resources. For more information about available API operations, see the Amazon Redshift Serverless API Reference guide.