2.7 KiB
2.7 KiB
How to Get Admin Database Credentials
For AWS RDS Databases
Option 1: AWS RDS Master User (Easiest)
The master user created when you set up the RDS instance has superuser privileges.
-
Go to AWS RDS Console
- Navigate to: https://console.aws.amazon.com/rds/
- Select your database instance
-
Find Master Username
- In the instance details, look for "Master username"
- This is usually
postgresor a custom name you set
-
Get Master Password
- If you forgot it, you can reset it:
- Select your instance → "Modify" → Change master password
- Or use AWS Secrets Manager if configured
- If you forgot it, you can reset it:
-
Use in .env:
ADMIN_DATABASE_URL=postgresql://master_username:master_password@db.livingai.app:5432/livingai_test_db
Option 2: AWS RDS Query Editor
If you have AWS Console access:
- Go to RDS Console → Your Database → "Query Editor"
- Connect using master credentials
- Run the SQL commands directly:
GRANT USAGE ON SCHEMA public TO read_write_user; GRANT CREATE ON SCHEMA public TO read_write_user; CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
Option 3: Store Admin Credentials in AWS SSM
If you want to automate this:
-
Store admin credentials in AWS SSM Parameter Store:
aws ssm put-parameter \ --name "/test/livingai/db/admin" \ --type "SecureString" \ --value '{"user":"admin_user","password":"admin_password","host":"db.livingai.app","port":"5432","database":"livingai_test_db"}' \ --region ap-south-1 -
Or set the parameter path in .env:
AWS_SSM_ADMIN_PARAM=/test/livingai/db/admin -
Run the setup script:
npm run setup-db
Option 4: Use psql Command Line
If you have psql installed and network access:
psql -h db.livingai.app -p 5432 -U master_username -d livingai_test_db
Then run:
GRANT USAGE ON SCHEMA public TO read_write_user;
GRANT CREATE ON SCHEMA public TO read_write_user;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
For Local Docker Databases
If using local Docker PostgreSQL:
ADMIN_DATABASE_URL=postgresql://postgres:password123@localhost:5433/farmmarket
The default postgres user has superuser privileges.
Security Notes
⚠️ Important:
- Never commit admin credentials to git
- Use AWS SSM Parameter Store or AWS Secrets Manager for production
- Rotate admin passwords regularly
- Use the admin account only for setup/maintenance, not for application connections
After Getting Credentials
-
Add to
.env:ADMIN_DATABASE_URL=postgresql://admin:password@host:port/database -
Run setup:
npm run setup-db -
Restart your application