-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable AWS IAM authentication for the init method #4
Comments
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! |
Quick question @nmaynes, Could the same result be achieved, by supporting PGPASSWORD or .pgpass and running something akin to: 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. |
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.
|
I took some time to see if I could get the PGPASSWORD approach to work. I tried to use a 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. |
Enable the
regresql init
method to work with AWS IAM authentication. Im not sure what the best method would be but a flag to use iam may be appropriate. Then a function similar to the following could be used to generate the necessary tokens.See the AWS IAM docs for more details on handling connections.
The text was updated successfully, but these errors were encountered: