:doc:`Keyspaces <../../keyspaces>` / Client / update_keyspace

***************
update_keyspace
***************



.. py:method:: Keyspaces.Client.update_keyspace(**kwargs)

  

  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 <https://docs.aws.amazon.com/keyspaces/latest/devguide/client-side-timestamps.html>`__ 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 <https://docs.aws.amazon.com/keyspaces/latest/devguide/howitworks_replication_permissions_addReplica.html>`__ in the *Amazon Keyspaces Developer Guide*.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/keyspaces-2022-02-10/UpdateKeyspace>`_  


  **Request Syntax**
  ::

    response = client.update_keyspace(
        keyspaceName='string',
        replicationSpecification={
            'replicationStrategy': 'SINGLE_REGION'|'MULTI_REGION',
            'regionList': [
                'string',
            ]
        },
        clientSideTimestamps={
            'status': 'ENABLED'
        }
    )
    
  :type keyspaceName: string
  :param keyspaceName: **[REQUIRED]** 

    The name of the keyspace.

    

  
  :type replicationSpecification: dict
  :param replicationSpecification: **[REQUIRED]** 

    The replication specification of the keyspace includes:

     

    
    * ``regionList`` - the Amazon Web Services Regions where the keyspace is replicated in.
     
    * ``replicationStrategy`` - the required value is ``SINGLE_REGION`` or ``MULTI_REGION``.
    

    

  
    - **replicationStrategy** *(string) --* **[REQUIRED]** 

      The ``replicationStrategy`` of a keyspace, the required value is ``SINGLE_REGION`` or ``MULTI_REGION``.

      

    
    - **regionList** *(list) --* 

      The ``regionList`` contains the Amazon Web Services Regions where the keyspace is replicated in.

      

    
      - *(string) --* 

      
  
  
  :type clientSideTimestamps: dict
  :param clientSideTimestamps: 

    The client-side timestamp setting of the table.

     

    For more information, see `How it works\: Amazon Keyspaces client-side timestamps <https://docs.aws.amazon.com/keyspaces/latest/devguide/client-side-timestamps-how-it-works.html>`__ in the *Amazon Keyspaces Developer Guide*.

    

  
    - **status** *(string) --* **[REQUIRED]** 

      Shows how to enable client-side timestamps settings for the specified table.

      

    
  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'resourceArn': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **resourceArn** *(string) --* 

        The unique identifier of the keyspace in the format of an Amazon Resource Name (ARN).

        
  
  **Exceptions**
  
  *   :py:class:`Keyspaces.Client.exceptions.ValidationException`

  
  *   :py:class:`Keyspaces.Client.exceptions.ServiceQuotaExceededException`

  
  *   :py:class:`Keyspaces.Client.exceptions.InternalServerException`

  
  *   :py:class:`Keyspaces.Client.exceptions.ConflictException`

  
  *   :py:class:`Keyspaces.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`Keyspaces.Client.exceptions.ResourceNotFoundException`

  