Class DatabaseInstance
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.rds.DatabaseInstanceBase
software.amazon.awscdk.services.rds.DatabaseInstance
- All Implemented Interfaces:
IEnvironmentAware,IResource,IConnectable,IDatabaseInstance,ISecretAttachmentTarget,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.119.0 (build 1634eac)",
date="2025-11-13T16:10:12.627Z")
@Stability(Stable)
public class DatabaseInstance
extends DatabaseInstanceBase
implements IDatabaseInstance
A database instance.
Example:
Vpc vpc;
DatabaseInstance iopsInstance = DatabaseInstance.Builder.create(this, "IopsInstance")
.engine(DatabaseInstanceEngine.mysql(MySqlInstanceEngineProps.builder().version(MysqlEngineVersion.VER_8_0_39).build()))
.vpc(vpc)
.storageType(StorageType.IO1)
.iops(5000)
.build();
DatabaseInstance gp3Instance = DatabaseInstance.Builder.create(this, "Gp3Instance")
.engine(DatabaseInstanceEngine.mysql(MySqlInstanceEngineProps.builder().version(MysqlEngineVersion.VER_8_0_39).build()))
.vpc(vpc)
.allocatedStorage(500)
.storageType(StorageType.GP3)
.storageThroughput(500)
.build();
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.rds.IDatabaseInstance
IDatabaseInstance.Jsii$Default, IDatabaseInstance.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDatabaseInstance(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedDatabaseInstance(software.amazon.jsii.JsiiObjectRef objRef) DatabaseInstance(software.constructs.Construct scope, String id, DatabaseInstanceProps props) -
Method Summary
Modifier and TypeMethodDescriptionaddRotationMultiUser(String id, RotationMultiUserOptions options) Adds the multi user rotation to this instance.Adds the single user rotation of the master password to this instance.Adds the single user rotation of the master password to this instance.The log group is created whencloudwatchLogsExportsis set.Access to network connections.The instance endpoint address.The instance endpoint port.protected BooleanThe engine of this database Instance.The instance endpoint.The instance identifier.The AWS Region-unique, immutable identifier for the DB instance.protected InstanceTypeprotected CfnDBInstancePropsThe AWS Secrets Manager secret attached to the instance.protected CfnDBInstancePropsgetVpc()The VPC where this database instance is deployed.protected SubnetSelectiongrantConnect(IGrantable grantee) Grant the given identity connection access to the database.grantConnect(IGrantable grantee, String dbUser) Grant the given identity connection access to the database.protected voidprotected voidMethods inherited from class software.amazon.awscdk.services.rds.DatabaseInstanceBase
addProxy, asSecretAttachmentTarget, fromDatabaseInstanceAttributes, fromLookup, getInstanceArn, metric, metric, metricCPUUtilization, metricCPUUtilization, metricDatabaseConnections, metricDatabaseConnections, metricFreeableMemory, metricFreeableMemory, metricFreeStorageSpace, metricFreeStorageSpace, metricReadIOPS, metricReadIOPS, metricWriteIOPS, metricWriteIOPS, onEvent, onEventMethods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourceMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.services.rds.IDatabaseInstance
addProxy, getInstanceArn, metric, metric, metricCPUUtilization, metricCPUUtilization, metricDatabaseConnections, metricDatabaseConnections, metricFreeableMemory, metricFreeableMemory, metricFreeStorageSpace, metricFreeStorageSpace, metricReadIOPS, metricReadIOPS, metricWriteIOPS, metricWriteIOPS, onEvent, onEventMethods inherited from interface software.amazon.awscdk.interfaces.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getStackMethods inherited from interface software.amazon.awscdk.services.secretsmanager.ISecretAttachmentTarget
asSecretAttachmentTargetMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
Constructor Details
-
DatabaseInstance
protected DatabaseInstance(software.amazon.jsii.JsiiObjectRef objRef) -
DatabaseInstance
protected DatabaseInstance(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
DatabaseInstance
@Stability(Stable) public DatabaseInstance(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull DatabaseInstanceProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
-
Method Details
-
addRotationMultiUser
@Stability(Stable) @NotNull public SecretRotation addRotationMultiUser(@NotNull String id, @NotNull RotationMultiUserOptions options) Adds the multi user rotation to this instance.- Parameters:
id- This parameter is required.options- This parameter is required.
-
addRotationSingleUser
@Stability(Stable) @NotNull public SecretRotation addRotationSingleUser(@Nullable RotationSingleUserOptions options) Adds the single user rotation of the master password to this instance.- Parameters:
options- the options for the rotation, if you want to override the defaults.
-
addRotationSingleUser
Adds the single user rotation of the master password to this instance. -
grantConnect
@Stability(Stable) @NotNull public Grant grantConnect(@NotNull IGrantable grantee, @Nullable String dbUser) Grant the given identity connection access to the database.- Specified by:
grantConnectin interfaceIDatabaseInstance- Overrides:
grantConnectin classDatabaseInstanceBase- Parameters:
grantee- the Principal to grant the permissions to. This parameter is required.dbUser- the name of the database user to allow connecting as to the db instance, or the default database user, obtained from the Secret, if not specified.
-
grantConnect
Grant the given identity connection access to the database.- Specified by:
grantConnectin interfaceIDatabaseInstance- Overrides:
grantConnectin classDatabaseInstanceBase- Parameters:
grantee- the Principal to grant the permissions to. This parameter is required.
-
setLogRetention
@Stability(Stable) protected void setLogRetention() -
getCloudwatchLogGroups
The log group is created whencloudwatchLogsExportsis set.Each export value will create a separate log group.
-
getConnections
Access to network connections.- Specified by:
getConnectionsin interfaceIConnectable- Specified by:
getConnectionsin classDatabaseInstanceBase
-
getDbInstanceEndpointAddress
The instance endpoint address.- Specified by:
getDbInstanceEndpointAddressin interfaceIDatabaseInstance- Specified by:
getDbInstanceEndpointAddressin classDatabaseInstanceBase
-
getDbInstanceEndpointPort
The instance endpoint port.- Specified by:
getDbInstanceEndpointPortin interfaceIDatabaseInstance- Specified by:
getDbInstanceEndpointPortin classDatabaseInstanceBase
-
getInstanceEndpoint
The instance endpoint.- Specified by:
getInstanceEndpointin interfaceIDatabaseInstance- Specified by:
getInstanceEndpointin classDatabaseInstanceBase
-
getInstanceIdentifier
The instance identifier.- Specified by:
getInstanceIdentifierin interfaceIDatabaseInstance- Specified by:
getInstanceIdentifierin classDatabaseInstanceBase
-
getInstanceType
-
getNewCfnProps
-
getSourceCfnProps
-
getVpc
The VPC where this database instance is deployed. -
getEngine
The engine of this database Instance.May be not known for imported Instances if it wasn't provided explicitly, or for read replicas.
- Specified by:
getEnginein interfaceIDatabaseInstance- Specified by:
getEnginein classDatabaseInstanceBase
-
getInstanceResourceId
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.
- Specified by:
getInstanceResourceIdin interfaceIDatabaseInstance- Specified by:
getInstanceResourceIdin classDatabaseInstanceBase- See Also:
-
getSecret
The AWS Secrets Manager secret attached to the instance. -
getVpcPlacement
-
getEnableIamAuthentication
- Specified by:
getEnableIamAuthenticationin classDatabaseInstanceBase
-
setEnableIamAuthentication
- Specified by:
setEnableIamAuthenticationin classDatabaseInstanceBase
-