@Generated(value="jsii-pacmak/1.47.0 (build 86d2c33)", date="2021-12-22T10:27:16.833Z") @Stability(value=Stable) public class DatabaseCluster extends Resource implements IDatabaseCluster
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.docdb.*;
import software.amazon.awscdk.services.ec2.*;
import software.amazon.awscdk.services.kms.*;
ClusterParameterGroup clusterParameterGroup;
InstanceType instanceType;
Key key;
SecretValue secretValue;
SecurityGroup securityGroup;
Subnet subnet;
SubnetFilter subnetFilter;
Vpc vpc;
DatabaseCluster databaseCluster = DatabaseCluster.Builder.create(this, "MyDatabaseCluster")
.instanceType(instanceType)
.masterUser(Login.builder()
.username("username")
// the properties below are optional
.excludeCharacters("excludeCharacters")
.kmsKey(key)
.password(secretValue)
.secretName("secretName")
.build())
.vpc(vpc)
// the properties below are optional
.backup(BackupProps.builder()
.retention(Duration.minutes(30))
// the properties below are optional
.preferredWindow("preferredWindow")
.build())
.dbClusterName("dbClusterName")
.deletionProtection(false)
.engineVersion("engineVersion")
.exportAuditLogsToCloudWatch(false)
.exportProfilerLogsToCloudWatch(false)
.instanceIdentifierBase("instanceIdentifierBase")
.instances(123)
.kmsKey(key)
.parameterGroup(clusterParameterGroup)
.port(123)
.preferredMaintenanceWindow("preferredMaintenanceWindow")
.removalPolicy(RemovalPolicy.DESTROY)
.securityGroup(securityGroup)
.storageEncrypted(false)
.vpcSubnets(SubnetSelection.builder()
.availabilityZones(List.of("availabilityZones"))
.onePerAz(false)
.subnetFilters(List.of(subnetFilter))
.subnetGroupName("subnetGroupName")
.subnets(List.of(subnet))
.subnetType(SubnetType.PRIVATE_ISOLATED)
.build())
.build();
| Modifier and Type | Class and Description |
|---|---|
static class |
DatabaseCluster.Builder
A fluent builder for
DatabaseCluster. |
software.amazon.jsii.JsiiObject.InitializationModeIDatabaseCluster.Jsii$Default, IDatabaseCluster.Jsii$Proxy| Modifier and Type | Field and Description |
|---|---|
static Number |
DEFAULT_NUM_INSTANCES
The default number of instances in the DocDB cluster if none are specified.
|
static Number |
DEFAULT_PORT
The default port Document DB listens on.
|
| Modifier | Constructor and Description |
|---|---|
|
DatabaseCluster(software.constructs.Construct scope,
String id,
DatabaseClusterProps props) |
protected |
DatabaseCluster(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
DatabaseCluster(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
SecretRotation |
addRotationMultiUser(String id,
RotationMultiUserOptions options)
Adds the multi user rotation to this cluster.
|
SecretRotation |
addRotationSingleUser()
Adds the single user rotation of the master password to this cluster.
|
SecretRotation |
addRotationSingleUser(Duration automaticallyAfter)
Adds the single user rotation of the master password to this cluster.
|
void |
addSecurityGroups(ISecurityGroup... securityGroups)
Adds security groups to this cluster.
|
SecretAttachmentTargetProps |
asSecretAttachmentTarget()
Renders the secret attachment target specifications.
|
static IDatabaseCluster |
fromDatabaseClusterAttributes(software.constructs.Construct scope,
String id,
DatabaseClusterAttributes attrs)
Import an existing DatabaseCluster from properties.
|
Endpoint |
getClusterEndpoint()
The endpoint to use for read/write operations.
|
String |
getClusterIdentifier()
Identifier of the cluster.
|
Endpoint |
getClusterReadEndpoint()
Endpoint to use for load-balanced read-only operations.
|
String |
getClusterResourceIdentifier()
The resource id for the cluster;
|
Connections |
getConnections()
The connections object to implement IConnectable.
|
List<Endpoint> |
getInstanceEndpoints()
Endpoints which address each individual replica.
|
List<String> |
getInstanceIdentifiers()
Identifiers of the replicas.
|
ISecret |
getSecret()
The secret attached to this cluster.
|
String |
getSecurityGroupId()
Security group identifier of this database.
|
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResourcejsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitapplyRemovalPolicy, getEnv, getStack@Stability(value=Stable) public static final Number DEFAULT_NUM_INSTANCES
@Stability(value=Stable) public static final Number DEFAULT_PORT
protected DatabaseCluster(software.amazon.jsii.JsiiObjectRef objRef)
protected DatabaseCluster(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public DatabaseCluster(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@NotNull
DatabaseClusterProps props)
scope - This parameter is required.id - This parameter is required.props - This parameter is required.@Stability(value=Stable) @NotNull public SecretRotation addRotationMultiUser(@NotNull String id, @NotNull RotationMultiUserOptions options)
id - This parameter is required.options - This parameter is required.@Stability(value=Stable) @NotNull public SecretRotation addRotationSingleUser(@Nullable Duration automaticallyAfter)
automaticallyAfter - Specifies the number of days after the previous rotation before Secrets Manager triggers the next automatic rotation.@Stability(value=Stable) @NotNull public SecretRotation addRotationSingleUser()
@Stability(value=Stable)
public void addSecurityGroups(@NotNull
ISecurityGroup... securityGroups)
securityGroups - The security groups to add. This parameter is required.@Stability(value=Stable) @NotNull public SecretAttachmentTargetProps asSecretAttachmentTarget()
asSecretAttachmentTarget in interface ISecretAttachmentTarget@Stability(value=Stable) @NotNull public static IDatabaseCluster fromDatabaseClusterAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull DatabaseClusterAttributes attrs)
scope - This parameter is required.id - This parameter is required.attrs - This parameter is required.@Stability(value=Stable) @NotNull public Endpoint getClusterEndpoint()
getClusterEndpoint in interface IDatabaseCluster@Stability(value=Stable) @NotNull public String getClusterIdentifier()
getClusterIdentifier in interface IDatabaseCluster@Stability(value=Stable) @NotNull public Endpoint getClusterReadEndpoint()
getClusterReadEndpoint in interface IDatabaseCluster@Stability(value=Stable) @NotNull public String getClusterResourceIdentifier()
for example: cluster-ABCD1234EFGH5678IJKL90MNOP. The cluster ID uniquely identifies the cluster and is used in things like IAM authentication policies.
@Stability(value=Stable) @NotNull public Connections getConnections()
getConnections in interface IConnectable@Stability(value=Stable) @NotNull public List<Endpoint> getInstanceEndpoints()
getInstanceEndpoints in interface IDatabaseCluster@Stability(value=Stable) @NotNull public List<String> getInstanceIdentifiers()
getInstanceIdentifiers in interface IDatabaseCluster@Stability(value=Stable) @Nullable public ISecret getSecret()
@Stability(value=Stable) @NotNull public String getSecurityGroupId()
getSecurityGroupId in interface IDatabaseClusterCopyright © 2021. All rights reserved.