RDS Proxy IAM Authentication

1

I've been playing around with RDS Proxy with IAM authentication required. I deploy my resources entirely with Terraform. There's not a lot of documentation around how to formulate an IAM policy to allow users/roles the ability to authenticate with the proxy instead of the database directly. Only thing I can find is this: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/rds-proxy-setup.html.

Anyway, to create the policy, you need to essentially create it as if you are granting access directly to RDS but swap out the DB ID with the proxy ID. This is vague in the documentation but also quite confusing because there is no proxy ID exposed in the console or API. There is a proxy identifier but this is just the name - not what we need. You have to get it from the ARN. This is how my Terraform IAM policy resource argument now looks:

"resource": "arn:aws:rds-db:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:dbuser:${replace(aws_db_proxy.example.arn, "arn:aws:rds:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:db-proxy:", "")}/rds_proxy_user",

Notice the complex replace function. Really, the Terraform resource will output an attribute called "proxy_id" as well as the ARN to allow for simpler interpolation. But it can't do that until AWS expose this information in the API.

1 Answer
0

I unfortunately can't actually answer your question, that said I figure I'd make sure you have seen this:

IAM Authentication. Choose whether to require, allow, or disallow IAM authentication for connections to your proxy. The allow option is only valid for proxies for RDS for SQL Server. The choice of IAM authentication or native database authentication applies to all DB users that access this proxy.

Frankly I'm trying to figure out if / how IAM Authentication works or could fit into my particular problem, but when I came across this note (from the same link you posted, here) I sort of gave up.

Anyway, just wanted to make sure you saw this, if you're not using SQL Server, then IAM Authentication might not even be a choice?

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions