AWS Amazon Timestream Database

This page shows how to write Terraform and CloudFormation for Amazon Timestream Database and write them securely.

aws_timestreamwrite_database (Terraform)

The Database in Amazon Timestream can be configured in Terraform with the resource name aws_timestreamwrite_database. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L3
resource "aws_timestreamwrite_database" "enabled" {
  database_name = "timestream"

  kms_key_id = var.kms_key_id
}

main.tf#L3
resource "aws_timestreamwrite_database" "enabled" {
  database_name = "timestream"

  kms_key_id = var.kms_key_id
}

aws_timestreamwrite_database.tf#L1
resource "aws_timestreamwrite_database" "test" {
  database_name = "examplea"
  kms_key_id    = aws_kms_key.test.arn
tulsi-ts.tf#L1
resource "aws_timestreamwrite_database" "tulsi-ts" {
  database_name = "tulsi"

  tags = {
    Name = "tulsi-ts"
  }
test.tf#L1
resource "aws_timestreamwrite_database" "example" {
  database_name = "database-example"
  kms_key_id    = aws_kms_key.example.arn

  tags = {
    Name = "value"

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

The following arguments are supported:

  • database_name – (Required) The name of the Timestream database. Minimum length of 3. Maximum length of 64.
  • kms_key_id - (Optional) The ARN (not Alias ARN) of the KMS key to be used to encrypt the data stored in the database. If the KMS key is not specified, the database will be encrypted with a Timestream managed KMS key located in your account. Refer to AWS managed KMS keys for more info.
  • tags - (Optional) Map of tags to assign to this resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

In addition to all arguments above, the following attributes are exported:

  • id - The name of the Timestream database.
  • arn - The ARN that uniquely identifies this database.
  • kms_key_id - The ARN of the KMS key used to encrypt the data stored in the database.
  • table_count - The total number of tables found within the Timestream database.
  • tags_all - A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Explanation in Terraform Registry

Provides a Timestream database resource.

AWS::Timestream::Database (CloudFormation)

The Database in Timestream can be configured in CloudFormation with the resource name AWS::Timestream::Database. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

timestream.yml#L5
    Type: "AWS::Timestream::Database"
    Properties:
      DatabaseName: CPTMonitoring
  timestreamTable:
    Type: "AWS::Timestream::Table"
    Properties:
TimestreamDatabaseKMSKey-FAILED.yaml#L4
    Type: AWS::Timestream::Database
    Properties:
      DatabaseName: timestream
TimestreamDatabaseKMSKey-PASSED.yaml#L4
    Type: AWS::Timestream::Database
    Properties:
      DatabaseName: timestream
      KmsKeyId: kms-key-id
TimestreamDatabaseKMSKey-PASSED.yaml#L4
    Type: AWS::Timestream::Database
    Properties:
      DatabaseName: timestream
      KmsKeyId: kms-key-id
TimestreamDatabaseKMSKey-FAILED.yaml#L4
    Type: AWS::Timestream::Database
    Properties:
      DatabaseName: timestream
cfn-iot-rule-to-timestream.json#L6
      "Type" : "AWS::Timestream::Database"
    },

    "TimestreamTable": {
      "Type" : "AWS::Timestream::Table",
      "Properties" : {
cfn-iot-rule-to-timestream.json#L6
      "Type" : "AWS::Timestream::Database"
    },

    "TimestreamTable": {
      "Type" : "AWS::Timestream::Table",
      "Properties" : {
cfn-iot-rule-to-timestream.json#L6
      "Type" : "AWS::Timestream::Database"
    },

    "TimestreamTable": {
      "Type" : "AWS::Timestream::Table",
      "Properties" : {
cfn-iot-rule-to-timestream.json#L6
      "Type" : "AWS::Timestream::Database"
    },

    "TimestreamTable": {
      "Type" : "AWS::Timestream::Table",
      "Properties" : {
serverless-state.json#L286
            "Type": "AWS::Timestream::Database",
            "Properties": {
              "DatabaseName": "StockData"
            }
          },
          "TimeStreamDBStockDataTable": {

Parameters

Explanation in CloudFormation Registry

Creates a new Timestream database. If the AWS KMS key is not specified, the database will be encrypted with a Timestream managed AWS KMS key located in your account. Refer to AWS managed AWS KMS keys for more info. Service quotas apply. See code sample for details.

Frequently asked questions

What is AWS Amazon Timestream Database?

AWS Amazon Timestream Database is a resource for Amazon Timestream of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Amazon Timestream Database?

For Terraform, the melscoop-test/check, SnidermanIndustries/checkov-fork and JamesWoolfenden/check-encrypt source code examples are useful. See the Terraform Example section for further details.

For CloudFormation, the gkilcaus/cpt-monitoring, SnidermanIndustries/checkov-fork and melscoop-test/check source code examples are useful. See the CloudFormation Example section for further details.