Class: AWSCDK::RDS::DatabaseProxyOptions

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
rds/database_proxy_options.rb

Overview

Options for a new DatabaseProxy.

Direct Known Subclasses

DatabaseProxyProps

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(vpc:, borrow_timeout: nil, client_password_auth_type: nil, db_proxy_name: nil, debug_logging: nil, default_auth_scheme: nil, iam_auth: nil, idle_client_timeout: nil, init_query: nil, max_connections_percent: nil, max_idle_connections_percent: nil, require_tls: nil, role: nil, secrets: nil, security_groups: nil, session_pinning_filters: nil, vpc_subnets: nil) ⇒ DatabaseProxyOptions

Returns a new instance of DatabaseProxyOptions.

Parameters:

  • vpc (AWSCDK::EC2::IVPC)

    The VPC to associate with the new proxy.

  • borrow_timeout (AWSCDK::Duration, nil) (defaults to: nil)

    The duration for a proxy to wait for a connection to become available in the connection pool.

  • client_password_auth_type (AWSCDK::RDS::ClientPasswordAuthType, nil) (defaults to: nil)

    Specifies the details of authentication used by a proxy to log in as a specific database user.

  • db_proxy_name (String, nil) (defaults to: nil)

    The identifier for the proxy.

  • debug_logging (Boolean, nil) (defaults to: nil)

    Whether the proxy includes detailed information about SQL statements in its logs.

  • default_auth_scheme (AWSCDK::RDS::DefaultAuthScheme, nil) (defaults to: nil)

    The default authentication scheme that the proxy uses for client connections to the proxy and connections from the proxy to the underlying database.

  • iam_auth (Boolean, nil) (defaults to: nil)

    Whether to require or disallow AWS Identity and Access Management (IAM) authentication for connections to the proxy.

  • idle_client_timeout (AWSCDK::Duration, nil) (defaults to: nil)

    The number of seconds that a connection to the proxy can be inactive before the proxy disconnects it.

  • init_query (String, nil) (defaults to: nil)

    One or more SQL statements for the proxy to run when opening each new database connection.

  • max_connections_percent (Numeric, nil) (defaults to: nil)

    The maximum size of the connection pool for each target in a target group.

  • max_idle_connections_percent (Numeric, nil) (defaults to: nil)

    Controls how actively the proxy closes idle database connections in the connection pool.

  • require_tls (Boolean, nil) (defaults to: nil)

    A Boolean parameter that specifies whether Transport Layer Security (TLS) encryption is required for connections to the proxy.

  • role (AWSCDK::IAM::IRole, nil) (defaults to: nil)

    IAM role that the proxy uses to access secrets in AWS Secrets Manager.

  • secrets (Array<AWSCDK::SecretsManager::ISecret>, nil) (defaults to: nil)

    The secret that the proxy uses to authenticate to the RDS DB instance or Aurora DB cluster.

  • security_groups (Array<AWSCDK::EC2::ISecurityGroup>, nil) (defaults to: nil)

    One or more VPC security groups to associate with the new proxy.

  • session_pinning_filters (Array<AWSCDK::RDS::SessionPinningFilter>, nil) (defaults to: nil)

    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.

  • vpc_subnets (AWSCDK::EC2::SubnetSelection, nil) (defaults to: nil)

    The subnets used by the proxy.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'rds/database_proxy_options.rb', line 24

