Skip to content

Resource: awsDbProxy

Provides an RDS DB proxy resource. For additional information, see the RDS User Guide.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.dbProxy.DbProxy(this, "example", {
  auth: [
    {
      authScheme: "SECRETS",
      description: "example",
      iamAuth: "DISABLED",
      secretArn: "${aws_secretsmanager_secret.example.arn}",
    },
  ],
  debugLogging: false,
  engineFamily: "MYSQL",
  idleClientTimeout: 1800,
  name: "example",
  requireTls: true,
  roleArn: "${aws_iam_role.example.arn}",
  tags: {
    Key: "value",
    Name: "example",
  },
  vpcSecurityGroupIds: ["${aws_security_group.example.id}"],
  vpcSubnetIds: ["${aws_subnet.example.id}"],
});

Argument Reference

The following arguments are supported:

  • name - (Required) The identifier for the proxy. This name must be unique for all proxies owned by your AWS account in the specified AWS Region. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it can't end with a hyphen or contain two consecutive hyphens.
  • auth - (Required) Configuration block(s) with authorization mechanisms to connect to the associated instances or clusters. Described below.
  • debugLogging - (Optional) Whether the proxy includes detailed information about SQL statements in its logs. This information helps you to debug issues involving SQL behavior or the performance and scalability of the proxy connections. The debug information includes the text of SQL statements that you submit through the proxy. Thus, only enable this setting when needed for debugging, and only when you have security measures in place to safeguard any sensitive information that appears in the logs.
  • engineFamily - (Required, Forces new resource) The kinds of databases that the proxy can connect to. This value determines which database network protocol the proxy recognizes when it interprets network traffic to and from the database. The engine family applies to MySQL and PostgreSQL for both RDS and Aurora. Valid values are mysql and postgresql.
  • idleClientTimeout - (Optional) The number of seconds that a connection to the proxy can be inactive before the proxy disconnects it. You can set this value higher or lower than the connection timeout limit for the associated database.
  • requireTls - (Optional) A Boolean parameter that specifies whether Transport Layer Security (TLS) encryption is required for connections to the proxy. By enabling this setting, you can enforce encrypted TLS connections to the proxy.
  • roleArn - (Required) The Amazon Resource Name (ARN) of the IAM role that the proxy uses to access secrets in AWS Secrets Manager.
  • vpcSecurityGroupIds - (Optional) One or more VPC security group IDs to associate with the new proxy.
  • vpcSubnetIds - (Required) One or more VPC subnet IDs to associate with the new proxy.
  • tags - (Optional) A mapping of tags to assign to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

auth blocks support the following:

  • authScheme - (Optional) The type of authentication that the proxy uses for connections from the proxy to the underlying database. One of secrets.
  • clientPasswordAuthType - (Optional) The type of authentication the proxy uses for connections from clients. Valid values are MYSQL_NATIVE_PASSWORD, POSTGRES_SCRAM_SHA_256, POSTGRES_MD5, and SQL_SERVER_AUTHENTICATION.
  • description - (Optional) A user-specified description about the authentication used by a proxy to log in as a specific database user.
  • iamAuth - (Optional) Whether to require or disallow AWS Identity and Access Management (IAM) authentication for connections to the proxy. One of disabled, required.
  • secretArn - (Optional) The Amazon Resource Name (ARN) representing the secret that the proxy uses to authenticate to the RDS DB instance or Aurora DB cluster. These secrets are stored within Amazon Secrets Manager.
  • username - (Optional) The name of the database user to which the proxy connects.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - The Amazon Resource Name (ARN) for the proxy.
  • arn - The Amazon Resource Name (ARN) for the proxy.
  • endpoint - The endpoint that you can use to connect to the proxy. You include the endpoint value in the connection string for a database client application.
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Timeouts

Configuration options:

  • create - (Default 30M)
  • update - (Default 30M)
  • delete - (Default 60M)

Import

DB proxies can be imported using the name, e.g.,

$ terraform import aws_db_proxy.example example