The Amazon Timestream
Tags: timestreamdb, awsbigdata, terraform, database
Published: 2022-10-16 22:05:40

**What is Amazon Timestream?** 

> Amazon Timestream is a fast, scalable, fully managed, purpose-built time series database that makes it easy to store and analyze trillions of time series data points per day. 

**How does one know when to choose an Amazon Timestream?** 

If you are looking into saving time and cost, Amazon Timestream Timeseries can help you to manage the lifecycle of your time series data by keeping recent data in memory and moving historical data to a cost-optimized storage tier based upon your defined policies. 

**What is some industry Amazon Timestream use cases?** 

- IoT applications 

- Event tracking 

- Monitoring metrics 

 
![ats](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8irsvj7hxwsu7rvdyucw.png)

Now that we have a general idea of Amazon Timestream let us continue drilling deeper and let us explore and build Amazon Timestream resource using Terraform.

*Some important characteristics about Amazon Timestream*

**Amazon Timestream** 

``` 
Performance:  

- Serverless, there are no servers to manage and no capacity to provide
- Automatically scales to adjust capacity
- Simplifies the complex process of data lifecycle management It offers storage tiering, with a memory store for recent data and a magnetic store for historical data
- Automates the transfer of data from the memory store to the magnetic store based upon user configurable policies 
- Simplified data access no longer need to use disparate tools to access recent and historical data 
- Purpose-built query engine transparently accesses and combines data across storage tiers without having to specify the data location. 

 

Availability: 

- Ensures high availability of your write and read requests by automatically replicating data and allocating resources across at least 3 different Availability Zones within a single AWS Region
- Ensures durability of your data by automatically replicating your memory and magnetic store data across different Availability Zones within a single AWS Region
- All data is written to disk before acknowledging writes request as complete 


Security: 

- Ensures that your time series data is always encrypted, whether at rest or in transit. 
- Also enables you to specify an AWS KMS customer managed key (CMK) for encrypting data in the magnetic store 

``` 

*Now let us see some limitations to consider:*


**Amazon Timestream:** 

``` 
- Databases per account: 500  

- Future ingestion period in minutes: 15 

- Minimum retention period for memory store in hours: 1 

- Maximum retention period for memory store in hours: 8766 

- Maximum record size: 2KB 

- Data size for query result: 5 Gigabytes 

- Minimum retention period for magnetic store in days: 1 

- Maximum retention period for magnetic store in days: 73000 
``` 

Oh, right it is building :construction_worker: time let us build this database using Terraform  

**Terraform code previous:** 


``` 
resource "aws_timestreamwrite_database" "timestream_database" {
  database_name = "timestream-database-iot"
  
  tags = {
    Name = "timestream-database-iot"
  }
}


``` 
[Find the Terraform repo and directions for this project here](https://github.com/ValAug/aws-databases-terraform) 


**What we have accomplished-Diagram**  


![All-BD's](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a9przvaj5tf70zu7qgcq.png)

**Databases Theoretical Conclusion**

 > “With data collection, ‘the sooner the better’ is always the best answer.” 
***— Marissa Mayer***

Now that we have learned some of the main AWS-Databases and their different uses cases and market section.  **What is next for us?**

As I promised we will build one or two projects using one or two of these databases. We will work together aiming to gain some experience that you could possible use in your next project or your next interview perhaps.  

***Please stay tuned for more of this series to come up and thank you for going this far and I hope to see you in the mini projects section shortly!*** 

**References:**  
```  

https://docs.aws.amazon.com/timestream/latest/developerguide/ts-limits.html

```