> For the complete documentation index, see [llms.txt](https://docs.smaq.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.smaq.io/documentation/connections/sql-databases/aws-rds.md).

# AWS RDS

This guide covers the AWS-specific pieces of connecting a PostgreSQL or MySQL database running on Amazon RDS. The actual SMAQ connection form steps are the same as any [SQL database](/documentation/connections/sql-databases.md).

### Step 1 — Collect connection details from RDS

In the AWS Console:

1. **RDS → Databases**.
2. Click your DB instance.
3. From the **Connectivity & security** tab, copy the **Endpoint** (e.g. `acme-prod.abc123.us-east-1.rds.amazonaws.com`) and **Port** (5432 for Postgres, 3306 for MySQL).
4. Note the **DB name** (Configuration tab).

> **\[Screenshot needed]** RDS instance Connectivity & security tab with Endpoint and Port highlighted.

### Step 2 — Make the database reachable from SMAQ

SMAQ connects from a fixed set of outbound IPs. Either:

* **Option A — Add SMAQ's IPs to your RDS security group** (recommended for production)
  1. Get SMAQ's outbound IPs from **<info@smaq.io>**.
  2. RDS → DB instance → Connectivity & security → VPC security group.
  3. Click the security group → Inbound rules → Edit.
  4. Add rules: **PostgreSQL (5432)** or **MySQL (3306)** from each of SMAQ's IPs.
  5. Save.
* **Option B — VPC peering** (enterprise only) Contact <info@smaq.io> to set up VPC peering between SMAQ's VPC and yours.

> **\[Screenshot needed]** RDS security group inbound rules with SMAQ IPs added.

### Step 3 — Create a read-only DB user

Don't give SMAQ your master DB password. Create a least-privilege user:

**Postgres:**

```sql
CREATE USER smaq_readonly WITH PASSWORD 'long-random-string';
GRANT CONNECT ON DATABASE your_db TO smaq_readonly;
GRANT USAGE ON SCHEMA public TO smaq_readonly;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO smaq_readonly;
ALTER DEFAULT PRIVILEGES IN SCHEMA public
  GRANT SELECT ON TABLES TO smaq_readonly;
```

**MySQL:**

```sql
CREATE USER 'smaq_readonly'@'%' IDENTIFIED BY 'long-random-string';
GRANT SELECT ON your_db.* TO 'smaq_readonly'@'%';
FLUSH PRIVILEGES;
```

### Step 4 — Add the connection in SMAQ

1. SMAQ project → **Data Source → Add data source**.
2. Pick **PostgreSQL** or **MySQL**.
3. Fill in:
   * **Host**: the RDS endpoint
   * **Port**: 5432 or 3306
   * **Database**: your DB name
   * **Username**: `smaq_readonly`
   * **Password**: the password you set
   * **SSL mode**: Require
4. Click **Test connection**. SMAQ should report the tables it discovered.
5. Name and click **Connect**.

> **\[Screenshot needed]** SMAQ connection form filled in for an RDS Postgres instance.

### Troubleshooting

* **Timeout** — security group isn't allowing SMAQ's IPs, or the RDS instance has Publicly accessible = No without VPC peering.
* **"SSL required" error** — set SSL mode to **Require** in SMAQ's connection form.
* **"Permission denied for table X"** — re-run the GRANT SELECT step. New tables won't be readable by default; the `ALTER DEFAULT PRIVILEGES` line above handles future tables.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.smaq.io/documentation/connections/sql-databases/aws-rds.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
