01 Run describe-clusters command (OSX/Linux/UNIX) to describe the configuration metadata for the AWS Redshift cluster that you want to relaunch (see Audit section part II to identify the right resource):
aws redshift describe-clusters
--region us-east-1
--cluster-identifier cc-prod-db-cluster
02 The command output should return the requested configuration information which will be useful later when the new cluster will be created:
{
"Clusters": [
{
"PubliclyAccessible": true,
"MasterUsername": "awsuser",
"VpcSecurityGroups": [
{
"Status": "active",
"VpcSecurityGroupId": "sg-541e2e7b"
}
],
"ClusterPublicKey": "ssh-rsa AAZZB3NzaC ... ",
"NumberOfNodes": 1,
"PendingModifiedValues": {},
"VpcId": "vpc-d731653f",
"ClusterVersion": "1.0",
"Tags": [],
"AutomatedSnapshotRetentionPeriod": 1,
"ClusterParameterGroups": [
{
"ParameterGroupName": "default.redshift-1.0",
"ParameterApplyStatus": "in-sync"
}
],
"DBName": "awsclusterdb",
"PreferredMaintenanceWindow": "fri:03:00-fri:03:30",
"Endpoint": {
"Port": 5439,
"Address": "cc-prod-db-cluster.dyupsgvyjhfo..."
},
"IamRoles": [],
"AllowVersionUpgrade": true,
"ClusterCreateTime": "2017-01-12T17:44:12.654Z",
"ClusterSubnetGroupName": "default",
"ClusterSecurityGroups": [],
"ClusterIdentifier": "cc-prod-db-cluster",
"ClusterNodes": [
{
"NodeRole": "SHARED",
"PrivateIPAddress": "172.43.121.2",
"PublicIPAddress": "52.201.107.154"
}
],
"AvailabilityZone": "us-east-1a",
"NodeType": "ds2.xlarge",
"Encrypted": false,
"ClusterRevisionNumber": "1106",
"ClusterStatus": "available"
}
]
}
03 Run create-cluster command (OSX/Linux/UNIX) using the existing database cluster configuration details returned at the previous step to launch a new Amazon Redshift cluster with a different (non-default) master user name:
aws redshift create-cluster
--region us-east-1
--cluster-identifier cc-prod-db-new-cluster
--cluster-type single-node
--node-type ds2.xlarge
--db-name awsclusterdb
--master-username awsmasterusr
--master-user-password Pr0Dclusterpwd0
--vpc-security-group-ids sg-541e2e7b
--availability-zone us-east-1a
--port 5439
--cluster-subnet-group-name default
--cluster-parameter-group-name default.redshift-1.0
--publicly-accessible
--allow-version-upgrade
04 The command output should return the new Redshift cluster configuration metadata:
{
"Cluster": {
"PubliclyAccessible": true,
"MasterUsername": "awsmasterusr",
"DBName": "awsclusterdb",
"PreferredMaintenanceWindow": "fri:06:00-fri:06:30",
"IamRoles": [],
"AllowVersionUpgrade": true,
...
"ClusterSubnetGroupName": "default",
"ClusterSecurityGroups": [],
"ClusterIdentifier": "cc-prod-db-new-cluster",
"AvailabilityZone": "us-east-1a",
"NodeType": "ds2.xlarge",
"Encrypted": false,
"ClusterStatus": "creating"
}
}
05 Run again describe-clusters command (OSX/Linux/UNIX) using custom query filters to expose the new Redshift database cluster endpoint:
aws redshift describe-clusters
--region us-east-1
--cluster-identifier cc-prod-db-new-cluster
--query 'Clusters[*].Endpoint.Address'
06 The command output should return the new database cluster endpoint URL:
[
"cc-prod-db-new-cluster.dyupsgvyjhfo.us-east-1.redshift.amazonaws.com"
]
07 Unload your data from the old Redshift cluster and reload it into the newly created database cluster using the Amazon Redshift Unload/Copy utility. With this utility tool you can unload (export) your data from the source cluster to an AWS S3 bucket, then import it into your destination (new) cluster and clean up the S3 bucket used. All the necessary instructions to install, configure and use the Amazon Redshift Unload/Copy tool can be found at this URL.
08 As soon as the data migration process is completed and all the data is loaded into the new Redshift cluster, you can update your application configuration to refer to the new cluster endpoint, returned at step no. 6 (e.g. cc-prod-db-new-cluster.dyupsgvyjhfo.us-east-1.redshift.amazonaws.com).
09 Once the Redshift cluster endpoint is changed within your application configuration, run delete-cluster command (OSX/Linux/UNIX) to remove the source (old) cluster from your AWS account:
aws redshift delete-cluster
--region us-east-1
--cluster-identifier cc-prod-db-cluster
--final-cluster-snapshot-identifier cc-prod-db-cluster-final-snapshot
10 The command output should return the metadata of the Redshift cluster selected for deletion:
{
"Cluster": {
"PubliclyAccessible": true,
"MasterUsername": "awsmasterusr",
"PendingModifiedValues": {},
"VpcId": "vpc-d731653f",
"ClusterVersion": "1.0",
"AutomatedSnapshotRetentionPeriod": 1,
...
"ClusterSubnetGroupName": "default",
"ClusterSecurityGroups": [],
"ClusterIdentifier": "cc-prod-db-cluster",
"AvailabilityZone": "us-east-1a",
"NodeType": "ds2.xlarge",
"Encrypted": false,
"ClusterStatus": "final-snapshot"
}
}
11 Repeat steps no. 1 - 10 to relaunch other Redshift database clusters available within the current region, with a non-default master user name.
12 Change the AWS region by updating the --region command parameter value and repeat steps no. 1 - 11 for other regions.