content/operate/rc/databases/rdi/rds-proxy.md
{{<warning>}} We do not recommend using RDS Proxy for RDI connections. The [Lambda function approach]({{< relref "/operate/rc/databases/rdi/setup#setup-lambda-function" >}}) provides better failover handling and is the recommended solution for production environments.
Additionally, RDS Proxy does not work with RDS PostgreSQL and Aurora PostgreSQL because it does not support PostgreSQL logical replication.
Only use RDS Proxy if you have specific requirements that necessitate it. {{</warning>}}
RDS Proxy is a fully managed, highly available database proxy for Amazon RDS. While it can be used with RDI, we recommend the Lambda function approach instead for the following reasons:
If you still need to use RDS Proxy, follow the instructions below.
Before setting up RDS Proxy, ensure you have:
Follow the AWS documentation to create an RDS Proxy:
The Proxy's IAM role must have the following permissions to access the database using the credentials secret and encryption key:
secretsmanager:GetSecretValuesecretsmanager:DescribeSecretkms:DecryptExample IAM policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"secretsmanager:GetSecretValue",
"secretsmanager:DescribeSecret"
],
"Resource": "arn:aws:secretsmanager:region:account-id:secret:secret-name"
},
{
"Effect": "Allow",
"Action": "kms:Decrypt",
"Resource": "arn:aws:kms:region:account-id:key/key-id"
}
]
}
After creating the RDS Proxy, you need to get its static IP address to use when configuring the Network Load Balancer.
To get the static IP address of your RDS Proxy, run the following command on an EC2 instance in the same VPC as the Proxy:
$ nslookup <proxy-endpoint>
Replace <proxy-endpoint> with the endpoint of your RDS Proxy. Save this IP address for use in the Network Load Balancer configuration.
When you [create the Network Load Balancer]({{< relref "/operate/rc/databases/rdi/setup#create-network-load-balancer-rds" >}}), use the RDS Proxy IP address instead of the database IP address:
After setting up RDS Proxy and the Network Load Balancer:
{{<note>}} When using RDS Proxy, you do not need to set up the Lambda function for failover handling, as the proxy provides a static endpoint. {{</note>}}