Lesson 7 of 13 Amazon Redshift

Sharing Live Redshift Data Without Copying

This lesson explains how Redshift data sharing gives other warehouses live, read access to the same data with their own compute, avoiding the delays, storage and inconsistencies of copying data between warehouses.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe datashares, producers and consumers.
  • Identify the scopes a datashare can reach.
  • Design workload isolation and data mesh architectures with data sharing.

How data sharing works

With data sharing, a producer warehouse creates a datashare, a named collection of schemas, tables, views and user-defined functions, and grants it to one or more consumers. A consumer creates a database from the datashare and queries it with its own compute, as if the objects were local.

No data is copied. Consumers read the producer's data in Redshift Managed Storage directly, so they always see live, transactionally consistent data, and there is no pipeline to build or delay to wait for. Because consumers use their own compute, their queries do not slow the producer, and their costs are their own. Data sharing requires RA3 clusters or Redshift Serverless on both sides, because it depends on managed storage.

Scope of sharing

Data sharing gives other Redshift warehouses live, read-only access to data without copying it, and a datashare can reach four scopes. Within an account, an ETL cluster can share with a separate BI workgroup, so heavy loads and dashboards use separate compute. Across accounts, a central data account can share with business unit accounts, which pay for their own queries. Across Regions, analysts in another Region query the data directly. Through AWS Data Exchange, datashares become products that external subscribers license. The following table summarises the scopes.

ScopeExample
Within an accountAn ETL cluster shares with a BI workgroup
Across accountsA central data account shares with business unit accounts
Across RegionsA warehouse in one Region shares with analysts in another
With subscribersDatashares listed as products on AWS Data Exchange
Match the pairs

Datashare scopes

Exam skills 4.5.1

Match each scenario with the data sharing scope.

Log in to try this activity Interactive activities are free with an account.

Designs that use data sharing

Data sharing enables several architectures. In workload isolation, ETL and BI run in separate warehouses on the same data: heavy loads and transformations run on one, while dashboards run on another sized for concurrency, so neither slows the other.

In a data mesh, business domains publish datashares as data products, which other domains consume, with access governed through AWS Lake Formation and SageMaker Catalog. With multi-warehouse writes, consumers that are granted write permissions can also write to shared databases, so several warehouses can contribute to the same data without copying it between them.

The following diagram shows the producer, the datashare and the consumer when a central warehouse shares sales data with a finance account.

The sales datashare. The central warehouse in the producer account adds the sales schema to a datashare and grants it to the finance account. Finance creates a database from the share and queries it with its own Serverless compute. Nothing is copied: both read the same managed storage, so finance sees every committed change immediately and pays for its own queries.
The scenario is illustrative.
True or false

Data sharing designs

Exam skills 4.5.7 · 4.5.1

Decide whether each statement about data sharing is true.

Log in to try this activity Interactive activities are free with an account.
Worked example

Giving finance live sales data

The finance team's Redshift Serverless workgroup, in another account, needs the sales schema from the central warehouse, always current, without slowing the central warehouse. The producer creates and grants a datashare, as follows.

-- Producer (central warehouse)
CREATE DATASHARE sales_share;
ALTER DATASHARE sales_share ADD SCHEMA sales;
ALTER DATASHARE sales_share ADD ALL TABLES IN SCHEMA sales;
GRANT USAGE ON DATASHARE sales_share TO ACCOUNT '222222222222';

-- Consumer (finance), after the share is authorised and associated
CREATE DATABASE sales_db FROM DATASHARE sales_share OF ACCOUNT '111111111111' NAMESPACE '<producer-namespace-id>';

Finance queries sales_db with its own compute and pays for its own usage; nothing is copied, and every committed change in the central warehouse is visible immediately.

Check yourself

Whose compute runs queries on a datashare?

Show answer

The consumer's, so sharing data does not load the producer's warehouse.

Exam Tips

Remember for the exam

  • To share live data with another account or cluster without copying it, use data sharing.
  • Consumers query datashares with their own compute.
  • To isolate ETL from BI workloads, run separate warehouses connected by data sharing.
  • Data sharing requires RA3 clusters or Redshift Serverless.
  • Datashares can be offered to subscribers through AWS Data Exchange.