DatabaseProxyOptions¶
-
class
aws_cdk.aws_rds.
DatabaseProxyOptions
(*, secrets, vpc, borrow_timeout=None, db_proxy_name=None, debug_logging=None, iam_auth=None, idle_client_timeout=None, init_query=None, max_connections_percent=None, max_idle_connections_percent=None, require_tls=None, role=None, security_groups=None, session_pinning_filters=None, vpc_subnets=None)¶ Bases:
object
Options for a new DatabaseProxy.
- Parameters
secrets (
Sequence
[ISecret
]) – 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. One or more secrets are required.vpc (
IVpc
) – The VPC to associate with the new proxy.borrow_timeout (
Optional
[Duration
]) – The duration for a proxy to wait for a connection to become available in the connection pool. Only applies when the proxy has opened its maximum number of connections and all connections are busy with client sessions. Value must be between 1 second and 1 hour, orDuration.seconds(0)
to represent unlimited. Default: cdk.Duration.seconds(120)db_proxy_name (
Optional
[str
]) – 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. Default: - Generated by CloudFormation (recommended)debug_logging (
Optional
[bool
]) – 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. Default: falseiam_auth (
Optional
[bool
]) – Whether to require or disallow AWS Identity and Access Management (IAM) authentication for connections to the proxy. Default: falseidle_client_timeout (
Optional
[Duration
]) – 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. Default: cdk.Duration.minutes(30)init_query (
Optional
[str
]) – One or more SQL statements for the proxy to run when opening each new database connection. Typically used with SET statements to make sure that each connection has identical settings such as time zone and character set. For multiple statements, use semicolons as the separator. You can also include multiple variables in a single SET statement, such as SET x=1, y=2. not currently supported for PostgreSQL. Default: - no initialization querymax_connections_percent (
Union
[int
,float
,None
]) – The maximum size of the connection pool for each target in a target group. For Aurora MySQL, it is expressed as a percentage of the max_connections setting for the RDS DB instance or Aurora DB cluster used by the target group. 1-100 Default: 100max_idle_connections_percent (
Union
[int
,float
,None
]) – Controls how actively the proxy closes idle database connections in the connection pool. A high value enables the proxy to leave a high percentage of idle connections open. A low value causes the proxy to close idle client connections and return the underlying database connections to the connection pool. For Aurora MySQL, it is expressed as a percentage of the max_connections setting for the RDS DB instance or Aurora DB cluster used by the target group. between 0 and MaxConnectionsPercent Default: 50require_tls (
Optional
[bool
]) – 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. Default: truerole (
Optional
[IRole
]) – IAM role that the proxy uses to access secrets in AWS Secrets Manager. Default: - A role will automatically be createdsecurity_groups (
Optional
[Sequence
[ISecurityGroup
]]) – One or more VPC security groups to associate with the new proxy. Default: - No security groupssession_pinning_filters (
Optional
[Sequence
[SessionPinningFilter
]]) – Each item in the list represents a class of SQL operations that normally cause all later statements in a session using a proxy to be pinned to the same underlying database connection. Including an item in the list exempts that class of SQL operations from the pinning behavior. Default: - no session pinning filtersvpc_subnets (
Optional
[SubnetSelection
]) – The subnets used by the proxy. Default: - the VPC default strategy if not specified.
- ExampleMetadata
infused
Example:
# vpc: ec2.Vpc # security_group: ec2.SecurityGroup # secrets: List[secretsmanager.Secret[]] # db_instance: rds.DatabaseInstance proxy = db_instance.add_proxy("proxy", borrow_timeout=Duration.seconds(30), max_connections_percent=50, secrets=secrets, vpc=vpc )
Attributes
-
borrow_timeout
¶ The duration for a proxy to wait for a connection to become available in the connection pool.
Only applies when the proxy has opened its maximum number of connections and all connections are busy with client sessions.
Value must be between 1 second and 1 hour, or
Duration.seconds(0)
to represent unlimited.- Default
cdk.Duration.seconds(120)
- Return type
Optional
[Duration
]
-
db_proxy_name
¶ 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.
- Default
Generated by CloudFormation (recommended)
- Return type
Optional
[str
]
-
debug_logging
¶ 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.
- Default
false
- Return type
Optional
[bool
]
-
iam_auth
¶ Whether to require or disallow AWS Identity and Access Management (IAM) authentication for connections to the proxy.
- Default
false
- Return type
Optional
[bool
]
-
idle_client_timeout
¶ 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.
- Default
cdk.Duration.minutes(30)
- Return type
Optional
[Duration
]
-
init_query
¶ One or more SQL statements for the proxy to run when opening each new database connection.
Typically used with SET statements to make sure that each connection has identical settings such as time zone and character set. For multiple statements, use semicolons as the separator. You can also include multiple variables in a single SET statement, such as SET x=1, y=2.
not currently supported for PostgreSQL.
- Default
no initialization query
- Return type
Optional
[str
]
-
max_connections_percent
¶ The maximum size of the connection pool for each target in a target group.
For Aurora MySQL, it is expressed as a percentage of the max_connections setting for the RDS DB instance or Aurora DB cluster used by the target group.
1-100
- Default
100
- Return type
Union
[int
,float
,None
]
-
max_idle_connections_percent
¶ Controls how actively the proxy closes idle database connections in the connection pool.
A high value enables the proxy to leave a high percentage of idle connections open. A low value causes the proxy to close idle client connections and return the underlying database connections to the connection pool. For Aurora MySQL, it is expressed as a percentage of the max_connections setting for the RDS DB instance or Aurora DB cluster used by the target group.
between 0 and MaxConnectionsPercent
- Default
50
- Return type
Union
[int
,float
,None
]
-
require_tls
¶ 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.
- Default
true
- Return type
Optional
[bool
]
-
role
¶ IAM role that the proxy uses to access secrets in AWS Secrets Manager.
- Default
A role will automatically be created
- Return type
Optional
[IRole
]
-
secrets
¶ 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. One or more secrets are required.
- Return type
List
[ISecret
]
-
security_groups
¶ One or more VPC security groups to associate with the new proxy.
- Default
No security groups
- Return type
Optional
[List
[ISecurityGroup
]]
-
session_pinning_filters
¶ Each item in the list represents a class of SQL operations that normally cause all later statements in a session using a proxy to be pinned to the same underlying database connection.
Including an item in the list exempts that class of SQL operations from the pinning behavior.
- Default
no session pinning filters
- Return type
Optional
[List
[SessionPinningFilter
]]
-
vpc_subnets
¶ The subnets used by the proxy.
- Default
the VPC default strategy if not specified.
- Return type
Optional
[SubnetSelection
]