---
title: "How to Set Up Row-Level Security in Postgres Using AWS Cognito"
url: https://daily.dev/posts/how-to-set-up-row-level-security-in-postgres-using-aws-cognito-sd1inrzj5
source_url: https://neon.com/blog/how-to-set-up-row-level-security-in-postgres-using-aws-cognito
type: article
source: "Neon"
published: 2026-07-09T06:57:46.531Z
updated: 2026-07-09T07:00:04.993Z
tags: ["aws", "postgresql", "jwt"]
reading_time: 5
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Set Up Row-Level Security in Postgres Using AWS Cognito

**[Neon](https://daily.dev/sources/neontech)** · 5 min read · 0 upvotes · 0 comments

## Summary

A step-by-step guide to implementing row-level security (RLS) in Postgres using AWS Cognito JWTs for authorization. The setup uses Neon as the serverless Postgres provider and Neon Authorize to validate JWTs and map their claims (specifically the `sub` claim) to Postgres session variables, enforcing per-user data access policies. The demo app uses Express.js and HTMX, with steps covering Cognito User Pool configuration, Postgres RLS policy setup, middleware integration, and local testing.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://neon.com/blog/how-to-set-up-row-level-security-in-postgres-using-aws-cognito>

---

Tags: [#aws](https://daily.dev/tags/aws), [#postgresql](https://daily.dev/tags/postgresql), [#jwt](https://daily.dev/tags/jwt)

[View this post on daily.dev](https://daily.dev/posts/how-to-set-up-row-level-security-in-postgres-using-aws-cognito-sd1inrzj5)
