<a id="cli-aws-amplifygen3-db"></a>

# db

## Description

Connect to and inspect a cloud environment’s backend database through the branch’s Postgres relay, signed in with an AWS Sign-In token.

- `aws amplifygen3 db token` prints the connection details.
- `aws amplifygen3 db connect` opens an interactive psql shell.
- `aws amplifygen3 db query` runs a SQL statement and renders the rows.
- `aws amplifygen3 db lint` type-checks the schema.
- `aws amplifygen3 db dump` runs pg_dump.
- `aws amplifygen3 db inspect` runs one read-only diagnostic.
- `aws amplifygen3 db report` runs every diagnostic to CSV files.

All but `aws amplifygen3 db token` run psql (or pg_dump) in a container from the local backend image, as the `aws amplifygen3 local db` commands do, so they need Docker running and no PostgreSQL client on this machine. To run one installed here instead, pass –psql (psql 16+) or –pg-dump (pg_dump 17+). For the local stack, use `aws amplifygen3 local db`.

## Synopsis

```
db
```

## Options

*None*

## Available Commands

* [connect](connect.md)
* [dump](dump.md)
* [inspect](inspect.md)
* [lint](lint.md)
* [query](query.md)
* [report](report.md)
* [token](token.md)
