Skip to content

modify_replication_group_shard_configuration async

modify_replication_group_shard_configuration(
    *,
    config_overrides: Optional[AsyncElastiCacheClientConfig] = None,
    replication_group_id: Optional[String] = None,
    node_group_count: Optional[Integer] = None,
    apply_immediately: Optional[Boolean] = None,
    resharding_configuration: Optional[ReshardingConfigurationList] = None,
    node_groups_to_remove: Optional[NodeGroupsToRemoveList] = None,
    node_groups_to_retain: Optional[NodeGroupsToRetainList] = None,
) -> ModifyReplicationGroupShardConfigurationResult

Modifies a replication group's shards (node groups) by allowing you to add shards, remove shards, or rebalance the keyspaces among existing shards.

Parameters:

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

    The name of the Valkey or Redis OSS (cluster mode enabled) cluster (replication group) on which the shards are to be configured.

  • node_group_count (Optional[Integer], default: None ) –

    The number of node groups (shards) that results from the modification of the shard configuration.

  • apply_immediately (Optional[Boolean], default: None ) –

    Indicates that the shard reconfiguration process begins immediately. At present, the only permitted value for this parameter is true.

    Value: true

  • resharding_configuration (Optional[ReshardingConfigurationList], default: None ) –

    Specifies the preferred availability zones for each node group in the cluster. If the value of NodeGroupCount is greater than the current number of node groups (shards), you can use this parameter to specify the preferred availability zones of the cluster's shards. If you omit this parameter ElastiCache selects availability zones for you.

    You can specify this parameter only if the value of NodeGroupCount is greater than the current number of node groups (shards).

  • node_groups_to_remove (Optional[NodeGroupsToRemoveList], default: None ) –

    If the value of NodeGroupCount is less than the current number of node groups (shards), then either NodeGroupsToRemove or NodeGroupsToRetain is required. NodeGroupsToRemove is a list of NodeGroupIds to remove from the cluster.

    ElastiCache will attempt to remove all node groups listed by NodeGroupsToRemove from the cluster.

  • node_groups_to_retain (Optional[NodeGroupsToRetainList], default: None ) –

    If the value of NodeGroupCount is less than the current number of node groups (shards), then either NodeGroupsToRemove or NodeGroupsToRetain is required. NodeGroupsToRetain is a list of NodeGroupIds to retain in the cluster.

    ElastiCache will attempt to remove all node groups except those listed by NodeGroupsToRetain from the cluster.

Raises:

