A comprehensive command-line tool suite for developers to interact with AWS services.
houlak-cli is a developer-friendly toolkit designed for internal use at Houlak. The tool provides multiple utilities for interacting with AWS services, abstracting the complexity of AWS operations and allowing developers to focus on their work without needing to understand AWS internals.
Database Connection Tool: Connect securely to RDS databases through a bastion host using AWS Session Manager. The tool handles all the complexity of establishing secure connections, so you don't have to worry about SSH keys, exposed ports, or connection details.
This is an extensible platform designed to grow. More tools and commands will be added in the future to support various AWS operations and developer workflows.
- Pre-configured Databases: Databases are configured by administrators in AWS Systems Manager Parameter Store, and developers can connect to them with simple commands
- Bastion Host Transparency: When you run the
db-connectcommand, the console stays occupied maintaining an active tunnel connection through the bastion host (EC2 instance) - No Manual Bastion Configuration: When connecting from your database client (DBeaver, TablePlus, pgAdmin, etc.), you don't need to specify the bastion host - the tool handles this automatically
- Secure Connections: Uses AWS Session Manager instead of traditional SSH, eliminating the need for SSH keys and exposed ports
- IAM-based Authentication: Full audit trail through CloudTrail
Before using houlak-cli, you need:
- Python 3.8+
- pipx - Recommended for isolated CLI installation. Installation Guide
- AWS CLI v2 - Installation Guide
- AWS Session Manager Plugin - Installation Guide
- AWS Profile Configuration -
houlak-cliuses AWS profiles configured locally in~/.aws/config. You can either:- Use the
config-aws-profilecommand to set up a profile through the interactive wizard - Use your existing AWS profiles if already configured via
aws configureoraws configure sso
- Use the
Recommended: Using pipx (ensures isolated environment)
pipx install git+https://github.com/Houlak/houlak-cli.gitOr clone and install in development mode:
git clone https://github.com/Houlak/houlak-cli.git
cd houlak-cli
pipx install -e .If you installed with pipx:
pipx upgrade houlak-cliOr if installed in development mode:
cd houlak-cli
git pull origin main
pipx install -e .Check which version you have installed:
houlak-cli --version
# or
houlak-cli -vImportant: houlak-cli uses AWS profiles configured locally in ~/.aws/config. You have two options:
If you already have AWS profiles configured (via aws configure or aws configure sso), you can skip the configuration step and use your profiles directly.
You can specify your AWS profile in multiple ways (just like AWS CLI):
Method 1: Using the --profile flag
houlak-cli db-connect --database hk-postgres-dev --profile your-profile-nameMethod 2: Using the AWS_PROFILE environment variable
export AWS_PROFILE=your-profile-name
houlak-cli db-connect --database hk-postgres-devMethod 3: Using the AWS_DEFAULT_PROFILE environment variable
export AWS_DEFAULT_PROFILE=your-profile-name
houlak-cli db-connect --database hk-postgres-devList your configured profiles:
houlak-cli config-listIf you need to set up a new AWS profile, run the configuration wizard:
houlak-cli config-aws-profileNote: This command is only needed the first time you set up a profile, or when adding a new profile. Once configured, your profile will be saved in ~/.aws/config and can be reused in all subsequent commands.
The wizard will guide you through:
- Checking prerequisites (AWS CLI, Session Manager Plugin)
- Configuring your AWS profile in
~/.aws/config - Testing your connection to Parameter Store
Connect to a database by specifying its name from Parameter Store:
# Method 1: Using --profile flag
houlak-cli db-connect --database hk-postgres-dev --profile my-profile
# Method 2: Using AWS_PROFILE environment variable
export AWS_PROFILE=my-profile
houlak-cli db-connect --database hk-postgres-dev
# Method 3: Using AWS_DEFAULT_PROFILE environment variable
export AWS_DEFAULT_PROFILE=my-profile
houlak-cli db-connect --database hk-postgres-dev
# Connect with custom port
houlak-cli db-connect --database hk-mariadb-qa --port 33061 --profile my-profileNote: You must specify an AWS profile using one of the methods above. If no profile is specified, houlak-cli will show an error with instructions.
You can list available databases first:
# Using --profile flag
houlak-cli db-list --profile my-profile
# Or using AWS_PROFILE environment variable
export AWS_PROFILE=my-profile
houlak-cli db-listImportant: Once you run the db-connect command, your terminal will be occupied maintaining the tunnel connection. This is expected behavior - the tunnel must remain active while you use your database client. Press Ctrl+C when you're done to close the tunnel.
Once connected, use your favorite database client (DBeaver, TablePlus, pgAdmin, etc.) to connect to:
Host: localhost
Port: (the port shown in the terminal, default varies by engine)
Note: You don't need to configure any bastion host settings in your database client - the tunnel is already established and handles this automatically.
Press Ctrl+C in the terminal to stop the tunnel when you're finished.
If you are an administrator, you can add new database configurations to Parameter Store so developers can connect to them.
Run the interactive command:
houlak-cli admin-db-addThe command will prompt you for:
- Database name (e.g.,
hk-postgres-dev) - Project name
- Database engine (postgres/mariadb)
- Environment (dev/qa/prod)
- Bastion EC2 instance ID
- RDS endpoint
- RDS port
- AWS region
Example:
houlak-cli admin-db-add
# You'll be prompted for:
Database name: hk-postgres-dev
Project name: hk
Database engine: postgres
Environment: dev
Bastion EC2 instance ID: i-1234567890abcdef0
RDS endpoint: hk-postgres-dev.us-east-1.rds.amazonaws.com
RDS port: 5432
AWS region: us-east-1Once added, developers can connect using:
houlak-cli db-connect --database hk-postgres-dev --profile <their-profile>Note: The admin-db-add command requires admin privileges. Contact DevOps if you need admin access.
These commands help you manage AWS CLI profiles for use with houlak-cli. Note: If you already have AWS profiles configured via aws configure or aws configure sso, you can skip these commands and directly use your profiles with the --profile flag or environment variables (AWS_PROFILE or AWS_DEFAULT_PROFILE).
Run the interactive configuration wizard to set up a new AWS CLI profile for houlak-cli.
houlak-cli config-aws-profileImportant: This command is only needed the first time you set up a profile, or when adding a new profile. Once configured, your profile will be permanently saved in ~/.aws/config and can be reused in all subsequent commands without running this wizard again.
When to use this:
- First time setup - when you don't have any AWS profiles configured yet
- Adding a new AWS account/profile to your configuration
- If you prefer an interactive wizard instead of using
aws configureoraws configure sso
When NOT to use this:
- If you already have AWS profiles configured and working
- For daily database connections (just use your existing profile)
List all AWS profiles configured locally in ~/.aws/config.
houlak-cli config-listThis shows all available profiles that you can use with the --profile flag.
Display current AWS profile configuration used by houlak-cli.
houlak-cli config-current-profileConnect to a database through Session Manager via bastion host.
Required Options:
--database, -d: Database name from Parameter Store (e.g.,hk-postgres-dev)
Optional:
--profile: AWS profile name--port, -p: Local port number (optional, uses default based on engine)
AWS Profile Specification:
You must specify an AWS profile using one of these methods (same as AWS CLI):
--profileflagAWS_PROFILEenvironment variableAWS_DEFAULT_PROFILEenvironment variable
If none is provided, an error will be shown with instructions.
Examples:
# Method 1: Using --profile flag
houlak-cli db-connect --database hk-postgres-dev --profile my-profile
# Method 2: Using AWS_PROFILE environment variable
export AWS_PROFILE=my-profile
houlak-cli db-connect --database hk-postgres-dev
# Method 3: Using AWS_DEFAULT_PROFILE environment variable
export AWS_DEFAULT_PROFILE=my-profile
houlak-cli db-connect --database hk-postgres-dev
# With custom port
houlak-cli db-connect --database hk-mariadb-qa --port 33061 --profile my-profileNote: The --profile flag accepts any AWS profile configured in your ~/.aws/config file, whether created via aws configure, aws configure sso, or houlak-cli config-aws-profile.
List all available databases from Parameter Store.
AWS Profile Specification:
You must specify an AWS profile using one of these methods:
--profileflagAWS_PROFILEenvironment variableAWS_DEFAULT_PROFILEenvironment variable
Examples:
# Using --profile flag
houlak-cli db-list --profile my-profile
# Using AWS_PROFILE environment variable
export AWS_PROFILE=my-profile
houlak-cli db-list
# Using AWS_DEFAULT_PROFILE environment variable
export AWS_DEFAULT_PROFILE=my-profile
houlak-cli db-listAdd a database configuration to Parameter Store interactively. Requires admin privileges.
This command will prompt you for all required information:
- Database name
- Project name
- Database engine (postgres/mariadb)
- Environment (dev/qa/prod)
- Bastion EC2 instance ID
- RDS endpoint
- RDS port
- AWS region
Example:
# Run the interactive command (uses default profile 'houlak')
houlak-cli admin-db-add
# Use a different profile for storing the configuration
houlak-cli admin-db-add --profile admin-profileNote: This command is restricted to admin users only. Contact DevOps if you need admin access.
Show help for all commands.
Show version information.
houlak-cli --version
# or
houlak-cli -v
# Output: houlak-cli version 0.1.0The db-connect command uses AWS Session Manager to create a secure tunnel from your local machine to your RDS database through a bastion host (EC2 instance).
How the connection works:
- An administrator adds database configurations to AWS Parameter Store using
admin-db-add - You run
houlak-cli db-connect --database hk-postgres-dev --profile your-profile - The CLI reads the database configuration from Parameter Store
- The CLI establishes a tunnel through the bastion host to the RDS database using your AWS profile
- Your terminal stays occupied maintaining this tunnel (this is expected and necessary)
- You connect your database client to
localhoston the assigned port - Your database client doesn't need to know about the bastion host - it just connects to localhost
- When you're done, press
Ctrl+Cto close the tunnel
Benefits of this approach:
- ✅ Eliminates the need for SSH keys
- ✅ Doesn't require exposed SSH ports
- ✅ Provides full audit trail in CloudTrail
- ✅ Uses IAM-based authentication
- ✅ No need to configure bastion host in your database client
- ✅ Developers use their own AWS profiles
- ✅ Centralized database configuration management
The database configurations (bastion host details, RDS endpoints, etc.) are stored securely in AWS Systems Manager Parameter Store by administrators and can be used by any developer with their own AWS profile.
Additional tools and commands will be added to houlak-cli to support various AWS operations and developer workflows.
Install AWS CLI v2 from: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
Install the plugin from: https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html
Run:
aws sso login --profile houlakSpecify a different port:
houlak-cli db-connect --env dev --port 54321Check available databases:
houlak-cli db-listThis is an internal tool for Houlak development team.
MIT License - See LICENSE file for details.
For issues or questions, contact the DevOps team or open an issue in the repository.