Cloud concept · Updated

Row-Level Security - Row-level security restricts which records a user or application can access within a shared dataset according to centrally enforced authorization rules.

In short

Row-level security allows multiple users or tenants to share tables and dashboards while seeing only the records they are authorized to access. It combines identity or trusted session attributes with data attributes, such as tenant, department, or region, to enforce access without maintaining separate datasets for every audience.

Cloud Concepts Hub →

6 key aspects of Row-Level Security

Effective row-level security combines trusted identity, record-level policies, complete access-path coverage, and testing of both authorization behavior and query performance.

01
Record-level authorization

Access rules select the records a principal may access within a shared table or dataset. Common policy attributes include tenant identifiers, regions, departments, and record ownership.

02
Trusted identity and entitlement mapping

Policies depend on authenticated identities, group memberships, or securely established session attributes. Never let a client directly choose the tenant or entitlement used for authorization without server-side validation.

03
Enforcement at the correct boundary

Database policies and visualization-dataset policies protect different access paths. Restrict direct source access when relying on visualization-layer enforcement, and verify how viewer identity reaches the enforcement layer.

04
Reusable, audience-specific visualizations

A shared dashboard can display different records and aggregates for different viewers. Security rules must remain effective regardless of dashboard filter selections or navigation.

05
Policy correctness and performance

Test entitlement combinations, unmatched users, privileged roles, and query execution costs. Entitlement joins and complex predicates can affect latency, so benchmark realistic data volumes and concurrency.

06
Controlled downstream access

Verify that exports, cached results, imported datasets, and alternate query interfaces preserve the intended restrictions. Copies of authorized results require their own access controls once they leave the enforcement boundary.

Cloud services for Row-Level Security

Amazon QuickSight can apply viewer-specific restrictions to a shared analytical dataset, while Amazon Redshift or Amazon RDS for PostgreSQL can enforce row policies at the database layer. AWS Lake Formation provides row filtering for supported governed data-lake queries. These controls can complement one another, but policies do not automatically transfer between layers. A visualization service using a shared source identity needs its own viewer-aware enforcement or supported identity propagation. Restrict alternate storage and database access, and test imports, query results, and exports to confirm that the intended audience sees only authorized records.

Amazon QuickSightAmazon QuickSight

Amazon QuickSight Enterprise Edition supports dataset row-level security using rules that associate users or groups with permitted data values. This allows a shared dashboard to display viewer-specific records; tag-based row-level security is also available for supported embedded analytics scenarios.

Amazon RedshiftAmazon Redshift

Amazon Redshift supports row-level security policies that restrict rows available through warehouse queries. Policies can use database identity or trusted session context, but privileged bypass permissions and shared connection identities must be considered.

AWS Lake FormationAWS Lake Formation

AWS Lake Formation supports data filters that define row-level restrictions on Data Catalog tables for supported integrated query engines. Effective protection also requires controlling direct access to the underlying storage so users cannot bypass the governed query path.

Row-Level Security exam questions

Real practice exam questions on Row-Level Security, with the correct answer and its explanation. Answer them with every option in the exam simulator.

DVA-C02

A developer maintains a multi-tenant application that stores confidential invoices in a shared Amazon RDS for PostgreSQL table. Each invoice has a tenant_id column. The application uses one database login and a connection pool that reuses connections across tenants. Trusted application middleware determines the authorized tenant for each request. A security review requires the database to prevent requests from reading or writing another tenant's invoices, even if a developer omits a tenant filter from a SQL statement. Tenant context must not remain active when a pooled connection is reused. Which solution meets these requirements?

Show answerCORRECT ANSWER

Enable PostgreSQL row-level security on the invoices table. Define USING and WITH CHECK policies that compare tenant_id with a tenant setting and deny access when the setting is absent. Use a non-owner login without BYPASSRLS, and have the middleware set the authorized tenant with SET LOCAL inside each request's database transaction.

Row-level security enforces tenant restrictions in the database even when SQL statements omit tenant filters. USING restricts accessible existing rows, and WITH CHECK restricts inserted or updated rows. A non-owner role without BYPASSRLS is subject to the policies. SET LOCAL limits the trusted tenant setting to the current transaction, preventing it from carrying over when a pooled connection is reused.

SAP-C03

A SaaS company stores data for 2,000 tenants in shared tables in Amazon RDS for PostgreSQL. Each tenant-owned row includes a tenant_id column. A trusted application tier authorizes each request against a server-side tenant directory and uses a connection pool with one shared database login. The login currently owns the tables. Each request's database work runs in a single transaction, and connections are reused across tenants.

