ruby/rails: Adapter supports non-admin users, readme refresh#114
Merged
trstephen-amazon merged 5 commits intomainfrom May 6, 2025
Merged
ruby/rails: Adapter supports non-admin users, readme refresh#114trstephen-amazon merged 5 commits intomainfrom
trstephen-amazon merged 5 commits intomainfrom
Conversation
- Update the adapter to work with non-Admin users. Allows the user
to be set with a CLUSTER_USER env var (defaults to 'admin') and will
generate an appropriately scoped auth token for the cluster.
- Rework the readme into:
- ./README.md: Explains how to use the pg-aws_rds_iam plugin to
generate DSQL tokens and necessary dialect updates. Intended
audience is someone who has an existing Rails app and wants to
know the necessary changes for DSQL.
- ./petclinic/README.md: How to install the sample Rails app and
work with the data model.
imforster
reviewed
May 5, 2025
imforster
reviewed
May 5, 2025
imforster
reviewed
May 5, 2025
imforster
reviewed
May 5, 2025
Comment on lines
+54
to
+57
| and for long-lived applications should use one that will refresh automatically: `Aws::AssumeRoleCredentials` or | ||
| `Aws::InstanceProfileCredentials` to name a few. The retrieved credentials will need permission to `dsql:DbConnectAdmin` | ||
| if using the `admin` role or `dsql:DbConnect` if using a custom role. See Aurora DSQL documentation for | ||
| [IAM role connect][docs-dsql-iam] and [authentication token generation][docs-generate-token] for more details. |
Contributor
There was a problem hiding this comment.
Remove if you accept my suggestion
imforster
reviewed
May 5, 2025
| :region => region | ||
| }) | ||
|
|
||
| # e.g. host == "<clusterID>.dsql.us-east-1.on.aws" |
Contributor
There was a problem hiding this comment.
Suggested change
| # e.g. host == "<clusterID>.dsql.us-east-1.on.aws" | |
| # e.g. host == "<clusterID>.dsql.<region>.on.aws" |
Collaborator
Author
There was a problem hiding this comment.
Disagree here, keeping an actual region in place so it's obvious what the regex is matching against.
imforster
reviewed
May 5, 2025
imforster
reviewed
May 5, 2025
imforster
reviewed
May 5, 2025
Collaborator
Author
|
I agree with a lot of @imforster 's comments. Will address them in an upcoming commit. I don't want to merge this until I've had a chance to investigate schema selection based on user. It's a standard feature with our other examples. |
Collaborator
Author
|
Ready for review! Updated the OP to include the user-based schema selection POC |
imforster
approved these changes
May 6, 2025
danielfrankcom
pushed a commit
to marcbowes/aurora-dsql-samples
that referenced
this pull request
May 9, 2025
Co-authored-by: Marcos Lopez <lmarcosi@amazon.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Testing
Used the rails console with my cluster with default (admin) and a non-admin user. Connect and data retrieval OK in both cases:
For user-based schema selection I 1/ loaded data as non-Admin
2/ Switched
CLUSTER_USER=admin, loaded more data3/ As admin, only the 'Admin' vet is visible
By submitting this pull request, I confirm that my contribution is made under
the terms of the MIT-0 license.
Thank you for your contribution!