Skip to content

create_cluster async

create_cluster(
    cluster_name: String,
    node_type: String,
    acl_name: ACLName,
    *,
    config_overrides: Optional[AsyncMemoryDBClientConfig] = None,
    multi_region_cluster_name: Optional[String] = None,
    parameter_group_name: Optional[String] = None,
    description: Optional[String] = None,
    num_shards: Optional[IntegerOptional] = None,
    num_replicas_per_shard: Optional[IntegerOptional] = None,
    subnet_group_name: Optional[String] = None,
    security_group_ids: Optional[SecurityGroupIdsList] = None,
    maintenance_window: Optional[String] = None,
    port: Optional[IntegerOptional] = None,
    sns_topic_arn: Optional[String] = None,
    tls_enabled: Optional[BooleanOptional] = None,
    kms_key_id: Optional[String] = None,
    snapshot_arns: Optional[SnapshotArnsList] = None,
    snapshot_name: Optional[String] = None,
    snapshot_retention_limit: Optional[IntegerOptional] = None,
    tags: Optional[TagList] = None,
    snapshot_window: Optional[String] = None,
    engine: Optional[String] = None,
    engine_version: Optional[String] = None,
    auto_minor_version_upgrade: Optional[BooleanOptional] = None,
    data_tiering: Optional[BooleanOptional] = None,
    network_type: Optional[NetworkType] = None,
    ip_discovery: Optional[IpDiscovery] = None,
) -> CreateClusterResponse

Creates a cluster. All nodes in the cluster run the same protocol-compliant engine software.

