aws-cdk-lib.aws_rds.IDatabaseInstance

interface IDatabaseInstance

LanguageType name
.NETAmazon.CDK.AWS.RDS.IDatabaseInstance
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsrds#IDatabaseInstance
Javasoftware.amazon.awscdk.services.rds.IDatabaseInstance
Pythonaws_cdk.aws_rds.IDatabaseInstance
TypeScript (source)aws-cdk-lib » aws_rds » IDatabaseInstance

Implemented by DatabaseInstance, DatabaseInstanceFromSnapshot, DatabaseInstanceReadReplica

Obtainable from DatabaseInstanceBase.fromDatabaseInstanceAttributes()

A database instance.

Properties

NameTypeDescription
connectionsConnectionsThe network connections associated with this resource.
dbInstanceEndpointAddressstringThe instance endpoint address.
dbInstanceEndpointPortstringThe instance endpoint port.
envResourceEnvironmentThe environment this resource belongs to.
instanceArnstringThe instance arn.
instanceEndpointEndpointThe instance endpoint.
instanceIdentifierstringThe instance identifier.
nodeNodeThe tree node.
stackStackThe stack in which this resource is defined.
engine?IInstanceEngineThe engine of this database Instance.
instanceResourceId?stringThe AWS Region-unique, immutable identifier for the DB instance.

connections

Type: Connections

The network connections associated with this resource.


dbInstanceEndpointAddress

Type: string

The instance endpoint address.


dbInstanceEndpointPort

Type: string

The instance endpoint port.


env

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


instanceArn

Type: string

The instance arn.


instanceEndpoint

Type: Endpoint

The instance endpoint.


instanceIdentifier

Type: string

The instance identifier.


node

Type: Node

The tree node.


stack

Type: Stack

The stack in which this resource is defined.


engine?

Type: IInstanceEngine (optional)

The engine of this database Instance.

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


instanceResourceId?

Type: string (optional)

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.

See also: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbinstance.html#aws-resource-rds-dbinstance-return-values

Methods

NameDescription
addProxy(id, options)Add a new db proxy to this instance.
applyRemovalPolicy(policy)Apply the given removal policy to this resource.
asSecretAttachmentTarget()Renders the target specifications.
grantConnect(grantee, dbUser?)Grant the given identity connection access to the database.
metric(metricName, props?)Return the given named metric for this DBInstance.
metricCPUUtilization(props?)The percentage of CPU utilization.
metricDatabaseConnections(props?)The number of database connections in use.
metricFreeStorageSpace(props?)The amount of available storage space.
metricFreeableMemory(props?)The amount of available random access memory.
metricReadIOPS(props?)The average number of disk write I/O operations per second.
metricWriteIOPS(props?)The average number of disk read I/O operations per second.
onEvent(id, options?)Defines a CloudWatch event rule which triggers for instance events.

addProxy(id, options)

public addProxy(id: string, options: DatabaseProxyOptions): DatabaseProxy

Parameters

  • id string
  • options DatabaseProxyOptions

Returns

  • DatabaseProxy

Add a new db proxy to this instance.


applyRemovalPolicy(policy)

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

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).


asSecretAttachmentTarget()

public asSecretAttachmentTarget(): SecretAttachmentTargetProps

Returns

  • SecretAttachmentTargetProps

Renders the target specifications.


grantConnect(grantee, dbUser?)

public grantConnect(grantee: IGrantable, dbUser?: string): Grant

Parameters

  • grantee IGrantable — the Principal to grant the permissions to.
  • dbUser string — the name of the database user to allow connecting as to the db instance.

Returns

  • Grant

Grant the given identity connection access to the database.


metric(metricName, props?)

public metric(metricName: string, props?: MetricOptions): Metric

Parameters

  • metricName string
  • props MetricOptions

Returns

  • Metric

Return the given named metric for this DBInstance.


metricCPUUtilization(props?)

public metricCPUUtilization(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The percentage of CPU utilization.

Average over 5 minutes


metricDatabaseConnections(props?)

public metricDatabaseConnections(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The number of database connections in use.

Average over 5 minutes


metricFreeStorageSpace(props?)

public metricFreeStorageSpace(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The amount of available storage space.

Average over 5 minutes


metricFreeableMemory(props?)

public metricFreeableMemory(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The amount of available random access memory.

Average over 5 minutes


metricReadIOPS(props?)

public metricReadIOPS(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

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

Average over 5 minutes


metricWriteIOPS(props?)

public metricWriteIOPS(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

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

Average over 5 minutes


onEvent(id, options?)

public onEvent(id: string, options?: OnEventOptions): Rule

Parameters

  • id string
  • options OnEventOptions

Returns

  • Rule

Defines a CloudWatch event rule which triggers for instance events.

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