Kinesis, Athena, Glue, Redshift & OpenSearch
Match a streaming or analytics requirement to the right service.
By Invicly Tech, , in AWS Solutions Architect – Associate. About 13 minutes to read.
In short
AWS analytics services cover ingesting streams, storing data cheaply in S3, cataloging it and querying it. Kinesis Data Streams handles real-time streams, Firehose delivers them to destinations, Glue catalogs and transforms, and Athena queries S3 with SQL. Redshift is the data warehouse and OpenSearch handles search and log analytics.
Explained simply
Analytics means asking questions of large amounts of data: how many users signed up per country last month, which pages are slow, what is selling right now. On AWS, the usual pattern is to collect data, store it cheaply in S3 (a data lake), describe it in a catalog, and query it with the tool that fits.
Some data arrives as a stream: clicks, sensor readings, log lines, thousands per second. Kinesis Data Streams captures these events and lets several programs read them in real time. Amazon Data Firehose is simpler: it collects a stream and delivers it in batches to S3, Redshift, OpenSearch and other places, with no code to run.
Once data sits in S3, a Glue crawler works out the columns and records them as tables in the Glue Data Catalog. Athena then lets you run SQL straight on the files. You pay for the data each query scans, so storing data in a compact, column-based format makes queries both cheaper and faster.
For heavy, repeated business reporting, Redshift is a data warehouse built for complex SQL over billions of rows. For searching text and exploring logs, OpenSearch indexes documents so you can search them and build dashboards in near real time. Choosing between them depends on the question you want to ask.
Press Play on a diagram to walk through it one step at a time.
- 1Producers
Apps, IoT devices and clickstreams send events.
- 2Kinesis Data Streams
Real-time stream with shards and replay.
- 3Firehose
Buffers, converts and delivers to S3.
- 4S3 data lake
Cheap durable storage, e.g. Parquet files.
- 5Glue Data Catalog
Crawlers record table schemas.
- 6Athena
Serverless SQL, pay per data scanned.
- Ad hoc SQL on S3
- Serverless, no loading
- Pay per TB scanned
- Columnar data warehouse
- Complex BI joins at scale
- Spectrum queries S3 too
- Full-text search
- Log analytics dashboards
- Near real-time indexing
- Ad hoc SQL on files in S3
- Athena
- Daily BI on structured history
- Redshift
- Full-text search and log dashboards
- OpenSearch Service
- Custom Spark or Hadoop jobs
- EMR
- Glue ETL for serverless Spark
- Real-time processing of a stream
- Managed Service for Apache Flink
- Lambda for simple per-record logic
- Business dashboards
- QuickSight
- 1Consumers
Athena, Redshift Spectrum, EMR, QuickSight
- 2Governance
Lake Formation column and row permissions
- 3Catalog
Glue Data Catalog tables and partitions
- 4Curated zone
Cleaned, partitioned Parquet
- 5Raw zone
Original JSON and CSV as delivered
- 6Ingestion
Firehose, DataSync, DMS, batch uploads
In depth
Kinesis Data Streams: shards and ordering
A stream is made of shards. In provisioned mode each shard accepts up to 1 MB per second or 1,000 records per second of writes, and serves up to 2 MB per second of reads shared by all standard consumers. On-demand mode adds and removes shards for you. Each record has a partition key: records with the same key go to the same shard and stay in order. A key such as deviceId keeps each device's events in order while spreading load.
Data is kept for 24 hours by default and up to 365 days, so consumers can replay it. Enhanced fan-out gives each registered consumer its own 2 MB per second per shard, pushed over HTTP/2, which suits many readers that need low latency. Consumers include Lambda, the Kinesis Client Library (KCL) on EC2 or containers, Amazon Managed Service for Apache Flink, and Firehose.
Firehose: delivery without code
Amazon Data Firehose (formerly Kinesis Data Firehose) receives records directly from producers or from a Kinesis stream and delivers them to S3, Redshift, OpenSearch, Splunk, Snowflake, HTTP endpoints and more. It buffers records by size and time and writes them in batches, so delivery is near real time (seconds to minutes) rather than instant. It scales by itself and has no shards to manage.
On the way it can call a Lambda function to transform records, convert JSON to Parquet or ORC using a schema from the Glue Data Catalog, compress files, and build S3 paths from values inside the records (dynamic partitioning). Failed records go to an S3 error prefix. Firehose cannot replay data or feed several custom consumers; that is what Data Streams is for. Delivery to Redshift works by writing to S3 first and then running a COPY command.
- Real time, well under a second
- Many consumers, replay up to 365 days
- Shards, or on-demand mode
- You write or choose the consumers
- Near real time, buffered batches
- Delivers to S3, Redshift, OpenSearch and more
- Fully managed, no shards
- Transforms and converts to Parquet
Making Athena fast and cheap
Athena is serverless SQL based on the Trino engine. It reads files in S3 using table definitions from the Glue Data Catalog and charges for the data scanned, with a 10 MB minimum per query, so the main lever is scanning less. Three habits matter most. Use a columnar format such as Parquet, so a query reading 3 of 50 columns skips the rest. Compress the files. Partition the data by the columns you filter on, for example s3://logs/dt=2026-11-05/, so a WHERE on date skips whole folders.
Avoid millions of tiny files; aim for files of roughly 128 MB or larger. Partition projection lets Athena calculate partition locations from a pattern instead of looking them up. Workgroups separate teams, keep query results apart, and can cap the data scanned per query to stop runaway costs. CREATE TABLE AS SELECT (CTAS) turns raw CSV or JSON into partitioned Parquet in one statement.
- 1Raw CSV
Every query reads every byte
- 2Convert to Parquet
Read only the columns you select
- 3Compress
Fewer bytes stored and scanned
- 4Partition by date
WHERE dt skips other days
- 5Right-size files
Fewer, larger files read faster
Glue: catalog and ETL
The Glue Data Catalog is a central list of databases, tables, columns and partition locations, shared by Athena, Redshift Spectrum, EMR and Glue jobs. A crawler scans an S3 path, guesses the format and schema, and creates or updates tables. Schedule crawlers, or add partitions yourself to avoid crawling huge buckets again and again.
Glue ETL (extract, transform, load) jobs run serverless Apache Spark, or plain Python, to clean, join and convert data, for example raw JSON into partitioned Parquet. Job bookmarks remember what was already processed, so each run handles only new files. Glue DataBrew offers a visual way to clean data without code. AWS Lake Formation builds on the catalog to grant fine-grained permissions, down to columns and rows, across these services.
Redshift, OpenSearch, or something else?
Redshift is a columnar, massively parallel data warehouse. It shines when analysts run complex joins and aggregations over large, structured history every day, with BI tools connected over JDBC or ODBC. RA3 nodes separate compute from managed storage, Redshift Serverless removes cluster sizing, Spectrum queries data in S3 without loading it, and zero-ETL integrations copy data from Aurora or DynamoDB automatically.
OpenSearch Service is a search engine. It builds inverted indexes over documents, so full-text search, fuzzy matching and log exploration return in milliseconds, with OpenSearch Dashboards for charts. It is not built for large SQL joins. Other common exam answers: EMR for running your own Spark or Hadoop at scale, Managed Service for Apache Flink for real-time processing of streams, and QuickSight for business dashboards on top of any of them.
Learn it in 5 short steps
About 50m each. Track them with a timer in your plan.
- 1Ingest streams with Kinesis Data Streams~50m
- 2Deliver data with Firehose~50m
- 3Query S3 with Athena~50m
- 4Catalogue and transform data with Glue~50m
- 5Choose Redshift or OpenSearch for analytics~50m
Key points
- Kinesis Data Streams is real-time with replay; Firehose is near real-time and fully managed.
- Partition and compress S3 data as Parquet to cut Athena cost and time.
- Glue crawlers populate the Data Catalog used by Athena, EMR and Redshift Spectrum.
- Use Redshift for structured BI reporting across large historical datasets.
Key terms
Tap a card to flip it. 0/6 known
Examples
From JSON logs to cheap Athena queries
A crawler created the table raw_logs over JSON files, and every query scans all of them. Step 1: run one CTAS statement that writes compressed Parquet to a new S3 location, partitioned by the day column dt (partition columns must come last in the SELECT; one CTAS can create up to 100 partitions, so convert large histories in batches). Step 2: query the new table. Filtering on dt and naming only a few columns now scans a small fraction of the data.
CREATE TABLE logs_parquet
WITH (
format = 'PARQUET',
write_compression = 'SNAPPY',
external_location = 's3://my-logs/curated/',
partitioned_by = ARRAY['dt']
) AS
SELECT request_id, status, latency_ms, path, dt
FROM raw_logs;
-- Scans one day and three columns instead of everything
SELECT path, avg(latency_ms) AS avg_ms FROM logs_parquet
WHERE dt = '2026-11-05' AND status >= 500
GROUP BY path;Designing a clickstream pipeline
A shop wants fraud checks on checkout clicks within a second, plus all clicks stored for later SQL analysis. Step 1: send events to Kinesis Data Streams with sessionId as the partition key, so each session stays in order. At 5,000 events per second of 1 KB, that needs at least 5 shards in provisioned mode, or on-demand mode if traffic is unpredictable. Step 2: a Lambda consumer runs the fraud rules in real time. Step 3: Firehose reads the same stream, converts to Parquet and writes to S3 every few minutes. Step 4: a Glue table and Athena serve the analysts.
import boto3, json
kinesis = boto3.client("kinesis")
event = {"sessionId": "s-81", "page": "/checkout", "ts": "2026-11-05T10:15:02Z"}
kinesis.put_record(
StreamName="clicks",
Data=json.dumps(event).encode(),
PartitionKey=event["sessionId"], # same session, same shard, same order
)Quick reference
- Kinesis shard: 1 MB/s or 1,000 records/s in; 2 MB/s out, shared by standard consumers
- Kinesis retention: 24 hours by default, up to 365 days; consumers can replay
- Firehose: buffered, near real time, no replay; converts to Parquet and delivers to S3
- Athena bills per data scanned (10 MB minimum); Parquet plus partitions cuts cost and time
- Glue crawlers fill the Data Catalog used by Athena, EMR and Redshift Spectrum
- Lake Formation: column and row level permissions on the data lake
- Redshift for BI and complex joins; OpenSearch for full-text search and log dashboards
- Real-time processing of streams: Amazon Managed Service for Apache Flink
Common mistakes
- Picking Kinesis Data Streams when the requirement is just loading data into S3 with no code.
- Querying uncompressed CSV with Athena and paying to scan every byte.
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
Upload a small CSV to S3, create an Athena table over it, and run a GROUP BY. Note the Data scanned value.
- Exercise 2medium
Create an on-demand Kinesis stream, write 10 records with the same partition key, and read them back in order from their shard.
- Exercise 3hard
Create a Firehose stream that delivers JSON records to S3 with a 60-second buffer and GZIP compression, send a test record, and plan how to query it with Athena.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- Is Kinesis Data Firehose the same as Amazon Data Firehose?
- Yes. AWS renamed Kinesis Data Firehose to Amazon Data Firehose in 2024; it is the same service. Kinesis Data Analytics was similarly renamed Amazon Managed Service for Apache Flink.
- Athena or Redshift: which should I use?
- Use Athena for occasional or exploratory SQL directly on S3 with no infrastructure. Use Redshift when many users run heavy, repeated reports and dashboards that need consistently fast performance.
- Do I need Glue to use Athena?
- Athena stores its table definitions in the Glue Data Catalog, but you can create tables with plain DDL in Athena. Crawlers are just one convenient way to fill the catalog.
- Why is my Athena query so expensive?
- It probably scans whole uncompressed text files. Convert to Parquet, compress, partition by the columns you filter on, and select only the columns you need.