DatabaseProxyProps Struct
Construction properties for a DatabaseProxy.
Example
declare const vpc: ec2.Vpc;
const instance = new rds.DatabaseInstance(this, 'Database', {
engine: rds.DatabaseInstanceEngine.postgres({
version: rds.PostgresEngineVersion.VER_17_7,
}),
vpc,
iamAuthentication: true,
});
const proxy = new rds.DatabaseProxy(this, 'Proxy', {
proxyTarget: rds.ProxyTarget.fromInstance(instance),
vpc,
defaultAuthScheme: rds.DefaultAuthScheme.IAM_AUTH, // No secrets required
});
// Grant IAM permissions for database connection
const role = new iam.Role(this, 'DBRole', { assumedBy: new iam.AccountPrincipal(this.account) });
proxy.grantConnect(role, 'database-user'); // Database user must be specified when using IAM auth
Properties
borrowTimeoutDurationborrow_timeoutDurationborrowTimeoutDurationBorrowTimeoutDurationBorrowTimeoutDuration= cdk.Duration.seconds(120)#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.
clientPasswordAuthTypeClientPasswordAuthTypeclient_password_auth_typeClientPasswordAuthTypeclientPasswordAuthTypeClientPasswordAuthTypeClientPasswordAuthTypeClientPasswordAuthTypeClientPasswordAuthTypeClientPasswordAuthType= CloudFormation defaults will app…#default
Default: CloudFormation defaults will apply given the specified database engine.
dbProxyNamestringdb_proxy_namestrdbProxyNameStringDbProxyNamestringDbProxyName*string= Generated by CloudFormation (rec…#notes · default
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)
notes
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.
defaultAuthSchemeDefaultAuthSchemedefault_auth_schemeDefaultAuthSchemedefaultAuthSchemeDefaultAuthSchemeDefaultAuthSchemeDefaultAuthSchemeDefaultAuthSchemeDefaultAuthScheme= DefaultAuthScheme.NONE#When set to DefaultAuthScheme.IAM_AUTH, the proxy uses end-to-end IAM authentication to connect to the database.
idleClientTimeoutDurationidle_client_timeoutDurationidleClientTimeoutDurationIdleClientTimeoutDurationIdleClientTimeoutDuration= cdk.Duration.minutes(30)#You can set this value higher or lower than the connection timeout limit for the associated database.
initQuerystringinit_querystrinitQueryStringInitQuerystringInitQuery*string= no initialization query#notes
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.
maxConnectionsPercentnumbermax_connections_percentint | floatmaxConnectionsPercentNumberMaxConnectionsPercentdoubleMaxConnectionsPercent*float64= 100#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
maxIdleConnectionsPercentnumbermax_idle_connections_percentint | floatmaxIdleConnectionsPercentNumberMaxIdleConnectionsPercentdoubleMaxIdleConnectionsPercent*float64= 50#notes
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
proxyTargetProxyTargetproxy_targetProxyTargetproxyTargetProxyTargetProxyTargetProxyTargetProxyTargetProxyTargetrequired#By enabling this setting, you can enforce encrypted TLS connections to the proxy.
default
Default: A role will automatically be created
secretsISecret[]secretstyping.List[ISecret]secretsList<ISecret>SecretsISecret[]Secrets*[]ISecret= None#These secrets are stored within Amazon Secrets Manager. One or more secrets are required when defaultAuthScheme is DefaultAuthScheme.NONE.
securityGroupsISecurityGroup[]security_groupstyping.List[ISecurityGroup]securityGroupsList<ISecurityGroup>SecurityGroupsISecurityGroup[]SecurityGroups*[]ISecurityGroup= No security groups#sessionPinningFiltersSessionPinningFilter[]session_pinning_filterstyping.List[SessionPinningFilter]sessionPinningFiltersList<SessionPinningFilter>SessionPinningFiltersSessionPinningFilter[]SessionPinningFilters*[]SessionPinningFilter= no session pinning filters#Including an item in the list exempts that class of SQL operations from the pinning behavior.
vpcSubnetsSubnetSelectionvpc_subnetsSubnetSelectionvpcSubnetsSubnetSelectionVpcSubnetsSubnetSelectionVpcSubnetsSubnetSelection= the VPC default strategy if not …#default
Default: the VPC default strategy if not specified.