You must be logged in to view saved presets
This template configures an AWS RDS DB proxy with a default target group and a specific DB proxy target for a MySQL database instance.
resource "aws_db_proxy" "example" {
auth {
auth_scheme = "SECRETS"
description = "example"
iam_auth = "DISABLED"
secret_arn = "aws_secretsmanager_secret.example.arn"
}
debug_logging = false
engine_family = "MYSQL"
idle_client_timeout = 1800
name = "example"
require_tls = true
role_arn = "aws_iam_role.example.arn"
tags = {
Key = "value"
Name = "example"
}
vpc_security_group_ids = ["aws_security_group.example.id"]
vpc_subnet_ids = ["aws_subnet.example.id"]
}
resource "aws_db_proxy_default_target_group" "example" {
connection_pool_config {
connection_borrow_timeout = 120
init_query = "SET x=1, y=2"
max_connections_percent = 100
max_idle_connections_percent = 50
session_pinning_filters = ["EXCLUDE_VARIABLE_SETS"]
}
db_proxy_name = aws_db_proxy.example.name
}
resource "aws_db_proxy_target" "example" {
db_instance_identifier = "aws_db_instance.example.identifier"
db_proxy_name = aws_db_proxy.example.name
target_group_name = aws_db_proxy_default_target_group.example.name
}