Skip to content

Instantly share code, notes, and snippets.

@MikeZ77
Created August 16, 2021 05:49
Show Gist options
  • Save MikeZ77/afadc6bf5c43d2244b1d00835118b8cb to your computer and use it in GitHub Desktop.
Save MikeZ77/afadc6bf5c43d2244b1d00835118b8cb to your computer and use it in GitHub Desktop.
RDS Proxy
resource "aws_db_proxy_default_target_group" "rds_proxy_target_group" {
db_proxy_name = aws_db_proxy.db_proxy.name
connection_pool_config {
connection_borrow_timeout = 120
max_connections_percent = 100
}
}
resource "aws_db_proxy_target" "rds_proxy_target" {
db_instance_identifier = aws_db_instance.database.id
db_proxy_name = aws_db_proxy.db_proxy.name
target_group_name = aws_db_proxy_default_target_group.rds_proxy_target_group.name
}
resource "aws_db_proxy" "db_proxy" {
debug_logging = false
engine_family = "MYSQL"
idle_client_timeout = 1800
require_tls = true
role_arn = aws_iam_role.rds_proxy_iam_role.arn
vpc_security_group_ids = [aws_security_group.sg_rds_proxy.id]
vpc_subnet_ids = module.some_vpc.my_database_subnets
auth {
auth_scheme = "SECRETS"
iam_auth = "REQUIRED"
secret_arn = aws_secretsmanager_secret.rds_secret.arn
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment