Tuesday, August 16, 2022
HomeBig DataSpeed up resize and encryption of Amazon Redshift clusters with Quicker Basic...

Speed up resize and encryption of Amazon Redshift clusters with Quicker Basic Resize

Amazon Redshift has improved the efficiency of the traditional resize characteristic and elevated the pliability of the cluster snapshot restore operation. You need to use the traditional resize operation to resize a cluster when you might want to change the occasion kind or transition to a configuration that may’t be supported by elastic resize. This might take the cluster offline for a lot of hours through the resize, however now the cluster can sometimes be out there to course of queries in minutes. Clusters can be resized when restoring from a snapshot and in these instances there might be restrictions.

Now you can additionally restore an encrypted cluster from an unencrypted snapshot or change the encryption key. Amazon Redshift makes use of AWS Key Administration Service (AWS KMS) as an encryption choice to offer an extra layer of knowledge safety by securing your information from unauthorized entry to the underlying storage. Now you possibly can encrypt an unencrypted cluster with a KMS key sooner by merely specifying a KMS key ID when modifying the cluster. You may as well restore an AWS KMS-encrypted cluster from an unencrypted snapshot. You may entry the characteristic through the AWS Administration Console, SDK, or AWS Command Line Interface (AWS CLI). Please word that these options solely apply to the clusters or goal clusters with the RA3 node kind.

On this put up, we present you ways the up to date traditional resize choice works and likewise the way it considerably improves the period of time it takes to resize or encrypt your cluster with this enhancement. We additionally stroll by the steps to resize your Amazon Redshift cluster utilizing Quicker Basic Resize.

Present resize choices

We’ve labored carefully with our prospects to learn the way their wants evolve as their information scales or as their safety and compliance necessities change. To handle and meet your ever-growing calls for, you usually need to resize your Amazon Redshift cluster and select an optimum occasion kind that delivers one of the best worth/efficiency. As of this writing, there are 3 ways you possibly can resize your clusters: elastic resize, traditional resize, and the snapshot, restore, and resize technique.

Among the many three choices, elastic resize is the quickest out there resize mechanism as a result of it really works primarily based on slice remapping as a substitute of full information copy. And traditional resize is used primarily when cluster resize is exterior the allowed slice ranges by elastic resize, or the encryption standing needs to be modified. Let’s briefly talk about these situations earlier than describing how the brand new migration course of helps.

Present limitations

The present resize choices have just a few limitations of word.

  • Configuration modifications – Elastic resize helps the next RA3 configuration modifications by design. So, when you might want to select a goal cluster outsize the ranges talked about within the following desk, it’s best to select traditional resize.
Node SortDevelopment RestrictDiscount Restrict
ra3.16xlarge4x (from 4 to 16 nodes, for instance)To at least one-quarter of the quantity (from 16 to 4 nodes, for instance)
ra3.4xlarge4xTo at least one-quarter of the quantity
ra3.xlplus2x (from 4 to eight nodes, for instance)To at least one-quarter of the quantity

Additionally, elastic resize can’t be carried out if the present cluster is a single-node cluster or isn’t working on an EC2-VPC platform. These situations additionally drive prospects to decide on traditional resize.

  • Encryption modifications – It’s possible you’ll must encrypt your Amazon Redshift cluster primarily based on safety, compliance, and information consumption necessities. At present, so as to modify encryption on an Amazon Redshift cluster, we use traditional resize expertise, which internally performs a deep copy operation of the complete dataset and rewrites the dataset with the specified encryption state. To keep away from any modifications through the deep copy operation, the supply cluster is positioned in read-only mode throughout the complete operation, which might take just a few hours to days relying on the dataset dimension. Or, you could be locked out altogether if the info warehouse is down for a resize. In consequence, the directors or utility house owners can’t help Service Stage Agreements (SLAs) that they’ve set with their enterprise stakeholders.

Switching to the Quicker Basic Resize method may also help pace up the migration course of when turning on encryption. This has been one of many necessities for cross-account, cross-Area information sharing enabled on unencrypted clusters and integrations with AWS Information Alternate for Amazon Redshift. Moreover, Amazon Redshift Serverless is encrypted by default. So, to create an information share from a provisioned cluster to Redshift Serverless, the provisioned cluster needs to be encrypted as nicely. That is another compelling requirement for Quicker Basic Resize.

