Class DatabaseCluster
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.docdb.DatabaseCluster
- All Implemented Interfaces:
IEnvironmentAware,IResource,IDatabaseCluster,IConnectable,ISecretAttachmentTarget,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.118.0 (build 02eec31)",
date="2025-11-04T09:27:38.477Z")
@Stability(Stable)
public class DatabaseCluster
extends Resource
implements IDatabaseCluster
Create a clustered database with a given number of instances.
Example:
Vpc vpc;
DatabaseCluster cluster = DatabaseCluster.Builder.create(this, "Database")
.masterUser(Login.builder()
.username("myuser")
.build())
.instanceType(InstanceType.of(InstanceClass.MEMORY5, InstanceSize.LARGE))
.vpcSubnets(SubnetSelection.builder()
.subnetType(SubnetType.PUBLIC)
.build())
.vpc(vpc)
.deletionProtection(true)
.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.docdb.IDatabaseCluster
IDatabaseCluster.Jsii$Default, IDatabaseCluster.Jsii$ProxyNested 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.addRotationSingleUser(Duration automaticallyAfter) Adds the single user rotation of the master password to this cluster.voidaddSecurityGroups(ISecurityGroup... securityGroups) Adds security groups to this cluster.Renders the secret attachment target specifications.static IDatabaseClusterfromDatabaseClusterAttributes(software.constructs.Construct scope, String id, DatabaseClusterAttributes attrs) Import an existing DatabaseCluster from properties.The endpoint to use for read/write operations.Identifier of the cluster.Endpoint to use for load-balanced read-only operations.The resource id for the cluster;The connections object to implement IConnectable.Endpoints which address each individual replica.Identifiers of the replicas.The secret attached to this cluster.Security group identifier of this database.Methods 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
-
DEFAULT_NUM_INSTANCES
The default number of instances in the DocDB cluster if none are specified. -
DEFAULT_PORT
The default port Document DB listens on. -
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.
-
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 Duration automaticallyAfter) Adds the single user rotation of the master password to this cluster.- Parameters:
automaticallyAfter- Specifies the number of days after the previous rotation before Secrets Manager triggers the next automatic rotation.
-
addRotationSingleUser
Adds the single user rotation of the master password to this cluster. -
addSecurityGroups
Adds security groups to this cluster.- Parameters:
securityGroups- The security groups to add. This parameter is required.
-
asSecretAttachmentTarget
Renders the secret attachment target specifications.- Specified by:
asSecretAttachmentTargetin interfaceISecretAttachmentTarget
-
getClusterEndpoint
The endpoint to use for read/write operations.- Specified by:
getClusterEndpointin interfaceIDatabaseCluster
-
getClusterIdentifier
Identifier of the cluster.- Specified by:
getClusterIdentifierin interfaceIDatabaseCluster
-
getClusterReadEndpoint
Endpoint to use for load-balanced read-only operations.- Specified by:
getClusterReadEndpointin interfaceIDatabaseCluster
-
getClusterResourceIdentifier
The resource id for the cluster;for example: cluster-ABCD1234EFGH5678IJKL90MNOP. The cluster ID uniquely identifies the cluster and is used in things like IAM authentication policies.
-
getConnections
The connections object to implement IConnectable.- Specified by:
getConnectionsin interfaceIConnectable
-
getInstanceEndpoints
Endpoints which address each individual replica.- Specified by:
getInstanceEndpointsin interfaceIDatabaseCluster
-
getInstanceIdentifiers
Identifiers of the replicas.- Specified by:
getInstanceIdentifiersin interfaceIDatabaseCluster
-
getSecurityGroupId
Security group identifier of this database.- Specified by:
getSecurityGroupIdin interfaceIDatabaseCluster
-
getSecret
The secret attached to this cluster.
-