Search code examples
amazon-web-servicesamazon-redshiftamazon-redshift-serverless

Can provisioned Redshift clusters and Serverless Redshift clusters share data when they are in the same region and under the same account?


Can provisioned Redshift clusters and Serverless Redshift clusters share data when they are in the same region and under the same account?

I created a data share in the provisioned Redshift cluster and entered the Namespace ID information of Serverless Redshift as the Consumer Namespace ID.

When I run the SHOW DATASHARES command in the Serverless Redshift query console, I get a list of data shares created in the provisioned Redshift cluster. In this case, share_type is INBOUND. However, when I use the following command, the list of schemas and tables registered for data sharing are not retrieved. The command is:

DESC DATASHARE {MY-DATASHARE-NAME} OF NAMESPACE '{NAMESPACE-ID}' ;

I tried running all of the following commands in the serverless Redshift query console:

DESC DATASHARE temp_datashare OF NAMESPACE '{Provisioned Redshift cluster namespace ID}' ;
or,
DESC DATASHARE temp_datashare OF NAMESPACE '{Serverless Redshift cluster namespace ID}' ;

I've also tried deleting and then recreating both the permissions and datashare list using the reverse command to create the data share.

But it didn't work.

[Documents I referenced] https://docs.aws.amazon.com/ko_kr/redshift/latest/dg/within-account.html


Solution

  • Sharing data between provisioned clusters and serverless namespaces in Amazon Redshift is indeed possible. If you're unable to see datashare objects when describing the datashare, it could be due to one of the following scenarios:

    Encryption: Both the producer and consumer should be encrypted to enable data sharing. Redshift serverless is encrypted by default, so you need to ensure that your producer is also encrypted.

    Publicly accessibile setting: If the consumer endpoint is publicly accessible but the datashare is not, data sharing won't be possible. It's generally recommended to avoid public accessibility unless necessary. To resolve this, you can either disable public accessibility for the consumer endpoint or make the datashare publicly accessible. On the producer end, you can use the following statement to make the datashare publicly accessible:

    ALTER DATASHARE temp_datashare SET PUBLICACCESSIBLE = TRUE;
    

    Collation: If the producer has specific collation settings, ensure that the consumer uses the same collation settings. If you have addressed these requirements, you can proceed to create a database in the consumer using the datashare:

    CREATE DATABASE consumer_db_test FROM DATASHARE temp_datashare OF NAMESPACE 'producer-namespace-id';
    

    After creating the database, you can query a table within the datashare:

    SELECT * FROM consumer_db_test.test_schema.test_table;
    

    If there are any issues with the datashare not functioning properly, an error message will indicate the underlying problem. For example, an error may state that a publicly accessible consumer cannot access an object in the database.