DVA-C02Chapter 81 of 101Objective 1.3

Amazon Timestream for Time-Series Data

This chapter covers Amazon Timestream, a fully managed time-series database service optimized for storing and analyzing trillions of time-stamped data points per day. For the DVA-C02 exam, understanding Timestream's architecture, query patterns, and integration with other AWS services is critical for questions involving IoT, operational monitoring, and real-time analytics. Approximately 5-8% of exam questions may touch upon time-series data handling, and Timestream is the recommended service for such scenarios. You will learn not only what Timestream offers but also the specific mechanisms that make it distinct from relational databases, DynamoDB, or other storage options.

25 min read
Intermediate
Updated May 31, 2026

The Library of Time-Stamped Books

Imagine a library that stores every book ever written, but with a twist: each book is a time-stamped record of a specific event, like a temperature reading. The library is organized not by author or title, but by the time the event occurred. When you want to find all temperature readings for last Tuesday, the librarian doesn't scan every shelf—instead, she consults a master index that shows which shelves hold books for each hour. She grabs the shelves for that day, and within each shelf, the books are sorted by timestamp. If you ask for the average temperature over the past week, she doesn't read every book; she uses a precomputed summary card attached to each shelf that gives the min, max, and count for that hour. The library also automatically discards old shelves after a set period, say one year, to save space. If you want to query data from multiple libraries across the world, you use a special catalog that merges results. This is exactly how Amazon Timestream works: it stores time-series data in a hierarchical structure (memory store for recent data, magnetic store for older data), uses automatic partitioning by time, and provides built-in aggregation functions to avoid scanning every record.

How It Actually Works

What is Amazon Timestream and Why It Exists

Amazon Timestream is a serverless, fully managed time-series database service designed to handle the unique characteristics of time-series data: high write volume, append-only nature, time-based queries, and data that becomes less valuable as it ages. Traditional relational databases struggle with time-series data because they are optimized for ACID transactions and complex joins, not for the high-frequency inserts and range scans typical in IoT, DevOps, and industrial telemetry. Timestream addresses this by using a two-tier storage model: an in-memory store for recent, frequently accessed data, and a magnetic store for older, less-accessed data. The service automatically moves data between tiers based on a configurable retention policy. It also provides built-in time-series functions like AVG(), SUM(), MIN(), MAX(), and SAMPLE_BY() for downsampling and aggregation, eliminating the need for custom logic.

How Timestream Works Internally

Timestream stores data in a database that contains tables. Each table has a schema that includes measures (numeric values) and dimensions (metadata). When you write a record, you specify a timestamp, one or more measure values, and dimension key-value pairs. Timestream automatically partitions data by time and by dimensions. For example, if you have a sensor that reports temperature and humidity every second, each record might look like this:

{
  "Time": "2025-04-09T12:00:00Z",
  "MeasureValueType": "DOUBLE",
  "MeasureName": "temperature",
  "MeasureValue": "23.5",
  "Dimensions": [
    {"Name": "sensor_id", "Value": "sensor-01"},
    {"Name": "location", "Value": "warehouse-a"}
  ]
}

Timestream indexes data by time and dimensions. When you query, you specify a time range and optionally filter by dimensions. The query engine uses the time index to skip partitions outside the range. For recent data (in memory store), queries are low-latency. For older data (magnetic store), the engine uses columnar storage and compression to reduce I/O. Timestream also supports automatic time-to-live (TTL) to delete data older than a specified retention period (up to 10 years for magnetic store).

Key Components, Values, Defaults, and Timers

Database: A logical container for tables. No capacity planning needed; it scales automatically.

Table: Contains data records. Each table has a retention policy with two settings: MemoryStoreRetentionPeriodInHours (default 24 hours, range 1-8766 hours) and MagneticStoreRetentionPeriodInDays (default 365 days, range 1-73000 days). Data older than the memory retention period moves to magnetic store; data older than magnetic retention is deleted.

Measures: Numeric values you want to track. Types: DOUBLE, BIGINT, BOOLEAN, VARCHAR, MULTI (for multiple measures in one record).

