:doc:`TimestreamWrite <../../timestream-write>` / Client / create_database

***************
create_database
***************



.. py:method:: TimestreamWrite.Client.create_database(**kwargs)

  

  Creates a new Timestream database. If the KMS key is not specified, the database will be encrypted with a Timestream managed KMS key located in your account. For more information, see `Amazon Web Services managed keys <https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk>`__. `Service quotas apply <https://docs.aws.amazon.com/timestream/latest/developerguide/ts-limits.html>`__. For details, see `code sample <https://docs.aws.amazon.com/timestream/latest/developerguide/code-samples.create-db.html>`__.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/timestream-write-2018-11-01/CreateDatabase>`_  


  **Request Syntax**
  ::

    response = client.create_database(
        DatabaseName='string',
        KmsKeyId='string',
        Tags=[
            {
                'Key': 'string',
                'Value': 'string'
            },
        ]
    )
    
  :type DatabaseName: string
  :param DatabaseName: **[REQUIRED]** 

    The name of the Timestream database.

    

  
  :type KmsKeyId: string
  :param KmsKeyId: 

    The KMS key for the database. If the KMS key is not specified, the database will be encrypted with a Timestream managed KMS key located in your account. For more information, see `Amazon Web Services managed keys <https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk>`__.

    

  
  :type Tags: list
  :param Tags: 

    A list of key-value pairs to label the table.

    

  
    - *(dict) --* 

      A tag is a label that you assign to a Timestream database and/or table. Each tag consists of a key and an optional value, both of which you define. With tags, you can categorize databases and/or tables, for example, by purpose, owner, or environment.

      

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

        The key of the tag. Tag keys are case sensitive.

        

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

        The value of the tag. Tag values are case-sensitive and can be null.

        

      
    

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

    
    ::

      {
          'Database': {
              'Arn': 'string',
              'DatabaseName': 'string',
              'TableCount': 123,
              'KmsKeyId': 'string',
              'CreationTime': datetime(2015, 1, 1),
              'LastUpdatedTime': datetime(2015, 1, 1)
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **Database** *(dict) --* 

        The newly created Timestream database.

        
        

        - **Arn** *(string) --* 

          The Amazon Resource Name that uniquely identifies this database.

          
        

        - **DatabaseName** *(string) --* 

          The name of the Timestream database.

          
        

        - **TableCount** *(integer) --* 

          The total number of tables found within a Timestream database.

          
        

        - **KmsKeyId** *(string) --* 

          The identifier of the KMS key used to encrypt the data stored in the database.

          
        

        - **CreationTime** *(datetime) --* 

          The time when the database was created, calculated from the Unix epoch time.

          
        

        - **LastUpdatedTime** *(datetime) --* 

          The last time that this database was updated.

          
    
  
  **Exceptions**
  
  *   :py:class:`TimestreamWrite.Client.exceptions.ConflictException`

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

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

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

  
  *   :py:class:`TimestreamWrite.Client.exceptions.ThrottlingException`

  
  *   :py:class:`TimestreamWrite.Client.exceptions.InvalidEndpointException`

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

  
  *   :py:class:`TimestreamWrite.Client.exceptions.InvalidEndpointException`

  