createDBCluster method
- required String dBClusterIdentifier,
- required String engine,
- List<
String> ? availabilityZones, - int? backupRetentionPeriod,
- String? dBClusterParameterGroupName,
- String? dBSubnetGroupName,
- bool? deletionProtection,
- List<
String> ? enableCloudwatchLogsExports, - String? engineVersion,
- String? globalClusterIdentifier,
- String? kmsKeyId,
- bool? manageMasterUserPassword,
- String? masterUserPassword,
- String? masterUserSecretKmsKeyId,
- String? masterUsername,
- String? networkType,
- int? port,
- String? preSignedUrl,
- String? preferredBackupWindow,
- String? preferredMaintenanceWindow,
- ServerlessV2ScalingConfiguration? serverlessV2ScalingConfiguration,
- bool? storageEncrypted,
- String? storageType,
- List<
Tag> ? tags, - List<
String> ? vpcSecurityGroupIds,
Creates a new Amazon DocumentDB cluster.
May throw DBClusterAlreadyExistsFault.
May throw DBClusterNotFoundFault.
May throw DBClusterParameterGroupNotFoundFault.
May throw DBClusterQuotaExceededFault.
May throw DBInstanceNotFoundFault.
May throw DBSubnetGroupDoesNotCoverEnoughAZs.
May throw DBSubnetGroupNotFoundFault.
May throw GlobalClusterNotFoundFault.
May throw InsufficientStorageClusterCapacityFault.
May throw InvalidDBClusterStateFault.
May throw InvalidDBInstanceStateFault.
May throw InvalidDBSubnetGroupStateFault.
May throw InvalidGlobalClusterStateFault.
May throw InvalidSubnet.
May throw InvalidVPCNetworkStateFault.
May throw KMSKeyNotAccessibleFault.
May throw NetworkTypeNotSupported.
May throw StorageQuotaExceededFault.
Parameter dBClusterIdentifier :
The cluster identifier. This parameter is stored as a lowercase string.
Constraints:
- Must contain from 1 to 63 letters, numbers, or hyphens.
- The first character must be a letter.
- Cannot end with a hyphen or contain two consecutive hyphens.
my-cluster
Parameter engine :
The name of the database engine to be used for this cluster.
Valid values: docdb
Parameter availabilityZones :
A list of Amazon EC2 Availability Zones that instances in the cluster can
be created in.
Parameter backupRetentionPeriod :
The number of days for which automated backups are retained. You must
specify a minimum value of 1.
Default: 1
Constraints:
- Must be a value from 1 to 35.
Parameter dBClusterParameterGroupName :
The name of the cluster parameter group to associate with this cluster.
Parameter dBSubnetGroupName :
A subnet group to associate with this cluster.
Constraints: Must match the name of an existing
DBSubnetGroup. Must not be default.
Example: mySubnetgroup
Parameter deletionProtection :
Specifies whether this cluster can be deleted. If
DeletionProtection is enabled, the cluster cannot be deleted
unless it is modified and DeletionProtection is disabled.
DeletionProtection protects clusters from being accidentally
deleted.
Parameter enableCloudwatchLogsExports :
A list of log types that need to be enabled for exporting to Amazon
CloudWatch Logs. You can enable audit logs or profiler logs. For more
information, see
Auditing Amazon DocumentDB Events and
Profiling Amazon DocumentDB Operations.
Parameter engineVersion :
The version number of the database engine to use. The
--engine-version will default to the latest major engine
version. For production workloads, we recommend explicitly declaring this
parameter with the intended major engine version.
Parameter globalClusterIdentifier :
The cluster identifier of the new global cluster.
Parameter kmsKeyId :
The KMS key identifier for an encrypted cluster.
The KMS key identifier is the Amazon Resource Name (ARN) for the KMS encryption key. If you are creating a cluster using the same Amazon Web Services account that owns the KMS encryption key that is used to encrypt the new cluster, you can use the KMS key alias instead of the ARN for the KMS encryption key.
If an encryption key is not specified in KmsKeyId:
-
If the
StorageEncryptedparameter istrue, Amazon DocumentDB uses your default encryption key.
Parameter manageMasterUserPassword :
Specifies whether to manage the master user password with Amazon Web
Services Secrets Manager.
Constraint: You can't manage the master user password with Amazon Web
Services Secrets Manager if MasterUserPassword is specified.
Parameter masterUserPassword :
The password for the master database user. This password can contain any
printable ASCII character except forward slash (/), double quote ("), or
the "at" symbol (@).
Constraints: Must contain from 8 to 100 characters.
Parameter masterUserSecretKmsKeyId :
The Amazon Web Services KMS key identifier to encrypt a secret that is
automatically generated and managed in Amazon Web Services Secrets
Manager. This setting is valid only if the master user password is managed
by Amazon DocumentDB in Amazon Web Services Secrets Manager for the DB
cluster.
The Amazon Web Services KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key. To use a KMS key in a different Amazon Web Services account, specify the key ARN or alias ARN.
If you don't specify MasterUserSecretKmsKeyId, then the
aws/secretsmanager KMS key is used to encrypt the secret. If
the secret is in a different Amazon Web Services account, then you can't
use the aws/secretsmanager KMS key to encrypt the secret, and
you must use a customer managed KMS key.
There is a default KMS key for your Amazon Web Services account. Your Amazon Web Services account has a different default KMS key for each Amazon Web Services Region.
Parameter masterUsername :
The name of the master user for the cluster.
Constraints:
- Must be from 1 to 63 letters or numbers.
- The first character must be a letter.
- Cannot be a reserved word for the chosen database engine.
Parameter networkType :
The network type of the cluster.
The network type is determined by the DBSubnetGroup specified
for the cluster. A DBSubnetGroup can support only the IPv4
protocol or the IPv4 and the IPv6 protocols (DUAL).
For more information, see DocumentDB clusters in a VPC in the Amazon DocumentDB Developer Guide.
Valid Values: IPV4 | DUAL
Parameter port :
The port number on which the instances in the cluster accept connections.
Parameter preSignedUrl :
Not currently supported.
Parameter preferredBackupWindow :
The daily time range during which automated backups are created if
automated backups are enabled using the BackupRetentionPeriod
parameter.
The default is a 30-minute window selected at random from an 8-hour block of time for each Amazon Web Services Region.
Constraints:
-
Must be in the format
hh24:mi-hh24:mi. - Must be in Universal Coordinated Time (UTC).
- Must not conflict with the preferred maintenance window.
- Must be at least 30 minutes.
Parameter preferredMaintenanceWindow :
The weekly time range during which system maintenance can occur, in
Universal Coordinated Time (UTC).
Format: ddd:hh24:mi-ddd:hh24:mi
The default is a 30-minute window selected at random from an 8-hour block of time for each Amazon Web Services Region, occurring on a random day of the week.
Valid days: Mon, Tue, Wed, Thu, Fri, Sat, Sun
Constraints: Minimum 30-minute window.
Parameter serverlessV2ScalingConfiguration :
Contains the scaling configuration of an Amazon DocumentDB Serverless
cluster.
Parameter storageEncrypted :
Specifies whether the cluster is encrypted.
Parameter storageType :
The storage type to associate with the DB cluster.
For information on storage types for Amazon DocumentDB clusters, see Cluster storage configurations in the Amazon DocumentDB Developer Guide.
Valid values for storage type - standard | iopt1
Default value is standard
Parameter tags :
The tags to be assigned to the cluster.
Parameter vpcSecurityGroupIds :
A list of EC2 VPC security groups to associate with this cluster.
Implementation
Future<CreateDBClusterResult> createDBCluster({
required String dBClusterIdentifier,
required String engine,
List<String>? availabilityZones,
int? backupRetentionPeriod,
String? dBClusterParameterGroupName,
String? dBSubnetGroupName,
bool? deletionProtection,
List<String>? enableCloudwatchLogsExports,
String? engineVersion,
String? globalClusterIdentifier,
String? kmsKeyId,
bool? manageMasterUserPassword,
String? masterUserPassword,
String? masterUserSecretKmsKeyId,
String? masterUsername,
String? networkType,
int? port,
String? preSignedUrl,
String? preferredBackupWindow,
String? preferredMaintenanceWindow,
ServerlessV2ScalingConfiguration? serverlessV2ScalingConfiguration,
bool? storageEncrypted,
String? storageType,
List<Tag>? tags,
List<String>? vpcSecurityGroupIds,
}) async {
final $request = <String, String>{
'DBClusterIdentifier': dBClusterIdentifier,
'Engine': engine,
if (availabilityZones != null)
if (availabilityZones.isEmpty)
'AvailabilityZones': ''
else
for (var i1 = 0; i1 < availabilityZones.length; i1++)
'AvailabilityZones.AvailabilityZone.${i1 + 1}':
availabilityZones[i1],
if (backupRetentionPeriod != null)
'BackupRetentionPeriod': backupRetentionPeriod.toString(),
if (dBClusterParameterGroupName != null)
'DBClusterParameterGroupName': dBClusterParameterGroupName,
if (dBSubnetGroupName != null) 'DBSubnetGroupName': dBSubnetGroupName,
if (deletionProtection != null)
'DeletionProtection': deletionProtection.toString(),
if (enableCloudwatchLogsExports != null)
if (enableCloudwatchLogsExports.isEmpty)
'EnableCloudwatchLogsExports': ''
else
for (var i1 = 0; i1 < enableCloudwatchLogsExports.length; i1++)
'EnableCloudwatchLogsExports.member.${i1 + 1}':
enableCloudwatchLogsExports[i1],
if (engineVersion != null) 'EngineVersion': engineVersion,
if (globalClusterIdentifier != null)
'GlobalClusterIdentifier': globalClusterIdentifier,
if (kmsKeyId != null) 'KmsKeyId': kmsKeyId,
if (manageMasterUserPassword != null)
'ManageMasterUserPassword': manageMasterUserPassword.toString(),
if (masterUserPassword != null) 'MasterUserPassword': masterUserPassword,
if (masterUserSecretKmsKeyId != null)
'MasterUserSecretKmsKeyId': masterUserSecretKmsKeyId,
if (masterUsername != null) 'MasterUsername': masterUsername,
if (networkType != null) 'NetworkType': networkType,
if (port != null) 'Port': port.toString(),
if (preSignedUrl != null) 'PreSignedUrl': preSignedUrl,
if (preferredBackupWindow != null)
'PreferredBackupWindow': preferredBackupWindow,
if (preferredMaintenanceWindow != null)
'PreferredMaintenanceWindow': preferredMaintenanceWindow,
if (serverlessV2ScalingConfiguration != null)
for (var e1 in serverlessV2ScalingConfiguration.toQueryMap().entries)
'ServerlessV2ScalingConfiguration.${e1.key}': e1.value,
if (storageEncrypted != null)
'StorageEncrypted': storageEncrypted.toString(),
if (storageType != null) 'StorageType': storageType,
if (tags != null)
if (tags.isEmpty)
'Tags': ''
else
for (var i1 = 0; i1 < tags.length; i1++)
for (var e3 in tags[i1].toQueryMap().entries)
'Tags.Tag.${i1 + 1}.${e3.key}': e3.value,
if (vpcSecurityGroupIds != null)
if (vpcSecurityGroupIds.isEmpty)
'VpcSecurityGroupIds': ''
else
for (var i1 = 0; i1 < vpcSecurityGroupIds.length; i1++)
'VpcSecurityGroupIds.VpcSecurityGroupId.${i1 + 1}':
vpcSecurityGroupIds[i1],
};
final $result = await _protocol.send(
$request,
action: 'CreateDBCluster',
version: '2014-10-31',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
resultWrapper: 'CreateDBClusterResult',
);
return CreateDBClusterResult.fromXml($result);
}