Quicker Basic Resize

Quicker Basic Resize works like elastic resize, however performs comparable capabilities like traditional resize, thereby providing one of the best of each approaches. In contrast to traditional resize, which includes extracting tuples from the supply cluster and inserting these tuples on the goal cluster, the Quicker Basic Resize operation doesn’t contain extraction of tuples. As an alternative, it begins from the snapshots and the info blocks are copied over to the goal cluster.

The brand new Quicker Basic Resize operation includes two levels:

  • Stage 1 (Essential path) – This primary stage consists of migrating the info from the supply cluster to the goal cluster, throughout which the supply cluster is in read-only mode. Sometimes, it is a very brief length. Then the cluster is made out there for learn and writes.
  • Stage 2 (Off crucial path) – The second stage includes redistributing the info as per the earlier information distribution type. This course of runs within the background off the crucial path of migration from the supply to focus on cluster. The length of this stage depends on the quantity to distribute, cluster workload, and so forth.

Let’s see how Quicker Basic Resize works with configuration modifications, encryption modifications, and restoring an unencrypted snapshot into an encrypted cluster.


Full the next prerequisite steps:

  1. Take a snapshot from the present cluster or use an present snapshot.
  2. Present the AWS Identification and Entry Administration (IAM) function credentials which can be required to run the AWS CLI. For extra data, seek advice from Utilizing identity-based insurance policies (IAM insurance policies) for Amazon Redshift.
  3. For encryption modifications, create a KMS key if none exists. For directions, seek advice from Creating keys.

Configuration change

As of this writing, you need to use it change your cluster configuration from DC2, DS2, and RA3 node varieties to any RA3 node kind. Nevertheless, altering from RA3 to DC2 or DS2 shouldn’t be supported but.

We did a benchmark on Quicker Basic Resize with totally different cluster combos and volumes. The next desk summarizes the outcomes evaluating crucial paths in traditional resize and Quicker Basic Resize.

QuantitySupply ClusterGoal ClusterBasic Resize
Length (min)
Quicker Basic Resize
Stage1 Length (min)
% Quicker
10 TBra3 4xlarge – 6 nodesra3 16xlarge – 8 nodes781186%
10 TBra3 16xlarge – 8 nodesra3 4xlarge – 2 nodes7381199%
10 TBdc2 8xlarge – 6 nodesra3 4xLarge – 2 nodes706899%
3 TBra3 4xLarge – 2 nodesra3 16xLarge – 4 nodes531179%
3 TBra3 16xLarge – 4 nodesra3 4xLarge – 2 nodes244797%
3 TBdc2 8xlarge – 6 nodesra3 4xLarge – 2 nodes251797%

The Quicker Basic Resize choice persistently accomplished in considerably much less time and made the cluster out there for learn and write operations in a short while. Basic resize took an extended time in all instances and saved the cluster in read-only mode, making it unavailable for writes. Additionally, the traditional resize length is relatively longer when the goal cluster configuration is smaller than the unique cluster configuration.

Carry out Quicker Basic Resize

You need to use both of the next two strategies to resize your cluster utilizing Quicker Basic Resize through the AWS CLI for RA3 goal node varieties.

Notice: Should you provoke Basic resize from person interface, the brand new Quicker Basic Resize will probably be carried out for RA3 goal node varieties and present Basic resize will probably be carried out for DC2/DS2 goal node varieties.

  • Modify cluster technique – Resize an present cluster with out altering the endpoint

The next are the steps concerned:

    1. Take a snapshot on the present cluster previous to performing the resize operation.
    2. Decide the goal cluster configuration and run the next command from the AWS CLI:
      aws redshift modify-cluster --region <CLUSTER REGION>
      --endpoint-url https://redshift.<CLUSTER REGION>.amazonaws.com/
      --cluster-identifier <CLUSTER NAME>
      --cluster-type multi-node
      --node-type <TARGET INSTANCE TYPE>
      --number-of-nodes <TARGET NUMBER OF NODES>

      For instance:

      aws redshift modify-cluster --region us-east-1
      --endpoint-url https://redshift.us-east-1.amazonaws.com/
      --cluster-identifier my-cluster-identifier
      --cluster-type multi-node
      --node-type  ra3.16xlarge
      --number-of-nodes 12

  • Snapshot restore technique – Restore an present snapshot to the brand new cluster with the brand new cluster endpoint

