Module: AWSCDK::RDS::IDatabaseInstance

Includes:
EC2::IConnectable, IResource, Interfaces::AWSRDS::IDBInstanceRef, SecretsManager::ISecretAttachmentTarget
Included in:
DatabaseInstance, DatabaseInstanceBase, DatabaseInstanceFromSnapshot, DatabaseInstanceReadReplica
Defined in:
rds/i_database_instance.rb

Overview

A database instance.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.jsii_overridable_methodsObject



269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'rds/i_database_instance.rb', line 269

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :env => { kind: :property, name: "env", is_optional: false },
    :stack => { kind: :property, name: "stack", is_optional: false },
    :connections => { kind: :property, name: "connections", is_optional: false },
    :db_instance_ref => { kind: :property, name: "dbInstanceRef", is_optional: false },
    :db_instance_endpoint_address => { kind: :property, name: "dbInstanceEndpointAddress", is_optional: false },
    :db_instance_endpoint_port => { kind: :property, name: "dbInstanceEndpointPort", is_optional: false },
    :instance_arn => { kind: :property, name: "instanceArn", is_optional: false },
    :instance_endpoint => { kind: :property, name: "instanceEndpoint", is_optional: false },
    :instance_identifier => { kind: :property, name: "instanceIdentifier", is_optional: false },
    :engine => { kind: :property, name: "engine", is_optional: true },
    :instance_resource_id => { kind: :property, name: "instanceResourceId", is_optional: true },
    :with => { kind: :method, name: "with", is_optional: false },
    :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false },
    :as_secret_attachment_target => { kind: :method, name: "asSecretAttachmentTarget", is_optional: false },
    :add_proxy => { kind: :method, name: "addProxy", is_optional: false },
    :grant_connect => { kind: :method, name: "grantConnect", is_optional: false },
    :metric => { kind: :method, name: "metric", is_optional: false },
    :metric_cpu_utilization => { kind: :method, name: "metricCPUUtilization", is_optional: false },
    :metric_database_connections => { kind: :method, name: "metricDatabaseConnections", is_optional: false },
    :metric_freeable_memory => { kind: :method, name: "metricFreeableMemory", is_optional: false },
    :metric_free_storage_space => { kind: :method, name: "metricFreeStorageSpace", is_optional: false },
    :metric_read_iops => { kind: :method, name: "metricReadIOPS", is_optional: false },
    :metric_write_iops => { kind: :method, name: "metricWriteIOPS", is_optional: false },
    :on_event => { kind: :method, name: "onEvent", is_optional: false },
  }
end

Instance Method Details

#add_proxy(id, options) ⇒ AWSCDK::RDS::DatabaseProxy

Add a new db proxy to this instance.

Parameters:

Returns:



152
153
154
155
156
157
# File 'rds/i_database_instance.rb', line 152

def add_proxy(id, options)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  options = options.is_a?(Hash) ? ::AWSCDK::RDS::DatabaseProxyOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfcmRzLkRhdGFiYXNlUHJveHlPcHRpb25zIn0=")), "options")
  jsii_call_method("addProxy", [id, options])
end

#apply_removal_policy(policy) ⇒ void

This method returns an undefined value.

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:



135
136
137
138
# File 'rds/i_database_instance.rb', line 135

def apply_removal_policy(policy)
  Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy")
  jsii_call_method("applyRemovalPolicy", [policy])
end

#as_secret_attachment_targetAWSCDK::SecretsManager::SecretAttachmentTargetProps

Renders the target specifications.



143
144
145
# File 'rds/i_database_instance.rb', line 143

def as_secret_attachment_target()
  jsii_call_method("asSecretAttachmentTarget", [])
end

#connectionsAWSCDK::EC2::Connections

The network connections associated with this resource.



43
44
45
# File 'rds/i_database_instance.rb', line 43

def connections()
  jsii_get_property("connections")
end

#db_instance_endpoint_addressString

The instance endpoint address.

Returns:

  • (String)


57
58
59
# File 'rds/i_database_instance.rb', line 57

def db_instance_endpoint_address()
  jsii_get_property("dbInstanceEndpointAddress")
end

#db_instance_endpoint_portString

The instance endpoint port.

Returns:

  • (String)


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

def db_instance_endpoint_port()
  jsii_get_property("dbInstanceEndpointPort")
end

#db_instance_refAWSCDK::Interfaces::AWSRDS::DBInstanceReference

A reference to a DBInstance resource.



50
51
52
# File 'rds/i_database_instance.rb', line 50

def db_instance_ref()
  jsii_get_property("dbInstanceRef")
end

#engineAWSCDK::RDS::IInstanceEngine?

The engine of this database Instance.

May be not known for imported Instances if it wasn't provided explicitly, or for read replicas.



95
96
97
# File 'rds/i_database_instance.rb', line 95

def engine()
  jsii_get_property("engine")
end

#envAWSCDK::Interfaces::ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.



29
30
31
# File 'rds/i_database_instance.rb', line 29

def env()
  jsii_get_property("env")
end

