Overview
AgentOS uses PostgreSQL for:- Agent memory and sessions
- Knowledge embeddings (pgvector)
- Custom application data
ag infra up prd:aws.
Prerequisites
Complete Secrets Setup first. The database credentials must exist before deployment.Database Credentials
Editinfra/secrets/prd_db_secrets.yml:
RDS Configuration
Default configuration inprd_resources.py:
| Setting | Default | Description |
|---|---|---|
engine | postgres | PostgreSQL |
engine_version | 17.2 | PostgreSQL 17 |
allocated_storage | 64 | 64 GB storage |
db_instance_class | db.t4g.small | ~$25/month |
db_name | ai | Database name |
port | 5432 | PostgreSQL port |
Customize RDS
Editprd_resources.py:
prd_resources.py
Some changes (like instance class) require a reboot. Check AWS Console for status.
Connection Settings
The app connects via environment variables set automatically inprd_resources.py:
| Variable | Source |
|---|---|
DB_HOST | RDS endpoint (auto-populated) |
DB_PORT | RDS port (auto-populated) |
DB_USER | From prd_db_secrets.yml |
DB_PASS | From prd_db_secrets.yml |
DB_DATABASE | RDS database name |
Migrations
Option 1: Run on Deployment
AddMIGRATE_DB to prd_resources.py:
prd_resources.py
Option 2: Run Manually via ECS Exec
Verify Connection
After deployment, verify the database is accessible:psql):
Troubleshooting
| Issue | Solution |
|---|---|
| Cannot connect to RDS | Check security group allows port 5432 from your IP |
| Connection fails silently | Remove special characters from password |
| RDS not ready | Wait ~5 minutes, check AWS Console |
| ECS can’t connect | Verify security group allows ECS security group |