def initialize(vpc:, borrow_timeout: nil, client_password_auth_type: nil, db_proxy_name: nil, debug_logging: nil, default_auth_scheme: nil, iam_auth: nil, idle_client_timeout: nil, init_query: nil, max_connections_percent: nil, max_idle_connections_percent: nil, require_tls: nil, role: nil, secrets: nil, security_groups: nil, session_pinning_filters: nil, vpc_subnets: nil)
  @vpc = vpc
  Jsii::Type.check_type(@vpc, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklWcGMifQ==")), "vpc")
  @borrow_timeout = borrow_timeout
  Jsii::Type.check_type(@borrow_timeout, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "borrowTimeout") unless @borrow_timeout.nil?
  @client_password_auth_type = client_password_auth_type
  Jsii::Type.check_type(@client_password_auth_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfcmRzLkNsaWVudFBhc3N3b3JkQXV0aFR5cGUifQ==")), "clientPasswordAuthType") unless @client_password_auth_type.nil?
  @db_proxy_name = db_proxy_name
  Jsii::Type.check_type(@db_proxy_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "dbProxyName") unless @db_proxy_name.nil?
  @debug_logging = debug_logging
  Jsii::Type.check_type(@debug_logging, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "debugLogging") unless @debug_logging.nil?
  @default_auth_scheme = default_auth_scheme
  Jsii::Type.check_type(@default_auth_scheme, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfcmRzLkRlZmF1bHRBdXRoU2NoZW1lIn0=")), "defaultAuthScheme") unless @default_auth_scheme.nil?
  @iam_auth = iam_auth
  Jsii::Type.check_type(@iam_auth, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "iamAuth") unless @iam_auth.nil?
  @idle_client_timeout = idle_client_timeout
  Jsii::Type.check_type(@idle_client_timeout, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "idleClientTimeout") unless @idle_client_timeout.nil?
  @init_query = init_query
  Jsii::Type.check_type(@init_query, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "initQuery") unless @init_query.nil?
  @max_connections_percent = max_connections_percent
  Jsii::Type.check_type(@max_connections_percent, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxConnectionsPercent") unless @max_connections_percent.nil?
  @max_idle_connections_percent = max_idle_connections_percent
  Jsii::Type.check_type(@max_idle_connections_percent, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxIdleConnectionsPercent") unless @max_idle_connections_percent.nil?
  @require_tls = require_tls
  Jsii::Type.check_type(@require_tls, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "requireTLS") unless @require_tls.nil?
  @role = role
  Jsii::Type.check_type(@role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "role") unless @role.nil?
  @secrets = secrets
  Jsii::Type.check_type(@secrets, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19zZWNyZXRzbWFuYWdlci5JU2VjcmV0In0sImtpbmQiOiJhcnJheSJ9fQ==")), "secrets") unless @secrets.nil?
  @security_groups = security_groups
  Jsii::Type.check_type(@security_groups, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuSVNlY3VyaXR5R3JvdXAifSwia2luZCI6ImFycmF5In19")), "securityGroups") unless @security_groups.nil?
  @session_pinning_filters = session_pinning_filters
  Jsii::Type.check_type(@session_pinning_filters, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19yZHMuU2Vzc2lvblBpbm5pbmdGaWx0ZXIifSwia2luZCI6ImFycmF5In19")), "sessionPinningFilters") unless @session_pinning_filters.nil?
  @vpc_subnets = vpc_subnets.is_a?(Hash) ? ::AWSCDK::EC2::SubnetSelection.new(**vpc_subnets.transform_keys(&:to_sym)) : vpc_subnets
  Jsii::Type.check_type(@vpc_subnets, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlN1Ym5ldFNlbGVjdGlvbiJ9")), "vpcSubnets") unless @vpc_subnets.nil?
end

Instance Attribute Details

#borrow_timeoutAWSCDK::Duration? (readonly)

Note:

Default: cdk.Duration.seconds(120)

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.

Returns:



74
75
76
# File 'rds/database_proxy_options.rb', line 74

def borrow_timeout
  @borrow_timeout
end

#client_password_auth_typeAWSCDK::RDS::ClientPasswordAuthType? (readonly)

Note:

Default: - CloudFormation defaults will apply given the specified database engine.

Specifies the details of authentication used by a proxy to log in as a specific database user.



79
80
81
# File 'rds/database_proxy_options.rb', line 79

def client_password_auth_type
  @client_password_auth_type
end

#db_proxy_nameString? (readonly)

Note:

Default: - Generated by CloudFormation (recommended)

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.

Returns:

  • (String, nil)


88
89
90
# File 'rds/database_proxy_options.rb', line 88

def db_proxy_name
  @db_proxy_name
end

#debug_loggingBoolean? (readonly)

Note:

Default: false

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.

Returns:

  • (Boolean, nil)


98
99
100
# File 'rds/database_proxy_options.rb', line 98

def debug_logging
  @debug_logging
end

#default_auth_schemeAWSCDK::RDS::DefaultAuthScheme? (readonly)

Note:

Default: DefaultAuthScheme.NONE

The default authentication scheme that the proxy uses for client connections to the proxy and connections from the proxy to the underlying database.

When set to DefaultAuthScheme.IAM_AUTH, the proxy uses end-to-end IAM authentication to connect to the database.



105
106
107
# File 'rds/database_proxy_options.rb', line 105

def default_auth_scheme
  @default_auth_scheme
end

#iam_authBoolean? (readonly)

Note:

Default: false

Whether to require or disallow AWS Identity and Access Management (IAM) authentication for connections to the proxy.

Returns:

  • (Boolean, nil)


110
111
112
# File 'rds/database_proxy_options.rb', line 110

def iam_auth
  @iam_auth
end

#idle_client_timeoutAWSCDK::Duration? (readonly)

Note:

Default: cdk.Duration.minutes(30)

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.

Returns:



117
118
119
# File 'rds/database_proxy_options.rb', line 117

def idle_client_timeout
  @idle_client_timeout
end

#init_queryString? (readonly)

Note:

Default: - no initialization 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.

Returns:

  • (String, nil)


129
130
131
# File 'rds/database_proxy_options.rb', line 129

def init_query
  @init_query
end

#max_connections_percentNumeric? (readonly)

Note:

Default: 100

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

Returns:

  • (Numeric, nil)


139
140
141
# File 'rds/database_proxy_options.rb', line 139

def max_connections_percent
  @max_connections_percent
end

#max_idle_connections_percentNumeric? (readonly)

Note:

Default: 50

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

Returns:

  • (Numeric, nil)


152
153
154
# File 'rds/database_proxy_options.rb', line 152

def max_idle_connections_percent
  @max_idle_connections_percent
end

#require_tlsBoolean? (readonly)

Note:

Default: true

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.

Returns:

  • (Boolean, nil)


159
160
161
# File 'rds/database_proxy_options.rb', line 159

def require_tls
  @require_tls
end

#roleAWSCDK::IAM::IRole? (readonly)

Note:

Default: - A role will automatically be created

IAM role that the proxy uses to access secrets in AWS Secrets Manager.

Returns:



164
165
166
# File 'rds/database_proxy_options.rb', line 164

def role
  @role
end

#secretsArray<AWSCDK::SecretsManager::ISecret>? (readonly)

Note:

Default: None

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 when defaultAuthScheme is DefaultAuthScheme.NONE.

Returns:



172
173
174
# File 'rds/database_proxy_options.rb', line 172

def secrets
  @secrets
end

#security_groupsArray<AWSCDK::EC2::ISecurityGroup>? (readonly)

Note:

Default: - No security groups

One or more VPC security groups to associate with the new proxy.

Returns:



177
178
179
# File 'rds/database_proxy_options.rb', line 177

def security_groups
  @security_groups
end

#session_pinning_filtersArray<AWSCDK::RDS::SessionPinningFilter>? (readonly)

Note:

Default: - no 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.

Returns:



184
185
186
# File 'rds/database_proxy_options.rb', line 184

def session_pinning_filters
  @session_pinning_filters
end

#vpcAWSCDK::EC2::IVPC (readonly)

The VPC to associate with the new proxy.

Returns:



64
65
66
# File 'rds/database_proxy_options.rb', line 64

def vpc
  @vpc
end

#vpc_subnetsAWSCDK::EC2::SubnetSelection? (readonly)

Note:

Default: - the VPC default strategy if not specified.

The subnets used by the proxy.



189
190
191
# File 'rds/database_proxy_options.rb', line 189

def vpc_subnets
  @vpc_subnets
end

Class Method Details

.jsii_propertiesObject



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'rds/database_proxy_options.rb', line 191

def self.jsii_properties
  {
    :vpc => "vpc",
    :borrow_timeout => "borrowTimeout",
    :client_password_auth_type => "clientPasswordAuthType",
    :db_proxy_name => "dbProxyName",
    :debug_logging => "debugLogging",
    :default_auth_scheme => "defaultAuthScheme",
    :iam_auth => "iamAuth",
    :idle_client_timeout => "idleClientTimeout",
    :init_query => "initQuery",
    :max_connections_percent => "maxConnectionsPercent",
    :max_idle_connections_percent => "maxIdleConnectionsPercent",
    :require_tls => "requireTLS",
    :role => "role",
    :secrets => "secrets",
    :security_groups => "securityGroups",
    :session_pinning_filters => "sessionPinningFilters",
    :vpc_subnets => "vpcSubnets",
  }
end

Instance Method Details

#to_jsiiObject



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'rds/database_proxy_options.rb', line 213

def to_jsii
  result = {}
  result.merge!({
    "vpc" => @vpc,
    "borrowTimeout" => @borrow_timeout,
    "clientPasswordAuthType" => @client_password_auth_type,
    "dbProxyName" => @db_proxy_name,
    "debugLogging" => @debug_logging,
    "defaultAuthScheme" => @default_auth_scheme,
    "iamAuth" => @iam_auth,
    "idleClientTimeout" => @idle_client_timeout,
    "initQuery" => @init_query,
    "maxConnectionsPercent" => @max_connections_percent,
    "maxIdleConnectionsPercent" => @max_idle_connections_percent,
    "requireTLS" => @require_tls,
    "role" => @role,
    "secrets" => @secrets,
    "securityGroups" => @security_groups,
    "sessionPinningFilters" => @session_pinning_filters,
    "vpcSubnets" => @vpc_subnets,
  })
  result.compact
end