Dimensions: Metadata attributes used for filtering and grouping. Each dimension is a key-value pair. You can have up to 128 dimensions per table.

Time: Timestamp in ISO 8601 format (e.g., 2025-04-09T12:00:00Z) or Unix epoch seconds/milliseconds.

MagneticStoreWriteMode: Controls how data is written to magnetic store. Options: ADMIN (default, manual) or AUTOMATIC (Timestream writes automatically).

Scheduled Queries: You can create scheduled queries to run periodically and store results in a destination table or Amazon S3.

Endpoints: Timestream has separate endpoints for write (ingest.timestream.<region>.amazonaws.com) and query (query.timestream.<region>.amazonaws.com).

Configuration and Verification Commands

To create a database and table using the AWS CLI:

aws timestream-write create-database --database-name MyTimeSeriesDB

aws timestream-write create-table --database-name MyTimeSeriesDB --table-name SensorData \
  --retention-properties MemoryStoreRetentionPeriodInHours=24,MagneticStoreRetentionPeriodInDays=365

To write a record:

aws timestream-write write-records --database-name MyTimeSeriesDB --table-name SensorData \
  --records '[{"Time":"2025-04-09T12:00:00Z","MeasureValueType":"DOUBLE","MeasureName":"temperature","MeasureValue":"23.5","Dimensions":[{"Name":"sensor_id","Value":"sensor-01"},{"Name":"location","Value":"warehouse-a"}]}]'

To query data (using the query endpoint):

aws timestream-query query --query-string "SELECT sensor_id, AVG(measure_value::double) AS avg_temp FROM \"MyTimeSeriesDB\".\"SensorData\" WHERE time BETWEEN '2025-04-09T00:00:00Z' AND '2025-04-09T23:59:59Z' GROUP BY sensor_id"

How Timestream Interacts with Related Technologies

AWS IoT Core: IoT rules can write directly to Timestream. This is a common exam scenario. You configure an IoT rule with a Timestream action, specifying the database, table, and dimensions.

Amazon Kinesis Data Streams: You can use Kinesis to ingest data into Timestream via a Lambda function or Kinesis Data Firehose.

AWS Lambda: Lambda can be used as a custom consumer to transform and write data to Timestream.

Amazon QuickSight: QuickSight can connect to Timestream as a data source for visualization.

Amazon SageMaker: Timestream can be used as a source for machine learning models.

AWS CloudFormation: You can provision Timestream resources using CloudFormation templates.

AWS SDKs: Timestream provides SDKs for Java, Python, Node.js, .NET, Go, and others.

Exam-Relevant Details

Timestream is serverless and auto-scaling — no need to provision capacity.

It supports multi-measure records (multiple measures in one record) to reduce write costs.

Data is encrypted at rest by default using AWS KMS. You can use your own KMS key.

Timestream is not a relational database; it does not support joins across tables (though you can query across tables using UNION ALL).

The service is optimized for time-based queries like "last 1 hour" or "this week." Queries without time filters are inefficient.

You can query data across multiple AWS accounts using cross-account access.

Scheduled queries can run every minute, hour, or day, and can write results to a destination table or S3.

Error handling: If a write fails due to throttling, Timestream returns a ThrottlingException. You should implement exponential backoff.

Important Defaults and Limits

Maximum write throughput: 10,000 records per second per table (can be increased by request).

Maximum record size: 8 KB.

Maximum query timeout: 60 seconds.

Maximum number of dimensions per table: 128.

Memory store retention period: default 24 hours.

Magnetic store retention period: default 365 days.

Data is automatically deleted after magnetic store retention period.

Common Use Cases

IoT sensor data monitoring

DevOps monitoring (e.g., CPU, memory metrics)

Real-time analytics dashboards

Industrial telemetry

Financial market data

Walk-Through

1

Create a Timestream Database

First, you create a database as a logical container. Use the AWS CLI, SDK, or CloudFormation. The database name must be unique per region. There is no capacity planning; Timestream scales automatically. The database does not incur charges until tables are created and data is written.

