Migrating a provisioned cluster to Amazon Redshift Serverless
To migrate from a provisioned cluster to Amazon Redshift Serverless, perform the following set of tasks.
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
Sign in to the AWS Management Console and open the Amazon Redshift console at https://console.aws.amazon.com/redshiftv2/
. -
On the navigation menu, choose Clusters, Snapshots, and then choose Create snapshot.
-
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:
Sign in to the AWS Management Console and open the Amazon Redshift console at https://console.aws.amazon.com/redshiftv2/
. Start on the Amazon Redshift provisioned cluster console and navigate to the Clusters, Snapshots page.
Choose a snapshot to use.
Choose Restore snapshot, Restore to serverless namespace.
Choose a namespace to restore your snapshot to.
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 AWS 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 AWS 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 AWS identity has the correct IAM policy for the RedshiftServerlessGetCredentials
action.
The following is an example IAM policy that grants the correct permissions to an AWS 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.