@Generated(value="jsii-pacmak/1.50.0 (build d1830a4)", date="2022-01-04T15:39:05.690Z") @Stability(value=Experimental) 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.core.*;
import software.amazon.awscdk.services.docdb.*;
import software.amazon.awscdk.services.ec2.*;
import software.amazon.awscdk.services.iam.*;
import software.amazon.awscdk.services.kms.*;
import software.amazon.awscdk.services.logs.*;
ClusterParameterGroup clusterParameterGroup;
Duration duration;
InstanceType instanceType;
Key key;
Role role;
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)
// the properties below are optional
.preferredWindow("preferredWindow")
.build())
.cloudWatchLogsRetention(RetentionDays.ONE_DAY)
.cloudWatchLogsRetentionRole(role)
.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")
.subnetName("subnetName")
.subnets(List.of(subnet))
.subnetType(SubnetType.ISOLATED)
.build())
.build();
| Modifier and Type | Class and Description |
|---|---|
static class |
DatabaseCluster.Builder
(experimental) 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
(experimental) The default number of instances in the DocDB cluster if none are specified.
|
static Number |
DEFAULT_PORT
(experimental) 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)
(experimental) Adds the multi user rotation to this cluster.
|
SecretRotation |
addRotationSingleUser()
(experimental) Adds the single user rotation of the master password to this cluster.
|
SecretRotation |
addRotationSingleUser(Duration automaticallyAfter)
(experimental) Adds the single user rotation of the master password to this cluster.
|
void |
addSecurityGroups(ISecurityGroup... securityGroups)
(experimental) Adds security groups to this cluster.
|
SecretAttachmentTargetProps |
asSecretAttachmentTarget()
(experimental) Renders the secret attachment target specifications.
|
static IDatabaseCluster |
fromDatabaseClusterAttributes(software.constructs.Construct scope,
String id,
DatabaseClusterAttributes attrs)
(experimental) Import an existing DatabaseCluster from properties.
|
Endpoint |
getClusterEndpoint()
(experimental) The endpoint to use for read/write operations.
|
String |
getClusterIdentifier()
(experimental) Identifier of the cluster.
|
Endpoint |
getClusterReadEndpoint()
(experimental) Endpoint to use for load-balanced read-only operations.
|
String |
getClusterResourceIdentifier()
(experimental) The resource id for the cluster;
|
Connections |
getConnections()
(experimental) The connections object to implement IConnectable.
|
List<Endpoint> |
getInstanceEndpoints()
(experimental) Endpoints which address each individual replica.
|
List<String> |
getInstanceIdentifiers()
(experimental) Identifiers of the replicas.
|
ISecret |
getSecret()
(experimental) The secret attached to this cluster.
|
String |
getSecurityGroupId()
(experimental) Security group identifier of this database.
|
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResourcegetNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validatejsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitapplyRemovalPolicy, getEnv, getStackgetNode@Stability(value=Experimental) public static final Number DEFAULT_NUM_INSTANCES
@Stability(value=Experimental) public static final Number DEFAULT_PORT
protected DatabaseCluster(software.amazon.jsii.JsiiObjectRef objRef)
protected DatabaseCluster(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Experimental)
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=Experimental) @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=Experimental) @NotNull public SecretRotation addRotationMultiUser(@NotNull String id, @NotNull RotationMultiUserOptions options)
id - This parameter is required.options - This parameter is required.@Stability(value=Experimental) @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=Experimental) @NotNull public SecretRotation addRotationSingleUser()
@Stability(value=Experimental)
public void addSecurityGroups(@NotNull
ISecurityGroup... securityGroups)
securityGroups - The security groups to add. This parameter is required.@Stability(value=Experimental) @NotNull public SecretAttachmentTargetProps asSecretAttachmentTarget()
asSecretAttachmentTarget in interface ISecretAttachmentTarget@Stability(value=Experimental) @NotNull public Endpoint getClusterEndpoint()
getClusterEndpoint in interface IDatabaseCluster@Stability(value=Experimental) @NotNull public String getClusterIdentifier()
getClusterIdentifier in interface IDatabaseCluster@Stability(value=Experimental) @NotNull public Endpoint getClusterReadEndpoint()
getClusterReadEndpoint in interface IDatabaseCluster@Stability(value=Experimental) @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=Experimental) @NotNull public Connections getConnections()
getConnections in interface IConnectable@Stability(value=Experimental) @NotNull public List<Endpoint> getInstanceEndpoints()
getInstanceEndpoints in interface IDatabaseCluster@Stability(value=Experimental) @NotNull public List<String> getInstanceIdentifiers()
getInstanceIdentifiers in interface IDatabaseCluster@Stability(value=Experimental) @NotNull public String getSecurityGroupId()
getSecurityGroupId in interface IDatabaseCluster@Stability(value=Experimental) @Nullable public ISecret getSecret()
Copyright © 2022. All rights reserved.