Skip to content

update_keyspace

update_keyspace(
    keyspace_name: KeyspaceName,
    replication_specification: ReplicationSpecification,
    *,
    config_overrides: Optional[KeyspacesClientConfig] = None,
    client_side_timestamps: Optional[ClientSideTimestamps] = None,
) -> UpdateKeyspaceResponse

Adds a new Amazon Web Services Region to the keyspace. You can add a new Region to a keyspace that is either a single or a multi-Region keyspace. Amazon Keyspaces is going to replicate all tables in the keyspace to the new Region. To successfully replicate all tables to the new Region, they must use client-side timestamps for conflict resolution. To enable client-side timestamps, specify clientSideTimestamps.status = enabled when invoking the API. For more information about client-side timestamps, see Client-side timestamps in Amazon Keyspaces in the Amazon Keyspaces Developer Guide.

To add a Region to a keyspace using the UpdateKeyspace API, the IAM principal needs permissions for the following IAM actions:

  • cassandra:Alter

  • cassandra:AlterMultiRegionResource

  • cassandra:Create

  • cassandra:CreateMultiRegionResource

  • cassandra:Select

  • cassandra:SelectMultiRegionResource

  • cassandra:Modify

  • cassandra:ModifyMultiRegionResource

If the keyspace contains a table that is configured in provisioned mode with auto scaling enabled, the following additional IAM actions need to be allowed.

  • application-autoscaling:RegisterScalableTarget

  • application-autoscaling:DeregisterScalableTarget

  • application-autoscaling:DescribeScalableTargets

  • application-autoscaling:PutScalingPolicy

  • application-autoscaling:DescribeScalingPolicies

To use the UpdateKeyspace API, the IAM principal also needs permissions to create a service-linked role with the following elements:

  • iam:CreateServiceLinkedRole - The action the principal can perform.

  • arn:aws:iam::*:role/aws-service-role/replication.cassandra.amazonaws.com/AWSServiceRoleForKeyspacesReplication - The resource that the action can be performed on.

  • iam:AWSServiceName: replication.cassandra.amazonaws.com - The only Amazon Web Services service that this role can be attached to is Amazon Keyspaces.

For more information, see Configure the IAM permissions required to add an Amazon Web Services Region to a keyspace in the Amazon Keyspaces Developer Guide.

Parameters:

  • keyspace_name (KeyspaceName) –

    The name of the keyspace.

Raises:

  • AccessDeniedException –

    You don't have sufficient access permissions to perform this action.

  • ConflictException –

    Amazon Keyspaces couldn't complete the requested action. This error may occur if you try to perform an action and the same or a different action is already in progress, or if you try to create a resource that already exists.

  • InternalServerException –

    Amazon Keyspaces was unable to fully process this request because of an internal server error.

  • ResourceNotFoundException –

    The operation tried to access a keyspace, table, or type that doesn't exist. The resource might not be specified correctly, or its status might not be ACTIVE.

  • ServiceQuotaExceededException –

    The operation exceeded the service quota for this resource. For more information on service quotas, see Quotas in the Amazon Keyspaces Developer Guide.

  • ValidationException –

    The operation failed due to an invalid or malformed request.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_keyspaces/_services/keyspaces.py
