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
-
#add_proxy(id, options) ⇒ AWSCDK::RDS::DatabaseProxy
Add a new db proxy to this instance.
-
#apply_removal_policy(policy) ⇒ void
Apply the given removal policy to this resource.
-
#as_secret_attachment_target ⇒ AWSCDK::SecretsManager::SecretAttachmentTargetProps
Renders the target specifications.
-
#connections ⇒ AWSCDK::EC2::Connections
The network connections associated with this resource.
-
#db_instance_endpoint_address ⇒ String
The instance endpoint address.
-
#db_instance_endpoint_port ⇒ String
The instance endpoint port.
-
#db_instance_ref ⇒ AWSCDK::Interfaces::AWSRDS::DBInstanceReference
A reference to a DBInstance resource.
-
#engine ⇒ AWSCDK::RDS::IInstanceEngine?
The engine of this database Instance.
-
#env ⇒ AWSCDK::Interfaces::ResourceEnvironment
The environment this resource belongs to.
-
#grant_connect(grantee, db_user = nil) ⇒ AWSCDK::IAM::Grant
Grant the given identity connection access to the database.
-
#instance_arn ⇒ String
The instance arn.
-
#instance_endpoint ⇒ AWSCDK::RDS::Endpoint
The instance endpoint.
-
#instance_identifier ⇒ String
The instance identifier.
-
#instance_resource_id ⇒ String?
The AWS Region-unique, immutable identifier for the DB instance.
-
#metric(metric_name, props = nil) ⇒ AWSCDK::CloudWatch::Metric
Return the given named metric for this DBInstance.
-
#metric_cpu_utilization(props = nil) ⇒ AWSCDK::CloudWatch::Metric
The percentage of CPU utilization.
-
#metric_database_connections(props = nil) ⇒ AWSCDK::CloudWatch::Metric
The number of database connections in use.
-
#metric_free_storage_space(props = nil) ⇒ AWSCDK::CloudWatch::Metric
The amount of available storage space.
-
#metric_freeable_memory(props = nil) ⇒ AWSCDK::CloudWatch::Metric
The amount of available random access memory.
-
#metric_read_iops(props = nil) ⇒ AWSCDK::CloudWatch::Metric
The average number of disk write I/O operations per second.
-
#metric_write_iops(props = nil) ⇒ AWSCDK::CloudWatch::Metric
The average number of disk read I/O operations per second.
-
#node ⇒ Constructs::Node
The tree node.
-
#on_event(id, options = nil) ⇒ AWSCDK::Events::Rule
Defines a CloudWatch event rule which triggers for instance events.
-
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
-
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Class Method Details
.jsii_overridable_methods ⇒ Object
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.
152 153 154 155 156 157 |
# File 'rds/i_database_instance.rb', line 152 def add_proxy(id, ) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") = .is_a?(Hash) ? ::AWSCDK::RDS::DatabaseProxyOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfcmRzLkRhdGFiYXNlUHJveHlPcHRpb25zIn0=")), "options") jsii_call_method("addProxy", [id, ]) 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).
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_target ⇒ AWSCDK::SecretsManager::SecretAttachmentTargetProps
Renders the target specifications.
143 144 145 |
# File 'rds/i_database_instance.rb', line 143 def () jsii_call_method("asSecretAttachmentTarget", []) end |
#connections ⇒ AWSCDK::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_address ⇒ String
The instance endpoint address.
57 58 59 |
# File 'rds/i_database_instance.rb', line 57 def db_instance_endpoint_address() jsii_get_property("dbInstanceEndpointAddress") end |
#db_instance_endpoint_port ⇒ String
The instance endpoint port.
64 65 66 |
# File 'rds/i_database_instance.rb', line 64 def db_instance_endpoint_port() jsii_get_property("dbInstanceEndpointPort") end |
#db_instance_ref ⇒ AWSCDK::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 |
#engine ⇒ AWSCDK::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 |
#env ⇒ AWSCDK::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.
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_arn ⇒ String
The instance arn.
71 72 73 |
# File 'rds/i_database_instance.rb', line 71 def instance_arn() jsii_get_property("instanceArn") end |
#instance_endpoint ⇒ AWSCDK::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_identifier ⇒ String
The instance identifier.
85 86 87 |
# File 'rds/i_database_instance.rb', line 85 def instance_identifier() jsii_get_property("instanceIdentifier") end |
#instance_resource_id ⇒ String?
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.
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
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
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
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
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
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
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 |
#node ⇒ Constructs::Node
The tree 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.
262 263 264 265 266 267 |
# File 'rds/i_database_instance.rb', line 262 def on_event(id, = nil) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") = .is_a?(Hash) ? ::AWSCDK::Events::OnEventOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZXZlbnRzLk9uRXZlbnRPcHRpb25zIn0=")), "options") unless .nil? jsii_call_method("onEvent", [id, ]) end |
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
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.
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 |