Getting Started with AWS Clean Rooms Service

Rajas Walavalkar
8 min readJul 27, 2023

INTRODUCTION

Consider, a situation or a use case in which you are an Analysts working in a renowned airlines company and your job is to create reports and analyze the passengers of your airlines and what are their viewing habit's. To create these customer analytical reports the first and foremost requirement would be to get the client’s social media and offline purchase data. For, this you would get into data partner agreements to share the data with your team and then you would analyze the users. Now this process works very well in a small case scenario, but lets say you want to generate reports that would require various types of customer related data, then you would have to define the method of data sharing across these data partners and also would have to manage the data security aspects of it. This would take good amount of time and effort to setup those pipelines.

Now what If I tell you, that you could share and collaborate with different data partners within minutes and start using their datasets to generate greater and much powerful insights which can help you drive good business decisions. For this you can leverage AWS Clean Rooms service and get all the benefits of it. AWS Clean Rooms is one of the latest AWS service that was launched during first quarter of 2023, which has made collaborations much more simpler than earlier.

Let me define the AWS Clean Rooms service you — “AWS Clean Rooms is a service that makes it easier for you and your partners to analyze and collaborate on collective datasets to gain insights, without sharing or copying one another’s underlying data or having to move it outside of AWS” — Official AWS Definition

In this blog we are going to see easy it is to getting started with AWS Clean Rooms with a suitable example and hands-on lab. Let’s get started then!

PROBLEM STATEMENT—

Keeping the continuity of the initial use case lets define a problem statement for hour hands-on lab. A brand marketer at the airlines, needs to know which of the advertisements campaign that ran on the social media platform led to the most ticket sales of the airlines.

STEP 1: Lets create a AWS Clean Rooms Collaboration from the Airlines AWS Account

For this we are logged in on to the Airlines AWS account and lets go to the AWS Clean Rooms service on this account. Over here you need to click on the Collaboration button and then fill in the details as bellow

Collaboration name — Airlines Collaboration

Description — Airlines to collaborate with other Data Partners

Member 1 : Member display name — Airlines

Member 1: Member AWS account ID — by default it will have your AWS account mentioned

Member 2: Member display name — Social Media

Member 2 : Member AWS account ID — Mention the AWS account ID of the Social Media’s AWS account which has the Data stored

Member abilities — Choose the Airlines AWS account from the drop down

Check in the selection for the Support query logging in this collaboration option

Then Click on NEXT..

On the second page of the form, for the Log storage in Amazon CloudWatch Logs — Select TURN ON option

Then Click on Next and it will take you to the review page and you can review the options selected and the click on Create Collaboration and Membership button.

Review Page of Creating Collaboration on AWS Clean Rooms — 1
Review Page of Creating Collaboration on AWS Clean Rooms — 2

You can check the above two screenshots which will give you clear picture on what are the options that you can select to create a Clean Rooms Collaboration.

Note — Till now we have achieved ? — We have successfully created a Collaboration from the Airlines AWS account and have added Social media’s AWS account ID as a member of the collaboration.

STEP 2: Let’s accept the collaboration invite from the Social Media’s AWS account and create a membership for the collaboration.

For this, lets login into the Social Media’s AWS account and go to the AWS Clean Rooms service. When you check the collaborations section on the left hand side, you would see the invitation.

Collaboration Invitation on the Social Media’s AWS account

Once you click on the Available to Join section which is highlighted in the above image, you would see the collaboration invitation details. Click on the collaboration name and then it will open up the details page. Here click on the Create Membership button on the top right corner.

Here, you can select the Log storage in Amazon CloudWatch Logs option and then click on the Create Membership button.

With this, now we have a collaboration ready to go with two active members — one is Airlines and other one is the Social Media.

STEP 3: Configure a new table and Associate the Impression Table from the Social media AWS Account to the collaboration that we have accepted

In this you need to click on the configure new table button and then select the database and the table that you want to add to the collaboration

In this you can select whether you want to expose all the columns or just a subset of it to the Airlines and then provide a name to the table

Then click on Configure New Table button after filling in all the details above.

