basti-app / basti

✨ Securely connect to RDS, Elasticache, and other AWS resources in VPCs with no idle cost
https://www.basti.app
MIT License
351 stars 18 forks source link

Idea: configuration sets #16

Closed RomanHotsiy closed 1 year ago

RomanHotsiy commented 1 year ago

Connection to the same target is repetitive right now and requires someone to carefully pick the target and use correct port.

Would be slick to have some predefined configurations set (which we can distribute to all our users) which will allow doing something like:

basti connect prod-db
basti connect staging-db

Behind the scenes it will pick correct region, target and local port.

The config format may be as simple as that:

{
  "prod-db": { "target": "production-postgres-13", "localPort": 1234, "region": "us-east1" }
   // ...
}

You can store this config in ~/.aws/basti for example.

I know this can be achieved with cli args though so we can just share predefined commands. So maybe this is an overkill.

BohdanPetryshyn commented 1 year ago

Basti could also search for a configuration file starting from the current working directory and outward. This way, teams could have a basti.json/basti.yaml files with connection targets defined in their repositories instead of polluting package.json with verbose basti commands

BohdanPetryshyn commented 1 year ago

Also, I'm not a huge fan of editing global config files like ~/.vimrc or ~/.pgpass. It might make sense to wrap the global config file interaction with a Basti command. For example, basti config

BohdanPetryshyn commented 1 year ago

I came up with a configuration format like this:

---
connect:
  vault-sandbox:
    target: vault-sandbox
    localPort: 8201
  vault-local:
    target: vault-sandbox
    localPort: 8200
  db-main-sandbox:
    target: db-main-sandbox
    localPort: 5432

targets:
  vault-sandbox:
    customTargetVpc: vpc-11111111111111111
    customTargetHost: test-1111111111111111.elb.us-east-1.amazonaws.com
    customTargetPort: 8200
    awsProfile: sandbox
    awsRegion: us-west-1
  db-main-sandbox:
    rds-instance: db-main
    awsProfile: sandbox

@RomanHotsiy, I would be happy to hear your thoughts on this!