Skip to content
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

new database per microservice #99

Closed
williamputraintan opened this issue Feb 8, 2024 · 6 comments · Fixed by #126 or #128
Closed

new database per microservice #99

williamputraintan opened this issue Feb 8, 2024 · 6 comments · Fixed by #126 or #128
Assignees
Labels

Comments

@williamputraintan
Copy link
Member

A mechanism to create database names for each microsrvice and remove passing master secret to stateless stack

Ref: #92 (comment)

@andrewpatto
Copy link
Member

The "best" mechanism to truly restrict access is RDS IAM - but that isn't normal db connection strings. It has to be enabled in the database etc and the connection strings are like v4 pre-signed strings.
So if you have a lot of control over your clients then that is the best - and then in that case the IAM permissions for the microservice can have conditionals etc down to the database (not just instance) level.

Is hard to wedge it in where you don't have control over the client lifecycle (Edgedb for instance? Though that has enough hooks that it might work)

@andrewpatto
Copy link
Member

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html

@andrewpatto
Copy link
Member

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "rds-db:connect",
            "Resource": "arn:aws:rds-db:*:ACCOUNT_ID:dbuser:*/*_ro"
        }
    ]
}

@andrewpatto
Copy link
Member

I mention it because at this level you don't use secrets at all

@victorskl victorskl changed the title cicd: new database per microservice new database per microservice Feb 12, 2024
@williamputraintan williamputraintan self-assigned this Feb 14, 2024
@williamputraintan
Copy link
Member Author

So I think one of the downside of having this RDS-IAM is that the token used for the authentication needs to be refreshed every 15 minutes, in the case of EdgeDb I am not sure whether we could set up a refresh mechanism from the EdgeDb server itself as we usually pass in the postgres DSN at the environment variable. (I guess possible could have like a cron job and parameter store to make it work?)

@andrewpatto
Copy link
Member

Yes 100% agree it wouldn't currently make sense for EdgeDb (I was tempted to actually put a ticket in to the edgedb folks themselves).
I thought this was broadly also about other direct accesses to the postgres though - which possibly could use this technique? (like filemanager etc)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants