Skip to main content
Connect AnomalyArmor to any PostgreSQL-compatible database. This guide covers self-hosted PostgreSQL as well as managed services like Amazon RDS, Aurora, and Supabase.
Network diagram showing AnomalyArmor connecting to PostgreSQL through security group

Supported Versions & Platforms

PlatformMinimum VersionNotes
PostgreSQL12+Self-hosted or any cloud
Amazon RDS12+All instance classes
Amazon AuroraPostgreSQL 12+Cluster and serverless
SupabaseAnyDirect connection or pooler
Google Cloud SQL12+Public or private IP
Azure Database12+Single server or flexible
Heroku PostgresAnyRequires SSL

Connection Settings

FieldDescriptionExample
Connection NameFriendly identifierProduction PostgreSQL
HostHostname or IP addressdb.example.com
PortDatabase port5432
DatabaseDatabase namemyapp_production
UsernameDatabase useranomalyarmor
PasswordUser password••••••••
SSL ModeSSL configurationrequire

SSL Mode Options

ModeDescriptionWhen to Use
disableNo SSLLocal development only
requireSSL required, no verificationRecommended for most cloud providers
verify-caVerify server certificateHigh security requirements
verify-fullVerify certificate and hostnameMaximum security
Never use disable for production databases. Most cloud providers (RDS, Aurora, Supabase) require SSL.

Creating a Read-Only User

Create a dedicated user with minimal permissions.
Quick Setup: Download the PostgreSQL permissions script for a ready-to-use SQL template with all necessary grants.
-- Create the user
CREATE USER anomalyarmor WITH PASSWORD 'your-secure-password';

-- Grant connection access
GRANT CONNECT ON DATABASE your_database TO anomalyarmor;

-- Grant schema access (repeat for each schema)
GRANT USAGE ON SCHEMA public TO anomalyarmor;
GRANT USAGE ON SCHEMA analytics TO anomalyarmor;

-- Grant read access to existing tables
GRANT SELECT ON ALL TABLES IN SCHEMA public TO anomalyarmor;
GRANT SELECT ON ALL TABLES IN SCHEMA analytics TO anomalyarmor;

-- Grant access to future tables (recommended)
ALTER DEFAULT PRIVILEGES IN SCHEMA public
GRANT SELECT ON TABLES TO anomalyarmor;

ALTER DEFAULT PRIVILEGES IN SCHEMA analytics
GRANT SELECT ON TABLES TO anomalyarmor;

Verifying Permissions

Test that the user can access metadata:
-- Should return tables
SELECT table_name FROM information_schema.tables
WHERE table_schema = 'public' LIMIT 5;

-- Should return columns
SELECT column_name, data_type FROM information_schema.columns
WHERE table_schema = 'public' LIMIT 5;

Provider-Specific Instructions

Amazon RDS PostgreSQL

Connection Details:
  • Host: Your RDS endpoint (e.g., mydb.abc123.us-east-1.rds.amazonaws.com)
  • Port: 5432 (default)
  • SSL Mode: require
Security Group Configuration:
  1. Go to AWS Console → RDS → Your Instance → Security Groups
  2. Edit inbound rules
  3. Add rule:
    • Type: PostgreSQL
    • Port: 5432
    • Source: AnomalyArmor IPs (see Settings → Security)
┌────────────────────────────────────────────────────────────┐
│  Security Group: sg-abc123                                  │
├────────────────────────────────────────────────────────────┤
│  Inbound Rules                                              │
│  ──────────────                                             │
│  PostgreSQL │ TCP │ 5432 │ 34.xxx.xxx.xxx/32 │ AnomalyArmor│
│  PostgreSQL │ TCP │ 5432 │ 34.xxx.xxx.xxx/32 │ AnomalyArmor│
└────────────────────────────────────────────────────────────┘
Parameter Group (if using verify-ca or verify-full):
  • Ensure rds.force_ssl = 1
  • Download RDS CA certificate bundle
RDS instances in private subnets require NAT Gateway or VPC peering for AnomalyArmor access. Contact us for Enterprise VPC peering options.

Connection Pooling Considerations

If you use a connection pooler (PgBouncer, Pgpool):

PgBouncer

  • Transaction mode: Works with AnomalyArmor
  • Session mode: Recommended for best compatibility
  • Statement mode: May have issues with complex queries
┌─────────────────────────────────────────────────────────────┐
│  Recommended: Connect directly to PostgreSQL, not through   │
│  PgBouncer, unless you have connection limit constraints.   │
└─────────────────────────────────────────────────────────────┘

Connection Limits

AnomalyArmor uses 1-2 connections during discovery. If you’re near your connection limit:
  1. Use a read replica for monitoring
  2. Schedule discovery during off-peak hours
  3. Increase max_connections if possible

What We Query

AnomalyArmor runs these types of queries:
-- Tables and views
SELECT * FROM information_schema.tables
WHERE table_schema NOT IN ('pg_catalog', 'information_schema');

-- Columns
SELECT * FROM information_schema.columns
WHERE table_schema NOT IN ('pg_catalog', 'information_schema');

-- Constraints
SELECT * FROM information_schema.table_constraints;

-- Freshness (for timestamp columns)
SELECT MAX(your_timestamp_column) FROM your_table;
Impact: Minimal. These are lightweight metadata queries.

Troubleshooting

Causes:
  • Firewall blocking the connection
  • Wrong hostname or port
  • Database not running
Solutions:
  1. Verify AnomalyArmor IPs are allowlisted
  2. Check security group rules (for RDS/Aurora)
  3. Test connectivity: nc -zv hostname 5432
  4. Verify database is accepting connections
Causes:
  • Wrong password
  • User doesn’t exist
  • pg_hba.conf not configured
Solutions:
  1. Verify password (copy-paste to avoid typos)
  2. Confirm user exists: SELECT usename FROM pg_user;
  3. Check pg_hba.conf allows the connection method
  4. Try resetting the password
Causes:
  • Database requires SSL but connection uses disable
  • Wrong SSL mode for the server
Solutions:
  1. Set SSL Mode to require
  2. For RDS/Aurora/Supabase: SSL is required
  3. For self-hosted: Enable SSL or allow non-SSL (not recommended)
Causes:
  • User lacks SELECT permission
  • Schema permission missing
Solutions:
-- Grant schema access
GRANT USAGE ON SCHEMA public TO anomalyarmor;

-- Grant table access
GRANT SELECT ON ALL TABLES IN SCHEMA public TO anomalyarmor;
Causes:
  • User can’t see tables in information_schema
  • Schema filter excluding all schemas
Solutions:
  1. Test as the user: SELECT * FROM information_schema.tables LIMIT 5;
  2. Check schema filter settings in AnomalyArmor
  3. Verify tables exist in the expected schemas

Next Steps

Run Discovery

Scan your PostgreSQL database

Set Up Alerts

Get notified of schema changes