AWS Timestream — Introduction
When working on Serverless IoT platforms with event sources or scripts that collect analytics data, running into data storage issues? If so, Time-series databases are something we can look into. These databases maintain a collection of data points gathered over a period of time that enables us to monitor changes over milliseconds, days or even years.
As a time-series database, AWS Timestream is comparable to Graphite and Influx. Where inserting events based records are easy but changing your data is typically not done here.
- Dimensions — It represents the metadata of the event. Dimensions must be “VARCHAR”. For example if we need to run analytics on basis of user-click points in some page we can have pageName, X coordinates and Y coordinates as dimensions.
- Measure — Measure is the actual data point we can group-by or measure. Valid types of measure:value is DOUBLE, BIGINT, VARCHAR, BOOLEAN. Based on above mentioned scenario we can assign measure value of “1” for every click against dimensions [ pageName, X cords, Y cords ].
- Time — Time the event occurred, it is the key sorting point in time-series databases do. Each event must be timestamped.
Traits Of AWS Timestream
- Serverless auto-scaling — With its fully decoupled design, Amazon Timestream can scale independently for data ingestion, storage, and query, meeting the needs of an application.
- Storage Tier — With In-Memory Store and Magnetic Store, Amazon Timestream makes managing the data lifecycle simpler. While the In-Memory store is designed for rapid point-in-time queries, the magnetic store is constructed for rapid analytic queries. It is simple to design data retention policies to move data from the memory store to the magnetic store and to delete data from the magnetic store once it reaches a certain age.
- Time-series Analytics — Amazon Timestream offers time series analytics capability, and time series is a native data type. Support is provided for sophisticated aggregates, window functions, and complex data types including arrays and rows.
- Adaptive query Engine — A single SQL statement can be used to access data from several storage tiers using Amazon Timestream’s adaptive query engine. It accesses and mixes data across storage tiers discreetly and without the need to specify the location of the data.
- Encryption — Everything is encrypted in Timestream.
Timestream pricing boils down to two questions:
- Do you require a long-term memory store?
- Do you often query a table?
Based on the following dimensions, Amazon Timestream Pricing is calculated
- Writes: The quantity of data (rounded to the closest KB) that was written from the applications into a table.
- Queries: The volume of information scanned by the serverless distributed query engine used by Amazon Timestream to produce search results (rounded to the nearest MB, with a 10 MB minimum).
Let’s try something with Js and Timestream
Writing in Timestream: Let’s say user has clicked on (200,485) coordinates now we will write these data.
Querying Timestream: After accumulating some data lets Query with Homepage as pageName.
In a Nutshell
AWS Timestream is a powerful and useful service for anyone working with large amounts of time-series data. Whether you’re looking to store, analyze, or visualise your data, this service can help you do it quickly and easily, so you can focus on building great applications and solutions.
To conclude, Time-series databases are built for aggregating data, based on time intervals for analytics. We will be covering advanced queries and use cases in the next part of the Timestream Blog.
About the Author
Athreyan is a Software Development Engineer in KBX Digital, with 2+ years of experience in the IT field. He is tech-savvy, an avid reader and loves exploring new technology, music, and stock market
About KBX Digital
At KBX Digital, we use server-less technology to auto-scale micro-services to serve millions of customers.