-
Notifications
You must be signed in to change notification settings - Fork 594
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
RDS.Signer is not implemented? #1823
Comments
I'm currently updating https://github.com/middyjs/middy. Would really like to include the middleware that allows this in the next release. |
This is something that is needed because there is no other way of doing this outside of the CLI or aws-sdk v2. |
I agree with @nwitte-rocketloans , we are in the process of green fielding a new architecture and were looking to use IAM auth for Aurora PostgreSQL. All of our lambdas will be written against aws-sdk v3. |
Would also love to see this implemented in v3 |
I tried to implement this using the const { HttpRequest } = require('@aws-sdk/protocol-http')
const { SignatureV4 } = require('@aws-sdk/signature-v4')
const { Hash } = require('@aws-sdk/hash-node')
const { formatUrl } = require('@aws-sdk/util-format-url')
async function getAuthToken({ hostname, port, username, region, credentials }) {
const protocol = 'https'
const signer = new SignatureV4({
service: 'rds-db',
region,
credentials,
sha256: Hash.bind(null, 'sha256')
})
const request = new HttpRequest({
method: 'GET',
protocol,
hostname,
port,
query: {
Action: 'connect',
DBUser: username
}
})
const presigned = await signer.presign(request, {
expiresIn: 900
})
return formatUrl(presigned).replace(`${protocol}://`, '')
}
For now I'm calling out to the CLI which is acceptable in the context I need RDS access via IAM. If anyone wants to keep debugging, using a mocked time and an expected signature/URL could be helpful. Happy to take up a PR or just be able to share a working userland implementation if anyone can spot the issue. |
Definitively something needed! |
Is this something that is being considered? |
@bendrucker Thanks for posting that code. It looks like you were just missing the
Doing this, I was able to connect and successfully query the DB! |
Really appreciate the extra eyes @MasterOdin, that's a good catch! Figured it was something simple that was missing. I went ahead and published https://github.com/bendrucker/aws-sdk-js-v3-rds-signer to make this easy to adopt. npm install --save aws-sdk-js-v3-rds-signer The In the (private) project where I'd previously called out to the AWS CLI I was able to successfully swap over to this and connect. |
Thanks @bendrucker! I can't believe this isn't fixed already. maybe consider opening a PR? |
Looks like last July this was a |
Looks like it's being implemented here: #3084 |
* feat(rds-signer): add RDS Signer (#1823) * chore(rds-signer): update dependencies * feat(rds-signer): allow skipping port * feat(rds-signer): support node default credential and region provider Co-authored-by: AllanZhengYP <[email protected]>
Implemented in #3084 It will be released with v3.98.0 today. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
RDS.Signer
is the V2 impl for RDS IAM token generation. I don't see that here?The text was updated successfully, but these errors were encountered: