Skip to content

create_cluster

create_cluster(
    cluster_name: str,
    auth_type: Auth,
    admin_user_name: str,
    admin_user_password: Password,
    shard_capacity: int,
    shard_count: int,
    *,
    config_overrides: Optional[DocDBElasticClientConfig] = None,
    vpc_security_group_ids: Optional[StringList] = None,
    subnet_ids: Optional[StringList] = None,
    kms_key_id: Optional[str] = None,
    client_token: Optional[str] = None,
    preferred_maintenance_window: Optional[str] = None,
    tags: Optional[TagMap] = None,
    backup_retention_period: Optional[int] = None,
    preferred_backup_window: Optional[str] = None,
    shard_instance_count: Optional[int] = None,
) -> CreateClusterOutput

Creates a new Amazon DocumentDB elastic cluster and returns its cluster structure.

Parameters:

  • cluster_name (str) –

    The name of the new elastic cluster. 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.

    Example: my-cluster

  • auth_type (Auth) –

    The authentication type used to determine where to fetch the password used for accessing the elastic cluster. Valid types are PLAIN_TEXT or SECRET_ARN.

  • admin_user_name (str) –

    The name of the Amazon DocumentDB elastic clusters administrator.

    Constraints:

    • Must be from 1 to 63 letters or numbers.

    • The first character must be a letter.

    • Cannot be a reserved word.

  • admin_user_password (Password) –

    The password for the Amazon DocumentDB elastic clusters administrator. The password can contain any printable ASCII characters.

    Constraints:

    • Must contain from 8 to 100 characters.

    • Cannot contain a forward slash (/), double quote ("), or the "at" symbol (@).

  • shard_capacity (int) –

    The number of vCPUs assigned to each elastic cluster shard. Maximum is 64. Allowed values are 2, 4, 8, 16, 32, 64.

  • shard_count (int) –

    The number of shards assigned to the elastic cluster. Maximum is 32.

  • vpc_security_group_ids (Optional[StringList], default: None ) –

    A list of EC2 VPC security groups to associate with the new elastic cluster.

  • subnet_ids (Optional[StringList], default: None ) –

    The Amazon EC2 subnet IDs for the new elastic cluster.

  • kms_key_id (Optional[str], default: None ) –

    The KMS key identifier to use to encrypt the new elastic 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 account that owns this KMS encryption key, you can use the KMS key alias instead of the ARN as the KMS encryption key.

    If an encryption key is not specified, Amazon DocumentDB uses the default encryption key that KMS creates for your account. Your account has a different default encryption key for each Amazon Region.

  • client_token (Optional[str], default: None ) –

    The client token for the elastic cluster.

  • preferred_maintenance_window (Optional[str], default: None ) –

    The weekly time range during which system maintenance can occur, in Universal Coordinated Time (UTC).

    Format: ddd:hh24:mi-ddd:hh24:mi

    Default: 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.

  • tags (Optional[TagMap], default: None ) –

    The tags to be assigned to the new elastic cluster.

  • backup_retention_period (Optional[int], default: None ) –

    The number of days for which automatic snapshots are retained.

  • preferred_backup_window (Optional[str], default: None ) –

    The daily time range during which automated backups are created if automated backups are enabled, as determined by the backupRetentionPeriod.

  • shard_instance_count (Optional[int], default: None ) –

    The number of replica instances applying to all shards in the elastic cluster. A shardInstanceCount value of 1 means there is one writer instance, and any additional instances are replicas that can be used for reads and to improve availability.

Raises:

Source code in docs_src/capo_docdb_elastic/_services/doc_db_elastic.py
def create_cluster(
    self,
    cluster_name: str,
    auth_type: "capo_docdb_elastic.types.auth.Auth",
    admin_user_name: str,
    admin_user_password: "capo_docdb_elastic.types.password.Password",
    shard_capacity: int,
    shard_count: int,
    *,
    config_overrides: Optional[DocDBElasticClientConfig] = None,
    vpc_security_group_ids: Optional[
        "capo_docdb_elastic.types.string_list.StringList"
    ] = None,
    subnet_ids: Optional["capo_docdb_elastic.types.string_list.StringList"] = None,
    kms_key_id: Optional[str] = None,
    client_token: Optional[str] = None,
    preferred_maintenance_window: Optional[str] = None,
    tags: Optional["capo_docdb_elastic.types.tag_map.TagMap"] = None,
    backup_retention_period: Optional[int] = None,
    preferred_backup_window: Optional[str] = None,
    shard_instance_count: Optional[int] = None,
) -> "capo_docdb_elastic.types.create_cluster_output.CreateClusterOutput":
    """<p>Creates a new Amazon DocumentDB elastic cluster and returns its cluster structure.</p>

    Args:
        cluster_name: <p>The name of the new elastic cluster. This parameter is stored as a lowercase string.</p> <p> <i>Constraints</i>:</p> <ul> <li> <p>Must contain from 1 to 63 letters, numbers, or hyphens.</p> </li> <li> <p>The first character must be a letter.</p> </li> <li> <p>Cannot end with a hyphen or contain two consecutive hyphens.</p> </li> </ul> <p> <i>Example</i>: <code>my-cluster</code> </p>
        auth_type: <p>The authentication type used to determine where to fetch the password used for accessing the elastic cluster. Valid types are <code>PLAIN_TEXT</code> or <code>SECRET_ARN</code>.</p>
        admin_user_name: <p>The name of the Amazon DocumentDB elastic clusters administrator.</p> <p> <i>Constraints</i>:</p> <ul> <li> <p>Must be from 1 to 63 letters or numbers.</p> </li> <li> <p>The first character must be a letter.</p> </li> <li> <p>Cannot be a reserved word.</p> </li> </ul>
        admin_user_password: <p>The password for the Amazon DocumentDB elastic clusters administrator. The password can contain any printable ASCII characters.</p> <p> <i>Constraints</i>:</p> <ul> <li> <p>Must contain from 8 to 100 characters.</p> </li> <li> <p>Cannot contain a forward slash (/), double quote ("), or the "at" symbol (@).</p> </li> </ul>
        shard_capacity: <p>The number of vCPUs assigned to each elastic cluster shard. Maximum is 64. Allowed values are 2, 4, 8, 16, 32, 64.</p>
        shard_count: <p>The number of shards assigned to the elastic cluster. Maximum is 32.</p>
        vpc_security_group_ids: <p>A list of EC2 VPC security groups to associate with the new elastic cluster.</p>
        subnet_ids: <p>The Amazon EC2 subnet IDs for the new elastic cluster.</p>
        kms_key_id: <p>The KMS key identifier to use to encrypt the new elastic cluster.</p> <p>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 account that owns this KMS encryption key, you can use the KMS key alias instead of the ARN as the KMS encryption key.</p> <p>If an encryption key is not specified, Amazon DocumentDB uses the default encryption key that KMS creates for your account. Your account has a different default encryption key for each Amazon Region.</p>
        client_token: <p>The client token for the elastic cluster.</p>
        preferred_maintenance_window: <p>The weekly time range during which system maintenance can occur, in Universal Coordinated Time (UTC).</p> <p> <i>Format</i>: <code>ddd:hh24:mi-ddd:hh24:mi</code> </p> <p> <i>Default</i>: 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.</p> <p> <i>Valid days</i>: Mon, Tue, Wed, Thu, Fri, Sat, Sun</p> <p> <i>Constraints</i>: Minimum 30-minute window.</p>
        tags: <p>The tags to be assigned to the new elastic cluster.</p>
        backup_retention_period: <p>The number of days for which automatic snapshots are retained.</p>
        preferred_backup_window: <p>The daily time range during which automated backups are created if automated backups are enabled, as determined by the <code>backupRetentionPeriod</code>.</p>
        shard_instance_count: <p>The number of replica instances applying to all shards in the elastic cluster. A <code>shardInstanceCount</code> value of 1 means there is one writer instance, and any additional instances are replicas that can be used for reads and to improve availability.</p>

    Raises:
        capo_docdb_elastic.errors.access_denied_exception.AccessDeniedException: <p>An exception that occurs when there are not sufficient permissions to perform an action.</p>
        capo_docdb_elastic.errors.conflict_exception.ConflictException: <p>There was an access conflict.</p>
        capo_docdb_elastic.errors.internal_server_exception.InternalServerException: <p>There was an internal server error.</p>
        capo_docdb_elastic.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The service quota for the action was exceeded.</p>
        capo_docdb_elastic.errors.throttling_exception.ThrottlingException: <p>ThrottlingException will be thrown when request was denied due to request throttling.</p>
        capo_docdb_elastic.errors.validation_exception.ValidationException: <p>A structure defining a validation exception.</p>
        capo_docdb_elastic.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_docdb_elastic.types.create_cluster_input.CreateClusterInput]",
    ) -> OperationResponse[
        "capo_docdb_elastic.types.create_cluster_output.CreateClusterOutput"
    ]:
        import capo_docdb_elastic._operations.chimera_db_lionfish_service_lambda.create_cluster

        output, http_response = (
            capo_docdb_elastic._operations.chimera_db_lionfish_service_lambda.create_cluster.create_cluster(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_docdb_elastic.types.create_cluster_input.CreateClusterInput",
    ) -> dict[str, Any]:
        import capo_docdb_elastic.types.create_cluster_input

        return capo_docdb_elastic.types.create_cluster_input.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateCluster", redact_input=_redact_input),
    )
    input_: capo_docdb_elastic.types.create_cluster_input.CreateClusterInput = {
        "cluster_name": cluster_name,
        "auth_type": auth_type,
        "admin_user_name": admin_user_name,
        "admin_user_password": admin_user_password,
        "shard_capacity": shard_capacity,
        "shard_count": shard_count,
    }
    if vpc_security_group_ids is not None:
        input_["vpc_security_group_ids"] = vpc_security_group_ids
    if subnet_ids is not None:
        input_["subnet_ids"] = subnet_ids
    if kms_key_id is not None:
        input_["kms_key_id"] = kms_key_id
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if preferred_maintenance_window is not None:
        input_["preferred_maintenance_window"] = preferred_maintenance_window
    if tags is not None:
        input_["tags"] = tags
    if backup_retention_period is not None:
        input_["backup_retention_period"] = backup_retention_period
    if preferred_backup_window is not None:
        input_["preferred_backup_window"] = preferred_backup_window
    if shard_instance_count is not None:
        input_["shard_instance_count"] = shard_instance_count

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output