The next are the steps concerned:

    1. Establish the snapshot for restore and a novel title for the brand new cluster.
    2. Decide the goal cluster configuration and run the next command from the AWS CLI:
      aws redshift restore-from-cluster-snapshot --region <CLUSTER REGION>
      --endpoint-url https://redshift.<CLUSTER REGION>.amazonaws.com/
      --snapshot-identifier <SNAPSHOT ID> 
      --cluster-identifier <CLUSTER NAME>
      --node-type <TARGET INSTANCE TYPE>
      --number-of-node <NUMBER>

      For instance:

      aws redshift restore-from-cluster-snapshot --region us-east-1
      --endpoint-url https://redshift.us-east-1.amazonaws.com/
      --snapshot-identifier rs:sales-cluster-2022-05-26-16-19-36
      --cluster-identifier my-new-cluster-identifier
      --node-type ra3.16xlarge
      --number-of-node 12

Notice: Snapshot restore technique will carry out elastic resize if the brand new configuration is inside allowed ranges, else it would use the Quicker Basic Resize method.

Monitor the resize course of

Monitor the progress by the cluster administration console. You may as well test the occasions generated by the resize course of. The resize completion standing is logged in occasions together with the length it took for the resize. The next screenshot reveals an instance.

It’s vital to notice that you could be observe longer question instances within the second stage of Quicker Basic Resize. In the course of the first stage, the info for tables with dist-key distribution type is transferred as dist-even. Later, a background course of converts them again to dist-key (in stage 2). Nevertheless, background processes are working behind the scenes to get the info redistributed to the unique distribution type (the distribution type earlier than the cluster resize). You may monitor the progress of the background processes by querying the stv_xrestore_alter_queue_state desk. It’s vital to notice that tables with ALL, AUTO, or EVEN distribution kinds don’t require redistribution post-resize. Due to this fact, they’re not logged within the stv_xrestore_alter_queue_state desk. The counts you observe in these tables are for the tables with distribution type as Key earlier than the resize operation.

See the next instance question:

choose db_id, standing, depend(*) from stv_xrestore_alter_queue_state group by 1,2 order by 3 desc

The next desk reveals that for 60 tables information redistribution is completed, for 323 tables information redistribution is pending, and for 1 desk information redistribution is in progress.

We ran checks to evaluate time to finish the redistribution. For 10 TB of knowledge, it took roughly 5 hours and half-hour on an idle cluster. For 3 TB, it took roughly 2 hours and half-hour on an idle cluster. The next is a abstract of checks carried out on bigger volumes:

  • A snapshot with 100 TB the place 70% of blocks wants redistribution would take 10–40 hours
  • A snapshot with 450 TB the place 70% of blocks wants redistribution would take 2–8 days
  • A snapshot with 1600 TB the place 70% of blocks wants redistribution would take 7–27 days

The precise time to finish redistribution is basically depending on information quantity, cluster idle cycles, goal cluster dimension, information skewness, and extra. Due to this fact, we suggest performing Quicker Basic Resize when there may be sufficient of an idle window (corresponding to weekends) for the cluster to carry out redistribution.

Encryption modifications

You may encrypt your Amazon Redshift cluster from the console (the modify cluster technique) or utilizing the AWS CLI utilizing the snapshot restore technique. Amazon Redshift performs the encryption change utilizing Quicker Basic Resize. The operation solely takes a couple of minutes to finish and your cluster is obtainable for each learn and write. With Quicker Basic Resize, you possibly can change an unencrypted cluster to an encrypted cluster or change the encryption key utilizing the snapshot restore technique.

