AWS Amazon RDS Proxy Default Target Group

This page shows how to write Terraform and CloudFormation for Amazon RDS Proxy Default Target Group and write them securely.

aws_db_proxy_default_target_group (Terraform)

The Proxy Default Target Group in Amazon RDS can be configured in Terraform with the resource name aws_db_proxy_default_target_group. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

aws_rds_proxy.tf#L22
resource "aws_db_proxy_default_target_group" "main" {
  db_proxy_name = aws_db_proxy.main.name

  connection_pool_config {
    connection_borrow_timeout    = 120
    max_connections_percent      = 100
db_proxy_default_target_group.tf#L4
resource "aws_db_proxy_default_target_group" "db_proxy_default_target_group" {
  count = var.enable_db_proxy_default_target_group ? 1 : 0

  db_proxy_name = var.db_proxy_default_target_group_db_proxy_name != "" ? var.db_proxy_default_target_group_db_proxy_name : (var.enable_db_proxy ? element(aws_db_proxy.db_proxy.*.name, 0) : null)

  dynamic "connection_pool_config" {
db_proxy_default_target_group.tf#L4
resource "aws_db_proxy_default_target_group" "db_proxy_default_target_group" {
  count = var.enable_db_proxy_default_target_group ? 1 : 0

  db_proxy_name = var.db_proxy_default_target_group_db_proxy_name != "" ? var.db_proxy_default_target_group_db_proxy_name : (var.enable_db_proxy ? element(aws_db_proxy.db_proxy.*.name, 0) : null)

  dynamic "connection_pool_config" {
aws_db_proxy.tf#L13
resource "aws_db_proxy_default_target_group" "main" {
  db_proxy_name = aws_db_proxy.main.name
}

resource "aws_db_proxy_target" "main" {
  db_cluster_identifier = aws_rds_cluster.qumitoru-db.id
aws_db_proxy.tf#L13
resource "aws_db_proxy_default_target_group" "main" {
  db_proxy_name = aws_db_proxy.main.name
}

resource "aws_db_proxy_target" "main" {
  db_cluster_identifier = aws_rds_cluster.qumitoru-db.id

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Provides a resource to manage an RDS DB proxy default target group resource. The aws_db_proxy_default_target_group behaves differently from normal resources, in that Terraform does not create or destroy this resource, since it implicitly exists as part of an RDS DB Proxy. On Terraform resource creation it is automatically imported and on resource destruction, Terraform performs no actions in RDS.

Tips: Best Practices for The Other AWS Amazon RDS Resources

In addition to the aws_db_instance, AWS Amazon RDS has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.

risk-label

aws_db_instance

Ensure backup retension of your RDS instance is specified

It's better to set it explicitly to reduce the risk of availability issues.

risk-label

aws_rds_cluster

Ensure backup retension of your RDS cluster is specified

It's better to set it explicitly to reduce the risk of availability issues.

risk-label

aws_rds_cluster_instance

Ensure your RDS cluster instance blocks unwanted access

It's better to limit accessibily to the minimum that is required for the application to work.

Review your AWS Amazon RDS settings

In addition to the above, there are other security points you should be aware of making sure that your .tf files are protected in Shisho Cloud.

AWS::RDS::DBProxyTargetGroup (CloudFormation)

The DBProxyTargetGroup in RDS can be configured in CloudFormation with the resource name AWS::RDS::DBProxyTargetGroup. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

DBProxy.yml#L46
    Type: AWS::RDS::DBProxyTargetGroup
    Properties:
      DBProxyName: !Ref DBProxy
      DBClusterIdentifiers: [!Ref ClusterId]
      TargetGroupName: default
      ConnectionPoolConfigurationInfo:
RDSProxy.yml#L38
    Type: AWS::RDS::DBProxyTargetGroup
    Properties:
      DBProxyName: !Ref TestDBProxy

      DBInstanceIdentifiers: [!Ref InstanceName]
      TargetGroupName: default
rdsproxy.yml#L22
    Type: AWS::RDS::DBProxyTargetGroup
    Properties:
      DBProxyName: !Ref RDSProxy
      DBInstanceIdentifiers:
        - test-proxy-rds
      TargetGroupName: default
serverless.yml#L124
      Type: AWS::RDS::DBProxyTargetGroup
      Properties:
        DbProxyName: RDS-Proxy-Demo
        TargetGroupName: default
        DBClusterIdentifiers:
          - Fn::ImportValue: rds:${self:provider.stage}:AuroraRDSClusterId
DBProxyTargetGroup.yml#L1
Type: AWS::RDS::DBProxyTargetGroup
Properties:
  ConnectionPoolConfigurationInfo:
    MaxConnectionsPercent: 50
  TargetGroupName: default
  DBProxyName: !Ref RDSProxy
integ.proxy.expected.json#L602
      "Type": "AWS::RDS::DBProxyTargetGroup",
      "Properties": {
        "DBProxyName": {
          "Ref": "dbProxy3B89EAF2"
        },
        "TargetGroupName": "default",
integ.proxy.expected.json#L602
      "Type": "AWS::RDS::DBProxyTargetGroup",
      "Properties": {
        "DBProxyName": {
          "Ref": "dbProxy3B89EAF2"
        },
        "TargetGroupName": "default",
integ.proxy.expected.json#L600
      "Type": "AWS::RDS::DBProxyTargetGroup",
      "Properties": {
        "DBProxyName": {
          "Ref": "dbProxy3B89EAF2"
        },
        "TargetGroupName": "default",
integ.proxy.expected.json#L600
      "Type": "AWS::RDS::DBProxyTargetGroup",
      "Properties": {
        "DBProxyName": {
          "Ref": "dbProxy3B89EAF2"
        },
        "TargetGroupName": "default",
RDSDBProxyTargetGroupSpecification.json#L3
    "AWS::RDS::DBProxyTargetGroup.ConnectionPoolConfigurationInfoFormat": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-dbproxytargetgroup-connectionpoolconfigurationinfoformat.html",
      "Properties": {
        "MaxConnectionsPercent": {
          "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-dbproxytargetgroup-connectionpoolconfigurationinfoformat.html#cfn-rds-dbproxytargetgroup-connectionpoolconfigurationinfoformat-maxconnectionspercent",
          "UpdateType": "Mutable",

Parameters

Explanation in CloudFormation Registry

The AWS::RDS::DBProxyTargetGroup resource represents a set of RDS DB instances, Aurora DB clusters, or both that a proxy can connect to. Currently, each target group is associated with exactly one RDS DB instance or Aurora DB cluster.

This data type is used as a response element in the DescribeDBProxyTargetGroups action.

For information about RDS Proxy for Amazon RDS, see Managing Connections with Amazon RDS Proxy in the Amazon RDS User Guide.

For information about RDS Proxy for Amazon Aurora, see Managing Connections with Amazon RDS Proxy in the Amazon Aurora User Guide.

For a sample template that creates a DB proxy and registers a DB instance, see Examples in AWS::RDS::DBProxy.

Note Limitations apply to RDS Proxy, including DB engine version limitations and AWS Region limitations. For information about limitations that apply to RDS Proxy for Amazon RDS, see Limitations for RDS Proxy in the Amazon RDS User Guide. For information about that apply to RDS Proxy for Amazon Aurora, see Limitations for RDS Proxy in the Amazon Aurora User Guide.

Frequently asked questions

What is AWS Amazon RDS Proxy Default Target Group?

AWS Amazon RDS Proxy Default Target Group is a resource for Amazon RDS of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Amazon RDS Proxy Default Target Group?

For Terraform, the sapphire-ko/aws-rds-proxy-test, asrkata/SebastianUA-terraform and SebastianUA/terraform source code examples are useful. See the Terraform Example section for further details.

For CloudFormation, the MAS-Group-team/terraform-aws-rds-cluster-proxy, Pivopil/awsdevbot-root-baseline and argjentsahiti/RDSProxyServerlessExample source code examples are useful. See the CloudFormation Example section for further details.