Git Product home page Git Product logo

Comments (4)

nmaynes avatar nmaynes commented on August 30, 2024

Tried to utilize this tool for some scripts and found lack of IAM support to be a blocker. Not sure how many people would need this functionality and in time I may be able to submit a PR for it. Wanted to get an issue up to start discussion. Thanks!

from regresql.

Qu4tro avatar Qu4tro commented on August 30, 2024

Quick question @nmaynes,

Could the same result be achieved, by supporting PGPASSWORD or .pgpass and running something akin to:
PGPASSWORD="$(aws rds generate-db-auth-token --hostname {db or cluster endpoint} --port 3306 --username {db username})" regresql ...

I understand the redundancy, but I feel like if these were available, a small wrapper script (which could source data from the .yaml), would suffice.

from regresql.

nmaynes avatar nmaynes commented on August 30, 2024

I did a bit of digging this weekend to figure out how it could be handled. I think the PGPASSWORD environment variable could work but did not get a working example locally. My attempts were probably insufficient since I am not sure I escaped the token that got returned correctly.

The AWS Go SDK docs appear to be out of date for requesting an RDS token which has made the process a little trickier than I thought. In their Github repo they have an example to request an IAM token that looks for multiple environment variables but not PGPASSWORD.

iam_authentication <region> <db user> <db name> <endpoint to database> <iam arn>

from regresql.

nmaynes avatar nmaynes commented on August 30, 2024

I took some time to see if I could get the PGPASSWORD approach to work. I tried to use a strings.Builder object. Hopefully the sample below conveys my approach.

var postgresConnection strings.Builder

		postgresConnection.WriteString(
			fmt.Sprintf("user=%s dbname=%s sslmode=verify-full port=%s host=%s password=%s",
				"username",
				"databasename",
				"5432",
				"host-name.amazonaws.com",
				"PGPASSWORD VALUE"))

		pguri := postgresConnection.String()

I ran into a problem with adding the SSL flag and certificate to the string. I could not get it to work. I took a look at one approach but realized my Go abilities need to be a bit stronger to make the changes to this module.

from regresql.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.