RDS Database Setup
Set up a managed PostgreSQL database for Hivel services to connect to.
Provision RDS PostgreSQL Instance
Go to AWS RDS Console and create a PostgreSQL database with these settings:
Engine: PostgreSQL 12–15 (tested versions for this deployment)
Instance Class:
db.t3.mediumor larger (minimum supported)Storage: 20GB+ (gp3)
Master Username:
postgres(fixed, do not change)Master Password: Choose a strong password and save it securely (see Security and Secrets)
Configure the DB Parameter Group:
Create a custom parameter group for your PostgreSQL version
Set
rds.force_sslto0(this deployment uses network-level isolation as the security boundary)Attach the parameter group to your RDS instance
Reboot if AWS requires it
Note these values for later:
RDS Endpoint (e.g.,
mydb.xxxxx.ap-south-1.rds.amazonaws.com)Port (usually 5432)
Master Username
Master Password
Expected result: RDS console shows status as Available.
Configure RDS Security Group
RDS must be accessible only from your VM. No external access.
Go to RDS Console → Your Database → Connectivity & security
Click on the Security Group
Edit inbound rules and add:
Type: PostgreSQL
Port: 5432
Source: VM Security Group ID
Expected result: connection test from the VM to RDS succeeds on port 5432.
Important: Credentials and Two-Phase Approach
Hivel uses a two-phase credential approach for security:
Phase 1 (Database Migration):
Use the RDS master (
postgres) credentials to run the Flyway migration.Flyway needs elevated privileges to create schemas, tables, and users.
Include master credentials in
.envfor the migration step only.
Phase 2 (Services):
After migration completes, Flyway creates an application user with limited privileges
Switch
.envto use the application user credentials for all servicesThis follows the least-privilege security principle
For credential management details, see Security and Secrets.
Create the "insightly" Database
You must create the insightly database before deploying services. ("insightly" is Hivel's legacy internal product name. This is the correct database name, not a placeholder to rename.)
Option A: Using psql (Direct Connection)
Use this if you have network access from your VM (or your machine) to RDS:
Expected result: CREATE DATABASE executes with no error.
Option B: Using AWS RDS Query Editor
Use this if you only have AWS console access:
1. Go to AWS RDS Console → Your Database → Query Editor
2. Connect to your database
3. Run: CREATE DATABASE insightly;
Expected result: Query Editor reports successful execution.
If either option fails, see Troubleshooting.
Last updated