2

Create a Table with Retention Policy

Within the database, create a table. Specify the retention policy: `MemoryStoreRetentionPeriodInHours` (how long to keep data in memory for low-latency queries) and `MagneticStoreRetentionPeriodInDays` (how long to keep data in magnetic store before deletion). Defaults are 24 hours and 365 days. Data moves from memory to magnetic automatically after the memory retention period expires.

3

Write Data Records

Write records using the `WriteRecords` API. Each record includes a timestamp, measure name, measure value, measure value type, and dimensions. Dimensions are key-value pairs used for filtering and grouping. Timestream partitions data by time and dimensions. Write throughput is up to 10,000 records per second per table by default; you can request a limit increase.

4

Query Data with Time-Series Functions

Use the `Query` API with SQL-like syntax. Always include a time range filter to avoid scanning all partitions. Timestream supports functions like `AVG()`, `SUM()`, `MIN()`, `MAX()`, `COUNT()`, `SAMPLE_BY()`, and `DERIVATIVE()`. For example, `SELECT AVG(measure_value::double) FROM table WHERE time BETWEEN '2025-04-09T00:00:00Z' AND '2025-04-09T23:59:59Z' GROUP BY time_bin.`

5

Set Up Scheduled Queries (Optional)

Scheduled queries allow you to run queries periodically and store results in a destination table or S3. For example, you can compute hourly averages and store them in a separate table. This is useful for downsampling and reducing query costs. You define the query, schedule (e.g., every hour), and destination. The service handles execution and error handling.

What This Looks Like on the Job

Scenario 1: IoT Sensor Monitoring at a Smart Factory

A manufacturing plant has thousands of sensors collecting temperature, vibration, and pressure data every second. They need to monitor real-time conditions and analyze historical trends for predictive maintenance. They choose Timestream because it can ingest high-velocity data without provisioning capacity. They configure an AWS IoT Core rule to write sensor data directly to a Timestream table named SensorData. The retention policy is set to 24 hours for memory store (for real-time dashboards) and 365 days for magnetic store (for monthly reports). They use QuickSight to build dashboards that show current readings and hourly averages. A common issue they encounter is that queries without time filters are slow and expensive. They learn to always include a time range. They also set up a scheduled query to compute daily aggregates and store them in a separate table to reduce query costs.

Scenario 2: DevOps Monitoring for a Cloud Application

A SaaS company monitors CPU, memory, and disk usage for thousands of EC2 instances. They send metrics to Timestream via CloudWatch Logs subscription filters and Lambda. They use Timestream's built-in functions to detect anomalies (e.g., CPU > 90% for 5 minutes). They also use scheduled queries to generate weekly reports. A mistake they made was not setting an appropriate memory store retention period; they kept data in memory for 7 days, which increased costs. They optimized by reducing to 24 hours. They also learned that Timestream does not support JOIN operations, so they denormalize their dimensions (e.g., include instance type and region as dimensions) to avoid needing joins.

Scenario 3: Financial Market Data Analysis

A fintech startup ingests stock trade data at 1,000 records per second. They use Timestream to store trade prices and volumes. They query for moving averages and volatility. They use the SAMPLE_BY function to downsample from per-second to per-minute data. A challenge they faced was that Timestream's query timeout is 60 seconds, so complex queries over large time ranges (e.g., 1 year) would time out. They solved this by using scheduled queries to precompute daily summaries. They also had to request a throughput increase from 10,000 to 50,000 records per second.

How DVA-C02 Actually Tests This

DVA-C02 Objective Coverage

Timestream falls under Domain 1: Development, Objective 1.3: Implement data storage solutions. Specifically, the exam expects you to know when to use Timestream versus other storage services like DynamoDB, RDS, or S3. You should understand its serverless nature, retention policies, and integration with IoT Core and Kinesis.

Common Wrong Answers and Why Candidates Choose Them

1.

