AWS Amazon RDS Proxy Target

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

aws_db_proxy_target (Terraform)

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

Example Usage from GitHub

aws_rds_proxy.tf#L32
resource "aws_db_proxy_target" "main" {
  db_instance_identifier = aws_db_instance.main.id
  db_proxy_name          = aws_db_proxy.main.name
  target_group_name      = aws_db_proxy_default_target_group.main.name
}
db_proxy_target.tf#L4
resource "aws_db_proxy_target" "db_proxy_target" {
  count = var.enable_db_proxy_target ? 1 : 0

  db_proxy_name     = var.db_proxy_target_db_proxy_name != "" ? var.db_proxy_target_db_proxy_name : (var.enable_db_proxy ? element(aws_db_proxy.db_proxy.*.name, 0) : null)
  target_group_name = var.db_proxy_target_target_group_name != "" ? var.db_proxy_target_target_group_name : (var.enable_db_proxy_default_target_group ? element(aws_db_proxy_default_target_group.db_proxy_default_target_group.*.db_proxy_name, 0) : null)

db_proxy_target.tf#L4
resource "aws_db_proxy_target" "db_proxy_target" {
  count = var.enable_db_proxy_target ? 1 : 0

  db_proxy_name     = var.db_proxy_target_db_proxy_name != "" ? var.db_proxy_target_db_proxy_name : (var.enable_db_proxy ? element(aws_db_proxy.db_proxy.*.name, 0) : null)
  target_group_name = var.db_proxy_target_target_group_name != "" ? var.db_proxy_target_target_group_name : (var.enable_db_proxy_default_target_group ? element(aws_db_proxy_default_target_group.db_proxy_default_target_group.*.db_proxy_name, 0) : null)

aws_db_proxy.tf#L17
resource "aws_db_proxy_target" "main" {
  db_cluster_identifier = aws_rds_cluster.qumitoru-db.id
  db_proxy_name = aws_db_proxy.main.name
  target_group_name = "default"
}

aws_db_proxy.tf#L17
resource "aws_db_proxy_target" "main" {
  db_cluster_identifier = aws_rds_cluster.qumitoru-db.id
  db_proxy_name = aws_db_proxy.main.name
  target_group_name = "default"
}

Parameters

Explanation in Terraform Registry

Provides an RDS DB proxy target resource.

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

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
RdsProxyResources.yml#L19
    Type: AWS::RDS::DBProxyTargetGroup
    Properties:
      TargetGroupName: default
      DBProxyName: !Ref RDSProxy
      DBInstanceIdentifiers:
        - !Ref RDSInstance
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 Target?

AWS Amazon RDS Proxy Target 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 Target?

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

For CloudFormation, the Pivopil/awsdevbot-root-baseline, argjentsahiti/RDSProxyServerlessExample and montecha/examples source code examples are useful. See the CloudFormation Example section for further details.