Coder RDS IAM Auth

Does coder use the service account that is deployed through the helm chart to then use an IAM role and connect to an RDS instance? Having some trouble wiring this up, looking for some guidance
23 Replies
Codercord
Codercord5w ago
<#1324498437185470484>
Category
Help needed
Product
Coder (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Phorcys
Phorcys5w ago
hey, I am not sure what you mean by RDS Remote Desktop Services? oh, Amazon RDS
Kbs56
Kbs56OP5w ago
Sorry, we’re using an AWS RDS postgres instance for coder to connect to and use as its database. We were using normal password auth but ran into trouble with URL encoded characters. So I’m trying to move to IAM auth for the Database
Phorcys
Phorcys5w ago
i see Coder is going to use the CODER_PG_CONNECTION_URL variable I don't think there's another way
Kbs56
Kbs56OP5w ago
GitHub
Postgres password authentication issue when Postgres Password conta...
Hello, I have coder deployed to my kubernetes cluster using the Helm chart with an RDS postgres database. RDS currently handles password creation and rotation. I've noticed that when the postgr...
Phorcys
Phorcys5w ago
does URL encoding the password work?
Kbs56
Kbs56OP5w ago
I saw this issue, it seems you can change the auth to awsiamrds no?
Phorcys
Phorcys5w ago
yeah i was about to say i think that's what you want to do if you want to use IAM
Kbs56
Kbs56OP5w ago
Yes, but when the password rotated as mentioned in the issue there’s no telling what characters you’ll get
Phorcys
Phorcys5w ago
but you'll have to encode the password anyways
Kbs56
Kbs56OP5w ago
Even when using iam to connect? That should be passwordless right?
Phorcys
Phorcys5w ago
I am not familiar with AWS IAM, I did not know it was passwordless anyways since CODER_PG_CONNECTION_URL is an URL, any special characters will need to be URL encoded
Kbs56
Kbs56OP5w ago
Yes that is true, but when using IAM there’s no need for a password As mentioned in the issue I’ll have to play with the service account the helm chart creates to start I suppose
Phorcys
Phorcys5w ago
how would you connect via IAM outside of Coder in a normal scenario?
Kbs56
Kbs56OP5w ago
My user would assume that iam role, im assuming No pun intended Thats why I was wondering if the service account needs that role that is created with permissions to connect to the RDS instance I’ve never connected to a database like this either I’ve always used connection strings so I’m a little confused here as well
Phorcys
Phorcys5w ago
I'm not sure if it has anything to do with the service account really I am looking at internal chats, one of them said: Use --postgres-auth awsiamrds and omit any password in the postgres url provided like --postgres-url postgresql://[email protected] Docs: https://coder.com/docs/cli/server#--postgres-auth ( You'll need a IAM policy allowing rds-db:connect for the role associated with the Coder deployment.
Kbs56
Kbs56OP5w ago
Yeah I have th role, I guess I'm not sure what to attach it to? You say the role associated with the coder deployment, but within k8s is that the service account?
Phorcys
Phorcys5w ago
it seems to me like it is assumed that the Coder deployment is within AWS EC2, but I'm not sure it's late for me now so i'll have to log off but i'll look into it more and ask our engineers tomorrow
Kbs56
Kbs56OP5w ago
Yeah I'm headed out as well, I'll check in tomorrow and continue playing with it Thanks, much appreciated! @Phorcys
Phorcys
Phorcys3w ago
hey @Kbs56, any luck with this?
Kbs56
Kbs56OP3w ago
Yes actually! Just deployed to prod as well this morning The service account annotation did the trick Forgot to circle back with you
Phorcys
Phorcys3w ago
nice! no worries, just wanted to make sure we didn't forget you :-) closing this then!
Codercord
Codercord3w ago
@Phorcys closed the thread.

Did you find this page helpful?