DynamoDB for time-series data: Candidates often choose DynamoDB because it's a NoSQL database. However, DynamoDB is not optimized for time-series queries; it lacks built-in time-based partitioning and aggregation functions. Timestream is the correct answer for high-write, time-based queries.

2.

RDS with TimescaleDB: While RDS can run TimescaleDB, it requires provisioning and managing servers. The exam emphasizes fully managed services. Timestream is serverless and auto-scaling.

3.

Amazon S3 with Athena: S3 is cheap storage, but Athena queries are not real-time and incur per-scan costs. Timestream provides real-time querying with built-in time-series functions.

4.

Kinesis Data Analytics: Kinesis Data Analytics processes streaming data but does not store historical data. Timestream stores both recent and historical data.

Specific Numbers and Terms on the Exam

Default memory store retention: 24 hours

Default magnetic store retention: 365 days

Maximum dimensions per table: 128

Maximum record size: 8 KB

Default write throughput: 10,000 records/second per table

Query timeout: 60 seconds

Timestream uses SQL (not NoSQL) for queries.

Edge Cases and Exceptions

The exam may ask about multi-measure records: You can include multiple measures in one record to reduce write costs.

If you need to update or delete data, you cannot — Timestream is append-only. You must write a new record with the corrected value.

Cross-account access: You can query Timestream across accounts using resource-based policies.

Encryption: By default, data is encrypted at rest with AWS KMS. You can use a customer-managed key.

How to Eliminate Wrong Answers

If the question mentions "real-time" and "historical" data with "time-based queries," Timestream is the answer.

If the question mentions "serverless" and "no provisioning," eliminate RDS and DynamoDB (provisioned capacity).

If the question mentions "built-in aggregation functions like AVG and SAMPLE_BY," it's Timestream.

If the question mentions "IoT Core" as a source, look for Timestream as the destination.

Key Takeaways

Amazon Timestream is a serverless, fully managed time-series database optimized for high-write, time-based queries.

It uses a two-tier storage model: memory store (default 24 hours) and magnetic store (default 365 days).

Data is append-only; you cannot update or delete records.

Always include a time range in queries to avoid full partition scans.

Timestream integrates directly with AWS IoT Core via IoT rules.

Default write throughput is 10,000 records/second per table; can be increased.

Maximum record size is 8 KB; maximum dimensions per table is 128.

Queries use SQL with built-in functions like AVG, SAMPLE_BY, and DERIVATIVE.

Scheduled queries can be used to precompute aggregates and reduce costs.

Data is encrypted at rest by default with AWS KMS; customer-managed keys are supported.

Easy to Mix Up

These come up on the exam all the time. Here's how to tell them apart.

Amazon Timestream

Optimized for time-series data with automatic time-based partitioning.

Built-in time-series functions like AVG, SAMPLE_BY, and DERIVATIVE.

Two-tier storage: memory and magnetic, with auto-tiering.

Serverless and auto-scaling; no capacity planning.

Append-only; no update or delete operations.

Amazon DynamoDB

General-purpose NoSQL database for key-value and document data.

No built-in time-series functions; requires application-level logic.

Single storage tier (SSD-based) with optional DynamoDB Accelerator (DAX) for caching.

Provisioned or on-demand capacity; requires throughput planning.

Supports update and delete operations.

Amazon Timestream

Fully managed serverless service; no server management.

Auto-scales writes and queries without intervention.

Built-in retention policies for automatic data lifecycle management.

SQL-like query language with time-series extensions.

No support for joins across tables.

Amazon RDS (with TimescaleDB)

Managed relational database; requires provisioning and scaling of instances.

Manual scaling or use of Aurora Auto Scaling.

Retention management requires manual deletion or partitioning.

Full SQL with joins, transactions, and constraints.

Supports complex relational queries.

Amazon Timestream

Real-time querying with sub-second latency for recent data.

Built-in time-series functions for aggregation.

Data is automatically indexed by time.

Pay-per-query cost model with no scanning of entire dataset.

Designed for high-frequency writes (up to 10K records/sec per table).