A security review finds that some application queries omit tenant predicates and that tenant context can remain on a connection after a request completes. The company must enforce tenant boundaries for reads and writes in the database, including when application queries omit tenant predicates. Missing tenant context must deny access. The company must retain shared tables and the shared connection pool. Protection against a compromised application tier is outside the scope of this change.

Which solution meets these requirements?

Show answerCORRECT ANSWER

Use a non-owner login without superuser or BYPASSRLS privileges. Enable and force row-level security on tenant-owned tables, with USING and WITH CHECK policies that require matching tenant context and deny access when it is missing. Set trusted tenant context with SET LOCAL inside every request transaction.

The restricted application role is subject to row-level security. USING expressions constrain existing rows that can be read or modified, and WITH CHECK expressions constrain inserted or updated row values. Fail-closed policies deny access without tenant context. SET LOCAL limits the context to the current transaction, preventing it from leaking into subsequent requests that reuse the connection.

SAA-C03

A retailer needs interactive sales dashboards for 200 regional managers. To provide fast responses without querying the source database during dashboard interactions, the company requires one shared in-memory dataset and one published dashboard. Each sales record includes a region_code field. Managers will sign in as registered users, and each manager must see only records for their assigned regions, including in drill-down views and exported data. Managers must not have direct access to the source database.

Which solution meets these requirements with the LEAST ongoing administration?

Show answerCORRECT ANSWER

Import the sales data into Amazon QuickSight SPICE. Apply row-level security to the dataset by using a rules dataset that maps QuickSight groups to allowed region_code values, and manage regional access through group membership.

QuickSight row-level security restricts the records accessible to each registered viewer based on user or group permissions. A group-to-region rules dataset allows one SPICE dataset and one dashboard to serve all managers while enforcing restrictions in visuals, drill-downs, and exports. Group membership simplifies ongoing administration.

Practice Row-Level Security in a full exam

Questions on Row-Level Security in each practice exam, with every answer option and an explanation for each:

Start a free practice exam

What is Row-Level Security

2 min read

Row-level security is an authorization mechanism that controls access to individual records rather than granting access to an entire table or dataset. A regional sales manager might be allowed to query a shared sales table but receive only records for the regions they manage. Another manager can run the same query or open the same dashboard and receive different results because the security policy evaluates their identity and entitlements.

A typical implementation associates each record with an authorization attribute, such as a tenant identifier or business unit. A policy compares that attribute with the authenticated user's permitted values, often through an entitlement table or a trusted session context. For example, an order is visible only when its tenant identifier matches the tenant assigned to the current application session. The session attribute must come from trusted authentication and authorization logic, not an editable browser parameter.

In cloud architectures, enforcement can occur in a database, data warehouse, governed query layer, or business intelligence dataset. Database enforcement protects supported queries that reach the database under the relevant security context. Visualization-layer enforcement protects access through that analytical dataset, but does not automatically restrict separate access to its underlying database or object storage. Engineers must identify every route to the data and apply appropriate controls at each boundary.

For visualization scenarios, row-level security enables one dashboard to serve many departments, customers, or geographic teams. Instead of publishing a separate dashboard for each audience, the visualization service filters the accessible records according to the viewer's permissions. Aggregations should reflect those authorized records, so a regional manager's revenue total represents their permitted regions rather than the entire company. Ordinary dashboard filters are not a substitute: a viewer-controlled region selector changes presentation, not authorization.

Identity propagation is a critical design decision. If a dashboard uses one shared database account, a database policy based only on that account cannot distinguish individual dashboard viewers. The architecture must either propagate a supported, trusted viewer context or enforce viewer-specific restrictions in the visualization layer. Imported analytical datasets also require care: source policies may restrict the identity performing the import, but do not automatically create different permissions for subsequent viewers of that imported copy.

The main trade-offs are policy complexity, performance, and operational overhead. Large entitlement mappings, joins, and complex predicates can increase query cost or latency; suitable indexing, data layout, and representative load tests help assess the impact. Centralized policies reduce duplicated application logic, but incorrect mappings can expose records or unexpectedly hide them. Design missing or unrecognized entitlements to deny access, and explicitly test how multiple grants, groups, null values, and privileged roles interact.

Row-level security is not column masking, encryption, or complete tenant isolation. A user authorized to see a record may still need separate restrictions on sensitive fields. Some privileged roles can bypass policies, and authorized exports create copies outside the original enforcement boundary. Validate dashboard totals, drill-through paths, exports, pooled connections, and cache behavior using different identities, and audit both entitlement changes and privileged access.

Learn Row-Level Security in lessons

2 short lessons on Row-Level Security in 2 certification courses.

Open the lessons