# PostgreSQL

The PostgreSQL integration enables P0 to manage secure, granular access control for fully managed PostgreSQL databases on **Google Cloud SQL** and **Amazon RDS for PostgreSQL**. With this integration, security and platform engineering teams can automate access provisioning and de-provisioning, enforce least privilege, and audit all database access events for compliance.

## How It Works

P0 ensures there is a dedicated database user for every identity that accesses the database by attaching users to the Cloud SQL instance using [IAM authentication](https://cloud.google.com/sql/docs/postgres/add-manage-iam-users). Additionally, P0 dynamically provisions the requested access for these users inside the PostgreSQL database by granting the requested role, or generating a role on-the-fly for custom SQL query access. Events are captured with native PostgreSQL session and query logging, tied to the original user identity.

To begin configuring the integration, review the detailed setup instructions for connecting your PostgreSQL database on [Google Cloud SQL](/integrations/resource-integrations/postgresql/installing-an-cloudsql-database.md) or [Amazon RDS for PostgreSQL](/integrations/resource-integrations/postgresql/installing-an-rds-database.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.p0.dev/integrations/resource-integrations/postgresql.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