Once you have create the table then we need to define Analysis rule for the table, for that click on the Configure Analysis Rule and then select the aggregation option and go to the next page, here you can define the which aggregate functions can be leveraged on which columns

Configure Analysis Rule — 1

Then you can define how do you want to control the joining options on this table and on which columns

Configure Analysis Rule — 2

Then you can control which dimensions you can leverage in the SQL Queries for the table

Configure Analysis Rule — 3

In the next section you can even control which rows in the query results can be returned depending on certain threshold values which you can define here.

Configure Analysis Rule — 4

This brings to the end of this configuration and then just click on the Configure Analysis rule button at the end.

Once you have created the new table, you can associate the table to the collaboration by clicking on Associate to collaboration on the top right corner and then in the drop down you need to select the collaboration which we had accepted in the previous step.

STEP 4: Repeat Step 3 in the Airlines AWS account that is to be shared with the Social Media Account

We will be repeating the previous steps and will be adding a table which includes the purchase data information from the Airlines AWS account into the collaboration, which we need to join with the Social Media’s impressions table.

  • Configure New Table in the Collaboration
  • Configure Analysis Rule on this new table
  • Associate the table to the collaboration which we created in the Step 1

After completing the above steps we are now done with all the configurations related to the collaboration between the Airlines and the Social Media companies and now our Data Analyst from the Airlines can actually start to analyze and generate reports out of it.

STEP 5: Querying the data shared between the Airlines and Social Media using the collaboration

Now, from the Airlines AWS Account when open up the collaboration tab within the Clean Rooms Service, we will see our collaboration named as Airlines Collaboration, if you click on it, you will open up the screen where you can query your tables

Clean Rooms Collaboration — Query Editor

If you check the above image you can see that this a query editor view that you get — in which you have all the tables listed on the left hand side which you can query, their attributes and data types and then a Query panel where you can write your analytical Query.

NOTE : Before, you start querying the data — you need to configure the output S3 bucket location where the results of the queries that you will be running here needs be saved. For this below the query editor you see an option where you can configure the output S3 location

Now Let’s write a query, in which we will join the Impression (Social media) and the Purchase (Airlines) table on the hashed_email column and then get the sum of the clicks across different behavior segments

Select impression.behaviorseg as Segment, sum(impression.clicks) as Clicks
FROM purch_purchase_data inner join impression
ON purch_purchase_data.hashed_email = impression.hashed_email
GROUP BY impression.behaviorseg
ORDER BY sum(impression.clicks) DESC;
Clean Rooms Collaboration — Query Result Output

This is how simple it is to make the collaboration and add multiple partners who can contribute to the collaboration. This service has a lot of more features that I could have gone into details, but considering the length of this blog would like to put a logical end here. But surely, you will be seeing multiple technical blogs coming on this service

CONCLUSION

I hope that this blog was fairly simple to understand and it will surely help you to get started on the implementation part of the AWS Clean Rooms service. As it is one of the newest service that AWS has launched — so there will be many more features that we will be seeing incorporated as a part of this service.

Do let me know, if you have any questions you have around this or any difficulties you might face during trying out this blog in your account. Put all your question in the comments below, will try my best to answer those to the best of my knowledge.

REFERENCES

  1. AWS Clean Rooms Intro — https://aws.amazon.com/clean-rooms/
  2. AWS Clean Rooms Documentation — https://docs.aws.amazon.com/clean-rooms/latest/userguide/what-is.html
  3. Troubleshooting AWS Clean Rooms — https://docs.aws.amazon.com/clean-rooms/latest/userguide/troubleshooting.html
  4. Service Quotas AWS Clean Rooms — https://docs.aws.amazon.com/clean-rooms/latest/userguide/quotas.html
  5. Clean Rooms Best Practices — https://docs.aws.amazon.com/clean-rooms/latest/userguide/best-practices.html

--

--

Rajas Walavalkar

Technical Architect - Data & AWS Ambassador at Quantiphi Analytics. Worked on ETL, Data Warehouses, Big Data (AWS Glue, Spark), BI & Dashboarding (D&A).