:doc:`LakeFormation <../../lakeformation>` / Client / get_temporary_data_location_credentials

***************************************
get_temporary_data_location_credentials
***************************************



.. py:method:: LakeFormation.Client.get_temporary_data_location_credentials(**kwargs)

  

  Allows a user or application in a secure environment to access data in a specific Amazon S3 location registered with Lake Formation by providing temporary scoped credentials that are limited to the requested data location and the caller's authorized access level.

   

  The API operation returns an error in the following scenarios:

   

  
  * The data location is not registered with Lake Formation.
   
  * No Glue table is associated with the data location.
   
  * The caller doesn't have required permissions on the associated table. The caller must have ``SELECT`` or ``SUPER`` permissions on the associated table, and credential vending for full table access must be enabled in the data lake settings. For more information, see `Application integration for full table access <https://docs.aws.amazon.com/lake-formation/latest/dg/full-table-credential-vending.html>`__.
   
  * The data location is in a different Amazon Web Services Region. Lake Formation doesn't support cross-Region access when vending credentials for a data location. Lake Formation only supports Amazon S3 paths registered within the same Region as the API call.
  

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/lakeformation-2017-03-31/GetTemporaryDataLocationCredentials>`_  


  **Request Syntax**
  ::

    response = client.get_temporary_data_location_credentials(
        DurationSeconds=123,
        AuditContext={
            'AdditionalAuditContext': 'string'
        },
        DataLocations=[
            'string',
        ],
        CredentialsScope='READ'|'READWRITE'
    )
    
  :type DurationSeconds: integer
  :param DurationSeconds: 

    The time period, between 900 and 43,200 seconds, for the timeout of the temporary credentials.

    

  
  :type AuditContext: dict
  :param AuditContext: 

    A structure used to include auditing information on the privileged API.

    

  
    - **AdditionalAuditContext** *(string) --* 

      The filter engine can populate the 'AdditionalAuditContext' information with the request ID for you to track. This information will be displayed in CloudTrail log in your account.

      

    
  
  :type DataLocations: list
  :param DataLocations: 

    The Amazon S3 data location that you want to access.

    

  
    - *(string) --* 

    

  :type CredentialsScope: string
  :param CredentialsScope: 

    The credential scope is determined by the caller's Lake Formation permission on the associated table. Credential scope can be either:

     

    
    * READ - Provides read-only access to the data location.
     
    * READ_WRITE - Provides both read and write access to the data location.
    

    

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

    
    ::

      {
          'Credentials': {
              'AccessKeyId': 'string',
              'SecretAccessKey': 'string',
              'SessionToken': 'string',
              'Expiration': datetime(2015, 1, 1)
          },
          'AccessibleDataLocations': [
              'string',
          ],
          'CredentialsScope': 'READ'|'READWRITE'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **Credentials** *(dict) --* 

        A temporary set of credentials for an Lake Formation user. These credentials are scoped down to only access the raw data sources that the user has access to.

         

        The temporary security credentials consist of an access key and a session token. The access key consists of an access key ID and a secret key. When the credentials are created, they are associated with an IAM access control policy that limits what the user can do when using the credentials.

        
        

        - **AccessKeyId** *(string) --* 

          The access key ID for the temporary credentials.

          
        

        - **SecretAccessKey** *(string) --* 

          The secret key for the temporary credentials.

          
        

        - **SessionToken** *(string) --* 

          The session token for the temporary credentials.

          
        

        - **Expiration** *(datetime) --* 

          The date and time when the temporary credentials expire.

          
    
      

      - **AccessibleDataLocations** *(list) --* 

        Refers to the Amazon S3 locations that can be accessed through the ``GetTemporaryCredentialsForLocation`` API operation.

        
        

        - *(string) --* 
    
      

      - **CredentialsScope** *(string) --* 

        The credential scope is determined by the caller's Lake Formation permission on the associated table. Credential scope can be either:

         

        
        * READ - Provides read-only access to the data location.
         
        * READ_WRITE - Provides both read and write access to the data location.
        

        
  
  **Exceptions**
  
  *   :py:class:`LakeFormation.Client.exceptions.InvalidInputException`

  
  *   :py:class:`LakeFormation.Client.exceptions.InternalServiceException`

  
  *   :py:class:`LakeFormation.Client.exceptions.OperationTimeoutException`

  
  *   :py:class:`LakeFormation.Client.exceptions.GlueEncryptionException`

  
  *   :py:class:`LakeFormation.Client.exceptions.EntityNotFoundException`

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

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

  