#grant_connect(grantee, db_user = nil) ⇒ AWSCDK::IAM::Grant

Grant the given identity connection access to the database.

Parameters:

  • grantee (AWSCDK::IAM::IGrantable)

    the Principal to grant the permissions to.

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

    the name of the database user to allow connecting as to the db instance.

Returns:



164
165
166
167
168
# File 'rds/i_database_instance.rb', line 164

def grant_connect(grantee, db_user = nil)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  Jsii::Type.check_type(db_user, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "dbUser") unless db_user.nil?
  jsii_call_method("grantConnect", [grantee, db_user])
end

#instance_arnString

The instance arn.

Returns:

  • (String)


71
72
73
# File 'rds/i_database_instance.rb', line 71

def instance_arn()
  jsii_get_property("instanceArn")
end

#instance_endpointAWSCDK::RDS::Endpoint

The instance endpoint.



78
79
80
# File 'rds/i_database_instance.rb', line 78

def instance_endpoint()
  jsii_get_property("instanceEndpoint")
end

#instance_identifierString

The instance identifier.

Returns:

  • (String)


85
86
87
# File 'rds/i_database_instance.rb', line 85

def instance_identifier()
  jsii_get_property("instanceIdentifier")
end

#instance_resource_idString?

The AWS Region-unique, immutable identifier for the DB instance.

This identifier is found in AWS CloudTrail log entries whenever the AWS KMS key for the DB instance is accessed.



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

def instance_resource_id()
  jsii_get_property("instanceResourceId")
end

#metric(metric_name, props = nil) ⇒ AWSCDK::CloudWatch::Metric

Return the given named metric for this DBInstance.

Parameters:

Returns:



175
176
177
178
179
180
# File 'rds/i_database_instance.rb', line 175

def metric(metric_name, props = nil)
  Jsii::Type.check_type(metric_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricName")
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metric", [metric_name, props])
end

#metric_cpu_utilization(props = nil) ⇒ AWSCDK::CloudWatch::Metric

The percentage of CPU utilization.

Average over 5 minutes

Parameters:

Returns:



188
189
190
191
192
# File 'rds/i_database_instance.rb', line 188

def metric_cpu_utilization(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricCPUUtilization", [props])
end

#metric_database_connections(props = nil) ⇒ AWSCDK::CloudWatch::Metric

The number of database connections in use.

Average over 5 minutes

Parameters:

Returns:



200
201
202
203
204
# File 'rds/i_database_instance.rb', line 200

def metric_database_connections(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricDatabaseConnections", [props])
end

#metric_free_storage_space(props = nil) ⇒ AWSCDK::CloudWatch::Metric

The amount of available storage space.

Average over 5 minutes

Parameters:

Returns:



224
225
226
227
228
# File 'rds/i_database_instance.rb', line 224

def metric_free_storage_space(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricFreeStorageSpace", [props])
end

#metric_freeable_memory(props = nil) ⇒ AWSCDK::CloudWatch::Metric

The amount of available random access memory.

Average over 5 minutes

Parameters:

Returns:



212
213
214
215
216
# File 'rds/i_database_instance.rb', line 212

def metric_freeable_memory(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricFreeableMemory", [props])
end

#metric_read_iops(props = nil) ⇒ AWSCDK::CloudWatch::Metric

The average number of disk write I/O operations per second.

Average over 5 minutes

Parameters:

Returns:



236
237
238
239
240
# File 'rds/i_database_instance.rb', line 236

def metric_read_iops(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricReadIOPS", [props])
end

#metric_write_iops(props = nil) ⇒ AWSCDK::CloudWatch::Metric

The average number of disk read I/O operations per second.

Average over 5 minutes

Parameters:

Returns:



248
249
250
251
252
# File 'rds/i_database_instance.rb', line 248

def metric_write_iops(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricWriteIOPS", [props])
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


14
15
16
# File 'rds/i_database_instance.rb', line 14

def node()
  jsii_get_property("node")
end

#on_event(id, options = nil) ⇒ AWSCDK::Events::Rule

Defines a CloudWatch event rule which triggers for instance events.

Use rule.addEventPattern(pattern) to specify a filter.

Parameters:

Returns:



262
263
264
265
266
267
# File 'rds/i_database_instance.rb', line 262

def on_event(id, options = nil)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  options = options.is_a?(Hash) ? ::AWSCDK::Events::OnEventOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZXZlbnRzLk9uRXZlbnRPcHRpb25zIn0=")), "options") unless options.nil?
  jsii_call_method("onEvent", [id, options])
end

#stackAWSCDK::Stack

The stack in which this resource is defined.

Returns:



36
37
38
# File 'rds/i_database_instance.rb', line 36

def stack()
  jsii_get_property("stack")
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited.

Parameters:

  • mixins (Array<Constructs::IMixin>)

    The mixins to apply.

Returns:

  • (Constructs::IConstruct)

    This construct for chaining



116
117
118
119
120
121
# File 'rds/i_database_instance.rb', line 116

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end