Lab complete!
Now that you have completed this lab, make sure to update your Well-Architected review if you have implemented these changes in your workload.
Click here to access the Well-Architected Tool
The producer cluster administrator, who wants to share data, first sets up the producer cluster for data sharing by running the below commands in the query editor:
Make sure you are connected to the producer cluster as Admin in us-east-1
region. Then go to query editor to run below command:
CREATE DATASHARE MarketingShare;
The producer cluster administrator then adds the needed database objects. These might be schemas, tables, and views to the datashare and specifies a list of consumers that the objects to be shared with:
ALTER DATASHARE MarketingShare ADD SCHEMA public;
ALTER DATASHARE MarketingShare ADD TABLE public.lab_users;
ALTER DATASHARE MarketingShare ADD TABLE public.lab_venue;
ALTER DATASHARE MarketingShare ADD TABLE public.lab_category;
ALTER DATASHARE MarketingShare ADD TABLE public.lab_date;
ALTER DATASHARE MarketingShare ADD TABLE public.lab_event;
ALTER DATASHARE MarketingShare ADD TABLE public.lab_sales;
ALTER DATASHARE MarketingShare ADD TABLE public.lab_listing;
Go to the consumer cluster in us-west-1
and note down the cluster namespace from the Amazon Redshift cluster details page:
Go to producer cluster in us-east-1
and grant access on datashare to the Consumer cluster namespace (noted from previous step) :
GRANT USAGE ON DATASHARE MarketingShare TO NAMESPACE 'replace-with-your-consumer-cluster-namespace';
Let’s validate the steps performed in above steps by querying data dictionary of producer cluster:
SELECT * FROM svv_datashares;
You can see MarketingShare is an OUTBOUND datashare type.
SELECT * FROM svv_datashare_objects;
You can see list of objects and types (schema, table etc.) shared, and all of them are as OUTBOUND share type.
SELECT * FROM svv_datashare_consumers;
You can see which namespace(s), or clusters have been granted access to the data shares.
We have now granted access on the producer cluster data share to the consumer cluster. Next, let’s validate if the consumer cluster can access this data share.
Now that you have completed this lab, make sure to update your Well-Architected review if you have implemented these changes in your workload.
Click here to access the Well-Architected Tool