Amazon S3 + Athena

Query latency is seconds to minutes; not real-time.

No built-in time-series functions; requires manual SQL or external tools.

Data is not indexed; queries scan entire dataset unless partitioned.

Cost based on data scanned; full scans can be expensive.

Write throughput limited by S3 PUT limits (3,500 PUTs/sec per prefix).

Watch Out for These

Mistake

Timestream is a NoSQL database like DynamoDB.

Correct

Timestream uses SQL for queries and is specifically designed for time-series data. It is not a general-purpose NoSQL database.

Mistake

You can update or delete individual records in Timestream.

Correct

Timestream is append-only. You cannot modify or delete existing records. To correct data, you must write a new record with the same timestamp and dimensions.

Mistake

Timestream requires you to provision read and write capacity.

Correct

Timestream is serverless and auto-scales. There is no need to provision capacity; you pay for the data written, stored, and queried.

Mistake

Timestream stores data in a single storage tier.

Correct

Timestream uses a two-tier storage model: an in-memory store for recent data and a magnetic store for older data. Data moves automatically based on retention policy.

Mistake

Queries without a time filter are efficient.

Correct

Queries without a time filter scan all partitions, leading to high latency and cost. Always include a time range in your queries.

Do You Actually Know This?

Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.

Frequently Asked Questions

How does Timestream differ from DynamoDB for time-series data?

Timestream is purpose-built for time-series data with automatic time-based partitioning, built-in aggregation functions, and a two-tier storage model (memory and magnetic). DynamoDB is a general-purpose NoSQL database that lacks these features. For time-series workloads, Timestream offers better query performance and lower costs. However, if you need to update or delete records, DynamoDB may be more suitable. Exam tip: If the question mentions 'time-series' and 'serverless,' choose Timestream.

Can I use Timestream for real-time dashboards?

Yes, Timestream is designed for real-time querying of recent data stored in the memory store. You can achieve sub-second query latency for time ranges within the memory retention period. For older data in the magnetic store, queries may take longer but are still optimized. You can connect Timestream to QuickSight or Grafana for visualization. Exam tip: Timestream is ideal for both real-time and historical analysis.

How do I set up data retention in Timestream?

Retention is configured at the table level using two parameters: `MemoryStoreRetentionPeriodInHours` (how long data stays in memory, default 24 hours) and `MagneticStoreRetentionPeriodInDays` (how long data stays in magnetic store before deletion, default 365 days). Data moves from memory to magnetic automatically after the memory retention period. After the magnetic retention period, data is permanently deleted. You can set these values when creating the table or update them later.

What happens if a write request to Timestream fails?

If a write fails due to throttling (ThrottlingException) or other errors, you should implement exponential backoff and retry. Timestream does not provide built-in retry logic; it's your responsibility to handle failures. For high-throughput scenarios, consider using Kinesis Data Streams or Lambda to buffer writes. Exam tip: The exam may test error handling patterns.

Can I query Timestream data across multiple AWS accounts?

Yes, you can use resource-based policies to grant cross-account access to Timestream resources. For example, you can allow another account's IAM role to query your Timestream tables. This is useful for centralized monitoring across accounts. Exam tip: Cross-account access is a common scenario for enterprise architectures.

What is a multi-measure record in Timestream?

A multi-measure record allows you to send multiple measure values in a single record, reducing the number of write requests. For example, a sensor that reports temperature and humidity can send one record with both measures instead of two separate records. This reduces write costs and improves throughput. Exam tip: Multi-measure records are a cost-optimization feature.

How does Timestream handle data encryption?

Timestream encrypts data at rest by default using AWS KMS. You can choose to use the default AWS-managed key or a customer-managed key (CMK). Data in transit is encrypted using TLS. Exam tip: The exam may ask about encryption options; remember that customer-managed keys are supported.

Terms Worth Knowing

Ready to put this to the test?

You've just covered Amazon Timestream for Time-Series Data — now see how well it sticks with free DVA-C02 practice questions. Full explanations included, no account needed.

Done with this chapter?