Class DatabaseCluster
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.rds.DatabaseClusterBase
software.amazon.awscdk.services.rds.DatabaseCluster
- All Implemented Interfaces:
IEnvironmentAware,IResource,IConnectable,IDatabaseCluster,ISecretAttachmentTarget,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.118.0 (build 02eec31)",
date="2025-11-10T13:40:13.276Z")
@Stability(Stable)
public class DatabaseCluster
extends DatabaseClusterBase
Create a clustered database with a given number of instances.
Example:
Vpc vpc;
DatabaseCluster cluster = DatabaseCluster.Builder.create(this, "Database")
.engine(DatabaseClusterEngine.auroraMysql(AuroraMysqlClusterEngineProps.builder()
.version(AuroraMysqlEngineVersion.VER_3_03_0)
.build()))
.writer(ClusterInstance.provisioned("writer"))
.vpc(vpc)
.build();
DatabaseProxy proxy = DatabaseProxy.Builder.create(this, "Proxy")
.proxyTarget(ProxyTarget.fromCluster(cluster))
.secrets(List.of(cluster.getSecret()))
.vpc(vpc)
.clientPasswordAuthType(ClientPasswordAuthType.MYSQL_NATIVE_PASSWORD)
.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.IDatabaseCluster
IDatabaseCluster.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDatabaseCluster(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedDatabaseCluster(software.amazon.jsii.JsiiObjectRef objRef) DatabaseCluster(software.constructs.Construct scope, String id, DatabaseClusterProps props) -
Method Summary
Modifier and TypeMethodDescriptionaddRotationMultiUser(String id, RotationMultiUserOptions options) Adds the multi user rotation to this cluster.Adds the single user rotation of the master password to this cluster.Adds the single user rotation of the master password to this cluster.static IDatabaseClusterfromDatabaseClusterAttributes(software.constructs.Construct scope, String id, DatabaseClusterAttributes attrs) Import an existing DatabaseCluster from properties.static IDatabaseClusterfromLookup(software.constructs.Construct scope, String id, DatabaseClusterLookupOptions options) Lookup an existing DatabaseCluster using clusterIdentifier.The log group is created whencloudwatchLogsExportsis set.The endpoint to use for read/write operations.Identifier of the cluster.Endpoint to use for load-balanced read-only operations.The immutable identifier for the cluster; for example: cluster-ABCD1234EFGH5678IJKL90MNOP.Access to the network connections.The database insights mode.protected BooleanThe engine for this Cluster.protected BooleanEndpoints which address each individual replica.Identifiers of the replicas.The IAM role for the enhanced monitoring.Application for multi user rotation to this cluster.protected CfnDBClusterPropsThe AWS KMS key for encryption of Performance Insights data.The amount of time, in days, to retain Performance Insights data.Whether Performance Insights is enabled at cluster level.The secret attached to this cluster.protected List<ISecurityGroup> protected Durationprotected Numberprotected NumberApplication for single user rotation of the master password to this cluster.protected ISubnetGroupgetVpc()The VPC network to place the cluster in.The cluster's subnets.This value is represented as a percentage.This value is represented as a percentage.As a cluster-level metric, it represents the average of the ServerlessDatabaseCapacity values of all the Aurora Serverless v2 DB instances in the cluster.As a cluster-level metric, it represents the average of the ServerlessDatabaseCapacity values of all the Aurora Serverless v2 DB instances in the cluster.protected voidsetEnableDataApi(Boolean value) protected voidsetHasServerlessInstance(Boolean value) Methods inherited from class software.amazon.awscdk.services.rds.DatabaseClusterBase
addProxy, asSecretAttachmentTarget, getClusterArn, grantConnect, grantDataApiAccess, metric, metric, metricCPUUtilization, metricCPUUtilization, metricDatabaseConnections, metricDatabaseConnections, metricDeadlocks, metricDeadlocks, metricEngineUptime, metricEngineUptime, metricFreeableMemory, metricFreeableMemory, metricFreeLocalStorage, metricFreeLocalStorage, metricNetworkReceiveThroughput, metricNetworkReceiveThroughput, metricNetworkThroughput, metricNetworkThroughput, metricNetworkTransmitThroughput, metricNetworkTransmitThroughput, metricSnapshotStorageUsed, metricSnapshotStorageUsed, metricTotalBackupStorageBilled, metricTotalBackupStorageBilled, metricVolumeBytesUsed, metricVolumeBytesUsed, metricVolumeReadIOPs, metricVolumeReadIOPs, metricVolumeWriteIOPs, metricVolumeWriteIOPsMethods 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.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
Constructor Details
-
DatabaseCluster
protected DatabaseCluster(software.amazon.jsii.JsiiObjectRef objRef) -
DatabaseCluster
protected DatabaseCluster(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
DatabaseCluster
@Stability(Stable) public DatabaseCluster(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull DatabaseClusterProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
-
Method Details
-
fromDatabaseClusterAttributes
@Stability(Stable) @NotNull public static IDatabaseCluster fromDatabaseClusterAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull DatabaseClusterAttributes attrs) Import an existing DatabaseCluster from properties.- Parameters:
scope- This parameter is required.id- This parameter is required.attrs- This parameter is required.
-
fromLookup
@Stability(Stable) @NotNull public static IDatabaseCluster fromLookup(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull DatabaseClusterLookupOptions options) Lookup an existing DatabaseCluster using clusterIdentifier.- Parameters:
scope- This parameter is required.id- This parameter is required.options- This parameter is required.
-
addRotationMultiUser
@Stability(Stable) @NotNull public SecretRotation addRotationMultiUser(@NotNull String id, @NotNull RotationMultiUserOptions options) Adds the multi user rotation to this cluster.- 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 cluster.- Parameters:
options-
-
addRotationSingleUser
Adds the single user rotation of the master password to this cluster. -
metricACUUtilization
This value is represented as a percentage.It's calculated as the value of the ServerlessDatabaseCapacity metric divided by the maximum ACU value of the DB cluster.
If this metric approaches a value of 100.0, the DB instance has scaled up as high as it can. Consider increasing the maximum ACU setting for the cluster.
- Parameters:
props-
-
metricACUUtilization
This value is represented as a percentage.It's calculated as the value of the ServerlessDatabaseCapacity metric divided by the maximum ACU value of the DB cluster.
If this metric approaches a value of 100.0, the DB instance has scaled up as high as it can. Consider increasing the maximum ACU setting for the cluster.
-
metricServerlessDatabaseCapacity
@Stability(Stable) @NotNull public Metric metricServerlessDatabaseCapacity(@Nullable MetricOptions props) As a cluster-level metric, it represents the average of the ServerlessDatabaseCapacity values of all the Aurora Serverless v2 DB instances in the cluster.- Parameters:
props-
-
metricServerlessDatabaseCapacity
As a cluster-level metric, it represents the average of the ServerlessDatabaseCapacity values of all the Aurora Serverless v2 DB instances in the cluster. -
getCloudwatchLogGroups
The log group is created whencloudwatchLogsExportsis set.Each export value will create a separate log group.
-
getClusterEndpoint
The endpoint to use for read/write operations.- Specified by:
getClusterEndpointin interfaceIDatabaseCluster- Specified by:
getClusterEndpointin classDatabaseClusterBase
-
getClusterIdentifier
Identifier of the cluster.- Specified by:
getClusterIdentifierin interfaceIDatabaseCluster- Specified by:
getClusterIdentifierin classDatabaseClusterBase
-
getClusterReadEndpoint
Endpoint to use for load-balanced read-only operations.- Specified by:
getClusterReadEndpointin interfaceIDatabaseCluster- Specified by:
getClusterReadEndpointin classDatabaseClusterBase
-
getClusterResourceIdentifier
The immutable identifier for the cluster; for example: cluster-ABCD1234EFGH5678IJKL90MNOP.This AWS Region-unique identifier is used in things like IAM authentication policies.
- Specified by:
getClusterResourceIdentifierin interfaceIDatabaseCluster- Specified by:
getClusterResourceIdentifierin classDatabaseClusterBase
-
getConnections
Access to the network connections.- Specified by:
getConnectionsin interfaceIConnectable- Specified by:
getConnectionsin classDatabaseClusterBase
-
getInstanceEndpoints
Endpoints which address each individual replica.- Specified by:
getInstanceEndpointsin interfaceIDatabaseCluster- Specified by:
getInstanceEndpointsin classDatabaseClusterBase
-
getInstanceIdentifiers
Identifiers of the replicas.- Specified by:
getInstanceIdentifiersin interfaceIDatabaseCluster- Specified by:
getInstanceIdentifiersin classDatabaseClusterBase
-
getMultiUserRotationApplication
Application for multi user rotation to this cluster. -
getNewCfnProps
-
getPerformanceInsightsEnabled
Whether Performance Insights is enabled at cluster level. -
getSecurityGroups
-
getServerlessV2MaxCapacity
-
getServerlessV2MinCapacity
-
getSingleUserRotationApplication
Application for single user rotation of the master password to this cluster. -
getSubnetGroup
-
getVpc
The VPC network to place the cluster in. -
getDatabaseInsightsMode
The database insights mode. -
getEngine
The engine for this Cluster.Never undefined.
- Specified by:
getEnginein interfaceIDatabaseCluster- Specified by:
getEnginein classDatabaseClusterBase
-
getMonitoringRole
The IAM role for the enhanced monitoring. -
getPerformanceInsightEncryptionKey
The AWS KMS key for encryption of Performance Insights data. -
getPerformanceInsightRetention
The amount of time, in days, to retain Performance Insights data. -
getSecret
The secret attached to this cluster.- Specified by:
getSecretin classDatabaseClusterBase
-
getServerlessV2AutoPauseDuration
-
getVpcSubnets
The cluster's subnets. -
getEnableDataApi
- Specified by:
getEnableDataApiin classDatabaseClusterBase
-
setEnableDataApi
- Specified by:
setEnableDataApiin classDatabaseClusterBase
-
getHasServerlessInstance
-
setHasServerlessInstance
-