Minimum aggregation thresholds
Data aggregation is a privacy-enhancing technique that helps enforce anonymization by preventing queries from returning results about individuals or small groups. When minimum aggregation thresholds are configured on your tables, AWS Clean Rooms suppresses results that do not meet the data provider's specified minimum threshold.
Topics
Aggregation thresholds
You can configure minimum aggregation thresholds in a Custom analysis rule for your
configured table. Data providers specify the identityColumns and the
minimumIdentityCount, N. Supported values for
minimumIdentityCount are between 2 and 100,000. The
identityColumns value must be a string, varchar, or
char type. Minimum aggregation thresholds
ensure that each row in a SQL query result has at least N distinct data subjects contributing
to it. For information about how identityColumns interacts with query filters,
see Comparison controls.
The following example sets the minimum aggregation threshold to 100 with
user_id as the identityColumns value:
{ "aggregationThresholds": [ { "identityColumns": [ "user_id" ], "minimumIdentityCount": 100, "type": "COUNT_DISTINCT" } ] }
Overriding the minimum aggregation threshold for specific output columns
Output columns have different sensitivity levels, and data providers can enforce
different minimumIdentityCount values depending on the output column. For
example, campaign_id might be a low-sensitivity column with a minimum
threshold of 5 distinct data subjects, while postal_code and
income_bracket get a minimum threshold of 100 because they are
high-sensitivity columns.
A per-column override accepts 0, which exempts that output column from
minimum aggregation, or a value between 2 and 100,000.
The following example sets a minimum aggregation threshold override for the
campaign_id column:
{ "outputColumnThresholds": [ { "outputColumnName": "campaign_id", "minimumIdentityCount": 5 } ] }
Allowing nested expressions in aggregate functions
Allowing expressions inside aggregation functions increases the risk that data
subjects can be re-identified in clean room queries. The default setting for
allowedAggregateExpressionType is COLUMNS_ONLY, which is
recommended as the privacy-enhanced configuration. With this setting, only columns are
accepted inside an aggregation function, such as:
-
SUM(cost)
-
COUNT(DISTINCT campaign_id)
Alternatively, for collaborations where the query runner is a trusted partner, you
can allow ANY_EXPRESSION inside an aggregation function. This setting
increases the flexibility of SQL queries that can run on your data, but introduces
privacy risk because query runners can isolate small groups within an aggregation
function.
Privacy and compliance review required
Before allowing ANY_EXPRESSION inside aggregate functions, consult your
privacy, security, legal, and compliance teams to make sure that this adheres to your
organization's requirements.
The following is an example of an expression in an aggregation function that is generally considered safe:
-
SUM(cost * quantity)
The following is an example of an expression in an aggregation function that is considered a privacy risk:
-
SUM(CASE WHEN zip_code = '10001' THEN salary ELSE 0 END)
The following is a complete aggregationThresholds example:
{ "aggregationThresholds": [ { "identityColumns": [ "user_id" ], "minimumIdentityCount": 100, "type": "COUNT_DISTINCT", "allowedAggregateExpressionType": "COLUMNS_ONLY", "outputColumnThresholds": [ { "outputColumnName": "campaign_id", "minimumIdentityCount": 5 } ] } ] }
Configuring minimum aggregation thresholds in the console
You configure minimum aggregation thresholds as part of adding a custom analysis rule to a configured table, after the configured table exists. For the complete custom analysis rule guided flow, see Adding a custom analysis rule to a table (guided flow).
To configure minimum aggregation thresholds
-
Sign in to the AWS Management Console and open the AWS Clean Rooms console at https://console.aws.amazon.com/cleanrooms
. -
In the left navigation pane, choose Tables, and then choose your configured table.
-
On the configured table detail page, choose Configure analysis rule.
-
For Analysis rule type, choose Custom.
-
Choose either Review each new analysis or Allow any analysis by specific collaborators. The remaining steps follow the Allow any analysis by specific collaborators path.
-
Choose Add AWS account to configure which partners can submit analyses on this configured table, then choose the AWS account to allow.
-
On Specify analysis results controls - optional, for Enforce aggregation thresholds?, choose Yes.
-
Configure the minimum aggregation threshold.
-
Choose your identity column. The identity column must be a
string,varchar, orchartype. -
Specify your minimum identity count. Supported values are between 2 and 100,000.
-
Aggregate type is preconfigured to Count distinct.
-
-
For Allow nested expressions in aggregate functions?, the default is No. Leaving this option turned off is the privacy-enhanced configuration. For more information, see Allowing nested expressions in aggregate functions.
-
(Optional) Configure output column overrides.
-
Choose Add column override.
-
Choose your output column from the dropdown list.
-
Specify your minimum identity count. Supported values are
0to exempt the column from minimum aggregation, or between 2 and 100,000.
For more information, see Overriding the minimum aggregation threshold for specific output columns.
-
-
(Recommended) Configure columns allowed for comparison.
-
By default, all columns are eligible for comparison. Explicitly configuring which columns are allowed for literal and column-to-column comparison is the privacy-enhanced configuration.
-
Choose Custom list.
-
Choose which columns are allowed for literal comparison. For example, allowing the
statecolumn lets the query runner run a query with a literal filter, such asWHERE state = 'New York'. -
Choose which columns can be used for column-to-column comparison. For example, allowing the
statecolumn lets the query runner run a cross-table join with a column comparison, such asJOIN my_table t ON t.state = partner_table.state.
For more information, see Comparison controls.
-
-
Choose Next.
-
Choose Next. Differential privacy is turned off and is not supported with minimum aggregation thresholds or comparison controls. For more information, see Limitations.
-
Review your custom analysis rule configuration.
-
Choose Configure analysis rule.
-
Associate the configured table to a collaboration. For more information, see Step 2: Associate a configured table.
Considerations and limitations
Considerations and limitations apply when you use minimum aggregation thresholds. For the full list, see Considerations and limitations.