def update_keyspace(
    self,
    keyspace_name: "capo_keyspaces.types.keyspace_name.KeyspaceName",
    replication_specification: "capo_keyspaces.types.replication_specification.ReplicationSpecification",
    *,
    config_overrides: Optional[KeyspacesClientConfig] = None,
    client_side_timestamps: Optional[
        "capo_keyspaces.types.client_side_timestamps.ClientSideTimestamps"
    ] = None,
) -> "capo_keyspaces.types.update_keyspace_response.UpdateKeyspaceResponse":
    """<p> Adds a new Amazon Web Services Region to the keyspace. You can add a new Region to a keyspace that is either a single or a multi-Region keyspace. Amazon Keyspaces is going to replicate all tables in the keyspace to the new Region. To successfully replicate all tables to the new Region, they must use client-side timestamps for conflict resolution. To enable client-side timestamps, specify <code>clientSideTimestamps.status = enabled</code> when invoking the API. For more information about client-side timestamps, see <a href="https://docs.aws.amazon.com/keyspaces/latest/devguide/client-side-timestamps.html">Client-side timestamps in Amazon Keyspaces</a> in the <i>Amazon Keyspaces Developer Guide</i>.</p> <p>To add a Region to a keyspace using the <code>UpdateKeyspace</code> API, the IAM principal needs permissions for the following IAM actions:</p> <ul> <li> <p> <code>cassandra:Alter</code> </p> </li> <li> <p> <code>cassandra:AlterMultiRegionResource</code> </p> </li> <li> <p> <code>cassandra:Create</code> </p> </li> <li> <p> <code>cassandra:CreateMultiRegionResource</code> </p> </li> <li> <p> <code>cassandra:Select</code> </p> </li> <li> <p> <code>cassandra:SelectMultiRegionResource</code> </p> </li> <li> <p> <code>cassandra:Modify</code> </p> </li> <li> <p> <code>cassandra:ModifyMultiRegionResource</code> </p> </li> </ul> <p>If the keyspace contains a table that is configured in provisioned mode with auto scaling enabled, the following additional IAM actions need to be allowed.</p> <ul> <li> <p> <code>application-autoscaling:RegisterScalableTarget</code> </p> </li> <li> <p> <code>application-autoscaling:DeregisterScalableTarget</code> </p> </li> <li> <p> <code>application-autoscaling:DescribeScalableTargets</code> </p> </li> <li> <p> <code>application-autoscaling:PutScalingPolicy</code> </p> </li> <li> <p> <code>application-autoscaling:DescribeScalingPolicies</code> </p> </li> </ul> <p>To use the <code>UpdateKeyspace</code> API, the IAM principal also needs permissions to create a service-linked role with the following elements:</p> <ul> <li> <p> <code>iam:CreateServiceLinkedRole</code> - The <b>action</b> the principal can perform.</p> </li> <li> <p> <code>arn:aws:iam::*:role/aws-service-role/replication.cassandra.amazonaws.com/AWSServiceRoleForKeyspacesReplication</code> - The <b>resource</b> that the action can be performed on. </p> </li> <li> <p> <code>iam:AWSServiceName: replication.cassandra.amazonaws.com</code> - The only Amazon Web Services service that this role can be attached to is Amazon Keyspaces.</p> </li> </ul> <p>For more information, see <a href="https://docs.aws.amazon.com/keyspaces/latest/devguide/howitworks_replication_permissions_addReplica.html">Configure the IAM permissions required to add an Amazon Web Services Region to a keyspace</a> in the <i>Amazon Keyspaces Developer Guide</i>.</p>

    Args:
        keyspace_name: <p> The name of the keyspace. </p>

    Raises:
        capo_keyspaces.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access permissions to perform this action. </p>
        capo_keyspaces.errors.conflict_exception.ConflictException: <p>Amazon Keyspaces couldn't complete the requested action. This error may occur if you try to perform an action and the same or a different action is already in progress, or if you try to create a resource that already exists. </p>
        capo_keyspaces.errors.internal_server_exception.InternalServerException: <p>Amazon Keyspaces was unable to fully process this request because of an internal server error.</p>
        capo_keyspaces.errors.resource_not_found_exception.ResourceNotFoundException: <p>The operation tried to access a keyspace, table, or type that doesn't exist. The resource might not be specified correctly, or its status might not be <code>ACTIVE</code>.</p>
        capo_keyspaces.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The operation exceeded the service quota for this resource. For more information on service quotas, see <a href="https://docs.aws.amazon.com/keyspaces/latest/devguide/quotas.html">Quotas</a> in the <i>Amazon Keyspaces Developer Guide</i>.</p>
        capo_keyspaces.errors.validation_exception.ValidationException: <p>The operation failed due to an invalid or malformed request.</p>
        capo_keyspaces.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_keyspaces.types.update_keyspace_request.UpdateKeyspaceRequest]",
    ) -> OperationResponse[
        "capo_keyspaces.types.update_keyspace_response.UpdateKeyspaceResponse"
    ]:
        import capo_keyspaces._operations.keyspaces_service.update_keyspace

        output, http_response = (
            capo_keyspaces._operations.keyspaces_service.update_keyspace.update_keyspace(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateKeyspace")
    )
    input_: capo_keyspaces.types.update_keyspace_request.UpdateKeyspaceRequest = {
        "keyspace_name": keyspace_name,
        "replication_specification": replication_specification,
    }
    if client_side_timestamps is not None:
        input_["client_side_timestamps"] = client_side_timestamps

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