npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

birdiecare-dbc

v0.5.2

Published

**D**ata**b**ase **C**onnect

Downloads

5

Readme

dbc

Database Connect

Connect to databases securely, utilising AWS SSM, EC2 & RDS IAM Authentication.

Install dbc

brew tap birdiecare/dbc

brew install dbc

dbc -h

Use dbc

The connect command opens a WebSocket port-forwarding session through an available Bastion instance.

Running dbc connect will start the process of creating a connection to a database. Not specifying a host will prompt you to select one from a fuzzyfinder list of databases.

A connection to the specified Database host -H will then be available at localhost:localport (localport: -lp).

dbc picks up your configured AWS profile from your environment.

Password Authentication

If the database you're connecting to doesn't have AWS IAM Authentication enabled, or doesn't have Users with the rds_iam role, you'll need to use a password to authenticate with the DB once your connection is open.

The following command will be enough to open a connection with a specified DB host with Birdie-specific defaults.

dbc connect -H ${db_host}

Once the connection is open:


➜ dbc connect -H ${db_host}
2023/03/21 17:27:16 DBConnect
2023/03/21 17:27:16 Using bastion: i-*
2023/03/21 17:27:16 Opening connection
2023/03/21 17:27:16 Connection Open at localhost:5432

...

You may connect to the database using localhost:5432 as if localhost was the DB DNS.

psql -h localhost -p 5432 -U ${user} -d ${db} --password

IAM Authentication

If your databases are super cool and secure, IAM Authentication will be enabled.

To use dbc with an IAM Enabled Database, you can use the --iam flag to generate a token while opening your connection!


➜ dbc connect -H ${db_host} --iam
2023/03/21 17:28:30 DBConnect IAM
2023/03/21 17:28:30 Token: ...
2023/03/21 17:28:30 Using bastion: i-*
2023/03/21 17:28:30 Opening connection
2023/03/21 17:28:30 Connection Open at localhost:5432

Then when connecting to your DB...

psql -h localhost -p 5432 -U ${user} -d ${db} --password

Paste the token!

Or... If you're very fancy:

export PGPASSWORD=${token} && psql -h localhost -p 5432 -U ${user} -d ${db}

exit status 255

If you're experiencing trouble opening a session, and you're recieving a 255 error, it's likely due to a missing AWS SSM Plugin installation.

Run this handy script! (Installs the plugin)

wget -O - https://raw.githubusercontent.com/birdiecare/homebrew-dbc/main/install_ssm_plugin.sh | sh