All posts

AWS CLI-Style Profiles in pgcli for Effortless Postgres Connections

I typed one command and my database connection felt like wielding AWS CLI — but for Postgres. Typing pgcli --profile staging connected me to the staging database instantly, no fumbling with long connection URIs or environment variables. AWS CLI-style profiles in pgcli are a game changer when you work with multiple Postgres databases across projects, teams, or environments. With AWS CLI, you switch between profiles like aws --profile production s3 ls. Imagine the same for pgcli: profiles stored

Free White Paper

Just-in-Time Access + AWS IAM Policies: The Complete Guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free. No spam. Unsubscribe anytime.

I typed one command and my database connection felt like wielding AWS CLI — but for Postgres.

Typing pgcli --profile staging connected me to the staging database instantly, no fumbling with long connection URIs or environment variables. AWS CLI-style profiles in pgcli are a game changer when you work with multiple Postgres databases across projects, teams, or environments.

With AWS CLI, you switch between profiles like aws --profile production s3 ls. Imagine the same for pgcli: profiles stored in one config file that map names to connection strings. Now you can run pgcli --profile production and jump straight into your production database shell. No more exporting PGHOST or PGPASSWORD. No need to remember parameters.

To set it up, create or edit your pgcli config file. It usually lives in ~/.config/pgcli/config. Add sections named after your profiles:

Continue reading? Get the full guide.

Just-in-Time Access + AWS IAM Policies: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.
[production]
host = prod-db.company.com
user = admin
dbname = main
password = securepassword

[staging]
host = staging-db.company.com
user = dev
dbname = app_dev
password = anotherpassword

After saving, connecting is effortless:

pgcli --profile production
pgcli --profile staging

You get tab-completion, syntax highlighting, and query formatting just like normal pgcli, but now with AWS CLI-style clarity and speed. Switching databases becomes muscle memory.

This method works well for local development, cloud environments, and CI/CD pipelines. It also makes onboarding new engineers faster: give them a single config file with all profiles preloaded, and they can explore or debug the right database with zero guesswork.

The payoff is small friction erased forever. Every keystroke saved compounds over time.

If you want to see AWS CLI-style profiles in pgcli running live, without touching your local machine or setting up configs, head to hoop.dev and you can connect to any Postgres database in minutes.

Get started

See hoop.dev in action

One gateway for every database, container, and AI agent. Deploy in minutes.

Get a demoMore posts