For this put up, we present how one can change the encryption utilizing the Amazon Redshift console. To check the timings, we created a number of Amazon Redshift clusters utilizing TPC-DS information. The Quicker Basic Resize choice persistently accomplished in considerably much less time and made clusters out there for learn and write operations sooner. Basic resize took an extended time in all instances and saved the cluster in read-only mode. The next desk accommodates the abstract of the outcomes.

Information QuantityClusterEncryption (Basic Resize)
Length (min)
Encryption (Quicker Basic Resize)
Length (min)
% Quicker
10 TBra3.4xlarge – 2 nodes5801198%
10 TBra3.xlplus – 2 nodes6801698%
3 TBra3.4xlarge – 2 nodes527998%
3 TBra3.xlplus – 2 nodes5701098%

Now, let’s carry out the encryption change from an unencrypted cluster to an encrypted cluster utilizing the console. Full the next steps:

  1. On the Amazon Redshift console, navigate to your cluster.
  2. On the Properties tab, on the Edit drop-down menu, select Edit encryption.
  3. For Encryption, choose Use AWS Key Administration Service (AWS KMS).
  4. For AWS KMS, choose Default Redshift key.
  5. Select Save modifications.

You may monitor the progress of your encryption change on the Occasions tab. As proven within the following screenshot, the complete course of to vary the encryption took roughly 11 minutes.

Restore an unencrypted snapshot to an encrypted cluster

As of at the moment, the Quicker Basic Resize choice to revive an unencrypted snapshot into an encrypted cluster or to vary the encryption secret’s out there solely by the AWS CLI. When triggered, the restored cluster operates in learn/write mode instantly. The encryption state change for restored blocks which can be unencrypted operates within the background, and newly ingested blocks proceed to be encrypted.

Restore the snapshot utilizing the next command into a brand new cluster. (Change the indicated parameter values; --encrypted and --kms-key-id are required).

aws redshift restore-from-cluster-snapshot 
--cluster-identifier <CLUSTER NAME>
--snapshot-identifier <SNAPSHOT ID> 
--region <AWS REGION> 
--kms-key-id <KMS KEY ID>
--cluster-subnet-group-name <SUBNET GROUP>

When to make use of which resize choice

The next movement chart offers steerage on which resize choice is really useful when altering your cluster encryption standing or resizing to a brand new cluster configuration.


On this put up, we talked concerning the improved efficiency of Amazon Redshift’s traditional resize characteristic and the way Quicker Basic Resize considerably improves your capability to scale your Amazon Redshift clusters utilizing the traditional resize technique. We additionally talked about when to make use of totally different resize operations primarily based in your necessities. We demonstrated the way it works from the console (for encryption modifications) and utilizing the AWS CLI. We additionally confirmed the outcomes of our benchmark check and the way it considerably improves the migration time for configuration modifications and encryption modifications to your Amazon Redshift cluster.

To be taught extra about resizing your clusters, seek advice from Resizing clusters in Amazon Redshift. When you have any suggestions or questions, please go away them within the feedback.

In regards to the authors

Sumeet Joshi is an Analytics Specialist Options Architect primarily based out of New York. He focuses on constructing large-scale information warehousing options. He has over 17 years of expertise within the information warehousing and analytical house.

Satesh Sonti is a Sr. Analytics Specialist Options Architect primarily based out of Atlanta, specialised in constructing enterprise information platforms, information warehousing, and analytics options. He has over 16 years of expertise in constructing information belongings and main complicated information platform applications for banking and insurance coverage purchasers throughout the globe.

Krishna Chaitanya Gudipati is a Senior Software program Growth Engineer at Amazon Redshift. He has been engaged on distributed techniques for over 14 years and is enthusiastic about constructing scalable and performant techniques. In his spare time, he enjoys studying and exploring new locations.

Yanzhu Ji is a Product Supervisor on the Amazon Redshift group. She labored on the Amazon Redshift group as a Software program Engineer earlier than changing into a Product Supervisor. She has a wealthy expertise of how the customer-facing Amazon Redshift options are constructed from planning to launching, and at all times treats prospects’ necessities as first precedence. In her private life, Yanzhu likes portray, images, and taking part in tennis.



Please enter your comment!
Please enter your name here

Most Popular