:doc:`EBS <../../ebs>` / Client / get_snapshot_block

******************
get_snapshot_block
******************



.. py:method:: EBS.Client.get_snapshot_block(**kwargs)

  

  Returns the data in a block in an Amazon Elastic Block Store snapshot.

   

  .. note::

    

    You should always retry requests that receive server ( ``5xx``) error responses, and ``ThrottlingException`` and ``RequestThrottledException`` client error responses. For more information see `Error retries <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/error-retries.html>`__ in the *Amazon Elastic Compute Cloud User Guide*.

    

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/ebs-2019-11-02/GetSnapshotBlock>`_  


  **Request Syntax**
  ::

    response = client.get_snapshot_block(
        SnapshotId='string',
        BlockIndex=123,
        BlockToken='string'
    )
    
  :type SnapshotId: string
  :param SnapshotId: **[REQUIRED]** 

    The ID of the snapshot containing the block from which to get data.

     

    .. warning::

       

      If the specified snapshot is encrypted, you must have permission to use the KMS key that was used to encrypt the snapshot. For more information, see `Using encryption <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebsapis-using-encryption.html>`__ in the *Amazon Elastic Compute Cloud User Guide*.

      

    

  
  :type BlockIndex: integer
  :param BlockIndex: **[REQUIRED]** 

    The block index of the block in which to read the data. A block index is a logical index in units of ``512`` KiB blocks. To identify the block index, divide the logical offset of the data in the logical volume by the block size (logical offset of data/ ``524288``). The logical offset of the data must be ``512`` KiB aligned.

    

  
  :type BlockToken: string
  :param BlockToken: **[REQUIRED]** 

    The block token of the block from which to get data. You can obtain the ``BlockToken`` by running the ``ListChangedBlocks`` or ``ListSnapshotBlocks`` operations.

    

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

    
    ::

      {
          'DataLength': 123,
          'BlockData': StreamingBody(),
          'Checksum': 'string',
          'ChecksumAlgorithm': 'SHA256'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **DataLength** *(integer) --* 

        The size of the data in the block.

        
      

      - **BlockData** (:class:`.StreamingBody`) -- 

        The data content of the block.

        
      

      - **Checksum** *(string) --* 

        The checksum generated for the block, which is Base64 encoded.

        
      

      - **ChecksumAlgorithm** *(string) --* 

        The algorithm used to generate the checksum for the block, such as SHA256.

        
  
  **Exceptions**
  
  *   :py:class:`EBS.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`EBS.Client.exceptions.ValidationException`

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

  
  *   :py:class:`EBS.Client.exceptions.RequestThrottledException`

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

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

  