Parameters:

  • cluster_name (String) –

    The name of the cluster. This value must be unique as it also serves as the cluster identifier.

  • node_type (String) –

    The compute and memory capacity of the nodes in the cluster.

  • multi_region_cluster_name (Optional[String], default: None ) –

    The name of the multi-Region cluster to be created.

  • parameter_group_name (Optional[String], default: None ) –

    The name of the parameter group associated with the cluster.

  • description (Optional[String], default: None ) –

    An optional description of the cluster.

  • num_shards (Optional[IntegerOptional], default: None ) –

    The number of shards the cluster will contain. The default value is 1.

  • num_replicas_per_shard (Optional[IntegerOptional], default: None ) –

    The number of replicas to apply to each shard. The default value is 1. The maximum is 5.

  • subnet_group_name (Optional[String], default: None ) –

    The name of the subnet group to be used for the cluster.

  • security_group_ids (Optional[SecurityGroupIdsList], default: None ) –

    A list of security group names to associate with this cluster.

  • maintenance_window (Optional[String], default: None ) –

    Specifies the weekly time range during which maintenance on the cluster is performed. It is specified as a range in the format ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 minute period.

    Valid values for ddd are:

    • sun

    • mon

    • tue

    • wed

    • thu

    • fri

    • sat

    Example: sun:23:00-mon:01:30

  • port (Optional[IntegerOptional], default: None ) –

    The port number on which each of the nodes accepts connections.

  • sns_topic_arn (Optional[String], default: None ) –

    The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (SNS) topic to which notifications are sent.

  • tls_enabled (Optional[BooleanOptional], default: None ) –

    A flag to enable in-transit encryption on the cluster.

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

    The ID of the KMS key used to encrypt the cluster.

  • snapshot_arns (Optional[SnapshotArnsList], default: None ) –

    A list of Amazon Resource Names (ARN) that uniquely identify the RDB snapshot files stored in Amazon S3. The snapshot files are used to populate the new cluster. The Amazon S3 object name in the ARN cannot contain any commas.

  • snapshot_name (Optional[String], default: None ) –

    The name of a snapshot from which to restore data into the new cluster. The snapshot status changes to restoring while the new cluster is being created.

  • snapshot_retention_limit (Optional[IntegerOptional], default: None ) –

    The number of days for which MemoryDB retains automatic snapshots before deleting them. For example, if you set SnapshotRetentionLimit to 5, a snapshot that was taken today is retained for 5 days before being deleted.

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

    A list of tags to be added to this resource. Tags are comma-separated key,value pairs (e.g. Key=myKey, Value=myKeyValue. You can include multiple tags as shown following: Key=myKey, Value=myKeyValue Key=mySecondKey, Value=mySecondKeyValue.

  • snapshot_window (Optional[String], default: None ) –

    The daily time range (in UTC) during which MemoryDB begins taking a daily snapshot of your shard.

    Example: 05:00-09:00

    If you do not specify this parameter, MemoryDB automatically chooses an appropriate time range.

  • acl_name (ACLName) –

    The name of the Access Control List to associate with the cluster.

  • engine (Optional[String], default: None ) –

    The name of the engine to be used for the cluster.

  • engine_version (Optional[String], default: None ) –

    The version number of the Redis OSS engine to be used for the cluster.

  • auto_minor_version_upgrade (Optional[BooleanOptional], default: None ) –

    When set to true, the cluster will automatically receive minor engine version upgrades after launch.

  • data_tiering (Optional[BooleanOptional], default: None ) –

    Enables data tiering. Data tiering is only supported for clusters using the r6gd node type. This parameter must be set when using r6gd nodes. For more information, see Data tiering.

  • network_type (Optional[NetworkType], default: None ) –

    Specifies the IP address type for the cluster. Valid values are 'ipv4', 'ipv6', or 'dual_stack'. When set to 'ipv4', the cluster will only be accessible via IPv4 addresses. When set to 'ipv6', the cluster will only be accessible via IPv6 addresses. When set to 'dual_stack', the cluster will be accessible via both IPv4 and IPv6 addresses. If not specified, the default is 'ipv4'.

  • ip_discovery (Optional[IpDiscovery], default: None ) –

    The mechanism for discovering IP addresses for the cluster discovery protocol. Valid values are 'ipv4' or 'ipv6'. When set to 'ipv4', cluster discovery functions such as cluster slots, cluster shards, and cluster nodes return IPv4 addresses for cluster nodes. When set to 'ipv6', the cluster discovery functions return IPv6 addresses for cluster nodes. The value must be compatible with the NetworkType parameter. If not specified, the default is 'ipv4'.

Raises:

Source code in docs_src/capo_memorydb/_services/async_memory_db.py
async def create_cluster(
    self,
    cluster_name: "capo_memorydb.types.string.String",
    node_type: "capo_memorydb.types.string.String",
    acl_name: "capo_memorydb.types.acl_name.ACLName",
    *,
    config_overrides: Optional[AsyncMemoryDBClientConfig] = None,
    multi_region_cluster_name: Optional["capo_memorydb.types.string.String"] = None,
    parameter_group_name: Optional["capo_memorydb.types.string.String"] = None,
    description: Optional["capo_memorydb.types.string.String"] = None,
    num_shards: Optional[
        "capo_memorydb.types.integer_optional.IntegerOptional"
    ] = None,
    num_replicas_per_shard: Optional[
        "capo_memorydb.types.integer_optional.IntegerOptional"
    ] = None,
    subnet_group_name: Optional["capo_memorydb.types.string.String"] = None,
    security_group_ids: Optional[
        "capo_memorydb.types.security_group_ids_list.SecurityGroupIdsList"
    ] = None,
    maintenance_window: Optional["capo_memorydb.types.string.String"] = None,
    port: Optional["capo_memorydb.types.integer_optional.IntegerOptional"] = None,
    sns_topic_arn: Optional["capo_memorydb.types.string.String"] = None,
    tls_enabled: Optional[
        "capo_memorydb.types.boolean_optional.BooleanOptional"
    ] = None,
    kms_key_id: Optional["capo_memorydb.types.string.String"] = None,
    snapshot_arns: Optional[
        "capo_memorydb.types.snapshot_arns_list.SnapshotArnsList"
    ] = None,
    snapshot_name: Optional["capo_memorydb.types.string.String"] = None,
    snapshot_retention_limit: Optional[
        "capo_memorydb.types.integer_optional.IntegerOptional"
    ] = None,
    tags: Optional["capo_memorydb.types.tag_list.TagList"] = None,
    snapshot_window: Optional["capo_memorydb.types.string.String"] = None,
    engine: Optional["capo_memorydb.types.string.String"] = None,
    engine_version: Optional["capo_memorydb.types.string.String"] = None,
    auto_minor_version_upgrade: Optional[
        "capo_memorydb.types.boolean_optional.BooleanOptional"
    ] = None,
    data_tiering: Optional[
        "capo_memorydb.types.boolean_optional.BooleanOptional"
    ] = None,
    network_type: Optional["capo_memorydb.types.network_type.NetworkType"] = None,
    ip_discovery: Optional["capo_memorydb.types.ip_discovery.IpDiscovery"] = None,
) -> "capo_memorydb.types.create_cluster_response.CreateClusterResponse":
    """<p>Creates a cluster. All nodes in the cluster run the same protocol-compliant engine software.</p>

    Args:
        cluster_name: <p>The name of the cluster. This value must be unique as it also serves as the cluster identifier.</p>
        node_type: <p>The compute and memory capacity of the nodes in the cluster.</p>
        multi_region_cluster_name: <p>The name of the multi-Region cluster to be created.</p>
        parameter_group_name: <p>The name of the parameter group associated with the cluster.</p>
        description: <p>An optional description of the cluster.</p>
        num_shards: <p>The number of shards the cluster will contain. The default value is 1. </p>
        num_replicas_per_shard: <p>The number of replicas to apply to each shard. The default value is 1. The maximum is 5. </p>
        subnet_group_name: <p>The name of the subnet group to be used for the cluster.</p>
        security_group_ids: <p>A list of security group names to associate with this cluster.</p>
        maintenance_window: <p>Specifies the weekly time range during which maintenance on the cluster is performed. It is specified as a range in the format ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 minute period.</p> <p>Valid values for <code>ddd</code> are:</p> <ul> <li> <p> <code>sun</code> </p> </li> <li> <p> <code>mon</code> </p> </li> <li> <p> <code>tue</code> </p> </li> <li> <p> <code>wed</code> </p> </li> <li> <p> <code>thu</code> </p> </li> <li> <p> <code>fri</code> </p> </li> <li> <p> <code>sat</code> </p> </li> </ul> <p>Example: <code>sun:23:00-mon:01:30</code> </p>
        port: <p>The port number on which each of the nodes accepts connections.</p>
        sns_topic_arn: <p>The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (SNS) topic to which notifications are sent.</p>
        tls_enabled: <p>A flag to enable in-transit encryption on the cluster.</p>
        kms_key_id: <p>The ID of the KMS key used to encrypt the cluster.</p>
        snapshot_arns: <p>A list of Amazon Resource Names (ARN) that uniquely identify the RDB snapshot files stored in Amazon S3. The snapshot files are used to populate the new cluster. The Amazon S3 object name in the ARN cannot contain any commas.</p>
        snapshot_name: <p>The name of a snapshot from which to restore data into the new cluster. The snapshot status changes to restoring while the new cluster is being created.</p>
        snapshot_retention_limit: <p>The number of days for which MemoryDB retains automatic snapshots before deleting them. For example, if you set SnapshotRetentionLimit to 5, a snapshot that was taken today is retained for 5 days before being deleted.</p>
        tags: <p>A list of tags to be added to this resource. Tags are comma-separated key,value pairs (e.g. Key=myKey, Value=myKeyValue. You can include multiple tags as shown following: Key=myKey, Value=myKeyValue Key=mySecondKey, Value=mySecondKeyValue.</p>
        snapshot_window: <p>The daily time range (in UTC) during which MemoryDB begins taking a daily snapshot of your shard.</p> <p> Example: 05:00-09:00</p> <p> If you do not specify this parameter, MemoryDB automatically chooses an appropriate time range.</p>
        acl_name: <p>The name of the Access Control List to associate with the cluster.</p>
        engine: <p>The name of the engine to be used for the cluster.</p>
        engine_version: <p>The version number of the Redis OSS engine to be used for the cluster.</p>
        auto_minor_version_upgrade: <p>When set to true, the cluster will automatically receive minor engine version upgrades after launch.</p>
        data_tiering: <p>Enables data tiering. Data tiering is only supported for clusters using the r6gd node type. This parameter must be set when using r6gd nodes. For more information, see <a href="https://docs.aws.amazon.com/memorydb/latest/devguide/data-tiering.html">Data tiering</a>.</p>
        network_type: <p>Specifies the IP address type for the cluster. Valid values are 'ipv4', 'ipv6', or 'dual_stack'. When set to 'ipv4', the cluster will only be accessible via IPv4 addresses. When set to 'ipv6', the cluster will only be accessible via IPv6 addresses. When set to 'dual_stack', the cluster will be accessible via both IPv4 and IPv6 addresses. If not specified, the default is 'ipv4'.</p>
        ip_discovery: <p>The mechanism for discovering IP addresses for the cluster discovery protocol. Valid values are 'ipv4' or 'ipv6'. When set to 'ipv4', cluster discovery functions such as cluster slots, cluster shards, and cluster nodes return IPv4 addresses for cluster nodes. When set to 'ipv6', the cluster discovery functions return IPv6 addresses for cluster nodes. The value must be compatible with the NetworkType parameter. If not specified, the default is 'ipv4'.</p>

    Raises:
        capo_memorydb.errors.acl_not_found_fault.ACLNotFoundFault: <p>The specified ACL does not exist.</p>
        capo_memorydb.errors.cluster_already_exists_fault.ClusterAlreadyExistsFault: <p>A cluster with the specified name already exists.</p>
        capo_memorydb.errors.cluster_quota_for_customer_exceeded_fault.ClusterQuotaForCustomerExceededFault: <p>The request cannot be processed because it would exceed the maximum number of clusters allowed for this customer.</p>
        capo_memorydb.errors.insufficient_cluster_capacity_fault.InsufficientClusterCapacityFault: <p>The cluster does not have sufficient capacity to perform the requested operation.</p>
        capo_memorydb.errors.invalid_acl_state_fault.InvalidACLStateFault: <p>The ACL is not in a valid state for the requested operation.</p>
        capo_memorydb.errors.invalid_credentials_exception.InvalidCredentialsException: <p>The provided credentials are not valid.</p>
        capo_memorydb.errors.invalid_multi_region_cluster_state_fault.InvalidMultiRegionClusterStateFault: <p>The requested operation cannot be performed on the multi-Region cluster in its current state.</p>
        capo_memorydb.errors.invalid_parameter_combination_exception.InvalidParameterCombinationException: <p>The specified parameter combination is not valid.</p>
        capo_memorydb.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The specified parameter value is not valid.</p>
        capo_memorydb.errors.invalid_vpc_network_state_fault.InvalidVPCNetworkStateFault: <p>The VPC network is not in a valid state for the requested operation.</p>
        capo_memorydb.errors.multi_region_cluster_not_found_fault.MultiRegionClusterNotFoundFault: <p>The specified multi-Region cluster does not exist.</p>
        capo_memorydb.errors.node_quota_for_cluster_exceeded_fault.NodeQuotaForClusterExceededFault: <p>The request cannot be processed because it would exceed the maximum number of nodes allowed for this cluster.</p>
        capo_memorydb.errors.node_quota_for_customer_exceeded_fault.NodeQuotaForCustomerExceededFault: <p>The request cannot be processed because it would exceed the maximum number of nodes allowed for this customer.</p>
        capo_memorydb.errors.parameter_group_not_found_fault.ParameterGroupNotFoundFault: <p>The specified parameter group does not exist.</p>
        capo_memorydb.errors.service_linked_role_not_found_fault.ServiceLinkedRoleNotFoundFault: <p>The required service-linked role was not found.</p>
        capo_memorydb.errors.shards_per_cluster_quota_exceeded_fault.ShardsPerClusterQuotaExceededFault: <p>The request cannot be processed because it would exceed the maximum number of shards allowed per cluster.</p>
        capo_memorydb.errors.subnet_group_not_found_fault.SubnetGroupNotFoundFault: <p>The specified subnet group does not exist.</p>
        capo_memorydb.errors.tag_quota_per_resource_exceeded.TagQuotaPerResourceExceeded: <p>The request cannot be processed because it would exceed the maximum number of tags allowed per resource.</p>
        capo_memorydb.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_memorydb.types.create_cluster_request.CreateClusterRequest]",
    ) -> AsyncOperationResponse[
        "capo_memorydb.types.create_cluster_response.CreateClusterResponse"
    ]:
        import capo_memorydb._operations.amazon_memory_db.create_cluster

        (
            output,
            http_response,
        ) = await capo_memorydb._operations.amazon_memory_db.create_cluster.async_create_cluster(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateCluster")
    )
    input_: capo_memorydb.types.create_cluster_request.CreateClusterRequest = {
        "cluster_name": cluster_name,
        "node_type": node_type,
        "acl_name": acl_name,
    }
    if multi_region_cluster_name is not None:
        input_["multi_region_cluster_name"] = multi_region_cluster_name
    if parameter_group_name is not None:
        input_["parameter_group_name"] = parameter_group_name
    if description is not None:
        input_["description"] = description
    if num_shards is not None:
        input_["num_shards"] = num_shards
    if num_replicas_per_shard is not None:
        input_["num_replicas_per_shard"] = num_replicas_per_shard
    if subnet_group_name is not None:
        input_["subnet_group_name"] = subnet_group_name
    if security_group_ids is not None:
        input_["security_group_ids"] = security_group_ids
    if maintenance_window is not None:
        input_["maintenance_window"] = maintenance_window
    if port is not None:
        input_["port"] = port
    if sns_topic_arn is not None:
        input_["sns_topic_arn"] = sns_topic_arn
    if tls_enabled is not None:
        input_["tls_enabled"] = tls_enabled
    if kms_key_id is not None:
        input_["kms_key_id"] = kms_key_id
    if snapshot_arns is not None:
        input_["snapshot_arns"] = snapshot_arns
    if snapshot_name is not None:
        input_["snapshot_name"] = snapshot_name
    if snapshot_retention_limit is not None:
        input_["snapshot_retention_limit"] = snapshot_retention_limit
    if tags is not None:
        input_["tags"] = tags
    if snapshot_window is not None:
        input_["snapshot_window"] = snapshot_window
    if engine is not None:
        input_["engine"] = engine
    if engine_version is not None:
        input_["engine_version"] = engine_version
    if auto_minor_version_upgrade is not None:
        input_["auto_minor_version_upgrade"] = auto_minor_version_upgrade
    if data_tiering is not None:
        input_["data_tiering"] = data_tiering
    if network_type is not None:
        input_["network_type"] = network_type
    if ip_discovery is not None:
        input_["ip_discovery"] = ip_discovery

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output