Source code in docs_src/capo_elasticache/_services/async_elasti_cache.py
async def modify_replication_group_shard_configuration(
    self,
    *,
    config_overrides: Optional[AsyncElastiCacheClientConfig] = None,
    replication_group_id: Optional["capo_elasticache.types.string.String"] = None,
    node_group_count: Optional["capo_elasticache.types.integer.Integer"] = None,
    apply_immediately: Optional["capo_elasticache.types.boolean.Boolean"] = None,
    resharding_configuration: Optional[
        "capo_elasticache.types.resharding_configuration_list.ReshardingConfigurationList"
    ] = None,
    node_groups_to_remove: Optional[
        "capo_elasticache.types.node_groups_to_remove_list.NodeGroupsToRemoveList"
    ] = None,
    node_groups_to_retain: Optional[
        "capo_elasticache.types.node_groups_to_retain_list.NodeGroupsToRetainList"
    ] = None,
) -> "capo_elasticache.types.modify_replication_group_shard_configuration_result.ModifyReplicationGroupShardConfigurationResult":
    """<p>Modifies a replication group's shards (node groups) by allowing you to add shards, remove shards, or rebalance the keyspaces among existing shards.</p>

    Args:
        replication_group_id: <p>The name of the Valkey or Redis OSS (cluster mode enabled) cluster (replication group) on which the shards are to be configured.</p>
        node_group_count: <p>The number of node groups (shards) that results from the modification of the shard configuration.</p>
        apply_immediately: <p>Indicates that the shard reconfiguration process begins immediately. At present, the only permitted value for this parameter is <code>true</code>.</p> <p>Value: true</p>
        resharding_configuration: <p>Specifies the preferred availability zones for each node group in the cluster. If the value of <code>NodeGroupCount</code> is greater than the current number of node groups (shards), you can use this parameter to specify the preferred availability zones of the cluster's shards. If you omit this parameter ElastiCache selects availability zones for you.</p> <p>You can specify this parameter only if the value of <code>NodeGroupCount</code> is greater than the current number of node groups (shards).</p>
        node_groups_to_remove: <p>If the value of <code>NodeGroupCount</code> is less than the current number of node groups (shards), then either <code>NodeGroupsToRemove</code> or <code>NodeGroupsToRetain</code> is required. <code>NodeGroupsToRemove</code> is a list of <code>NodeGroupId</code>s to remove from the cluster.</p> <p>ElastiCache will attempt to remove all node groups listed by <code>NodeGroupsToRemove</code> from the cluster.</p>
        node_groups_to_retain: <p>If the value of <code>NodeGroupCount</code> is less than the current number of node groups (shards), then either <code>NodeGroupsToRemove</code> or <code>NodeGroupsToRetain</code> is required. <code>NodeGroupsToRetain</code> is a list of <code>NodeGroupId</code>s to retain in the cluster.</p> <p>ElastiCache will attempt to remove all node groups except those listed by <code>NodeGroupsToRetain</code> from the cluster.</p>

    Raises:
        capo_elasticache.errors.insufficient_cache_cluster_capacity_fault.InsufficientCacheClusterCapacityFault: <p>The requested cache node type is not available in the specified Availability Zone. For more information, see <a href="http://docs.aws.amazon.com/AmazonElastiCache/latest/dg/ErrorMessages.html#ErrorMessages.INSUFFICIENT_CACHE_CLUSTER_CAPACITY">InsufficientCacheClusterCapacity</a> in the ElastiCache User Guide.</p>
        capo_elasticache.errors.invalid_cache_cluster_state_fault.InvalidCacheClusterStateFault: <p>The requested cluster is not in the <code>available</code> state.</p>
        capo_elasticache.errors.invalid_kms_key_fault.InvalidKMSKeyFault: <p>The KMS key supplied is not valid.</p>
        capo_elasticache.errors.invalid_parameter_combination_exception.InvalidParameterCombinationException: <p>Two or more incompatible parameters were specified.</p>
        capo_elasticache.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The value for a parameter is invalid.</p>
        capo_elasticache.errors.invalid_replication_group_state_fault.InvalidReplicationGroupStateFault: <p>The requested replication group is not in the <code>available</code> state.</p>
        capo_elasticache.errors.invalid_vpc_network_state_fault.InvalidVPCNetworkStateFault: <p>The VPC network is in an invalid state.</p>
        capo_elasticache.errors.node_groups_per_replication_group_quota_exceeded_fault.NodeGroupsPerReplicationGroupQuotaExceededFault: <p>The request cannot be processed because it would exceed the maximum allowed number of node groups (shards) in a single replication group. The default maximum is 90</p>
        capo_elasticache.errors.node_quota_for_customer_exceeded_fault.NodeQuotaForCustomerExceededFault: <p>The request cannot be processed because it would exceed the allowed number of cache nodes per customer.</p>
        capo_elasticache.errors.replication_group_not_found_fault.ReplicationGroupNotFoundFault: <p>The specified replication group does not exist.</p>
        capo_elasticache.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_elasticache.types.modify_replication_group_shard_configuration_message.ModifyReplicationGroupShardConfigurationMessage]",
    ) -> AsyncOperationResponse[
        "capo_elasticache.types.modify_replication_group_shard_configuration_result.ModifyReplicationGroupShardConfigurationResult"
    ]:
        import capo_elasticache._operations.amazon_elasti_cache_v9.modify_replication_group_shard_configuration

        (
            output,
            http_response,
        ) = await capo_elasticache._operations.amazon_elasti_cache_v9.modify_replication_group_shard_configuration.async_modify_replication_group_shard_configuration(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("ModifyReplicationGroupShardConfiguration"),
    )
    input_: capo_elasticache.types.modify_replication_group_shard_configuration_message.ModifyReplicationGroupShardConfigurationMessage = {}
    if replication_group_id is not None:
        input_["replication_group_id"] = replication_group_id
    if node_group_count is not None:
        input_["node_group_count"] = node_group_count
    if apply_immediately is not None:
        input_["apply_immediately"] = apply_immediately
    if resharding_configuration is not None:
        input_["resharding_configuration"] = resharding_configuration
    if node_groups_to_remove is not None:
        input_["node_groups_to_remove"] = node_groups_to_remove
    if node_groups_to_retain is not None:
        input_["node_groups_to_retain"] = node_groups_to_retain

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