From CSV to Dashboard Without Managing Servers: A Serverless Pipeline with S3, Glue, Athena, and QuickSight
Learn how to turn a raw CSV into an interactive dashboard using only managed AWS services. A step-by-step tutorial with Amazon S3, AWS Glue, Amazon Athena, and Amazon QuickSight, including Parquet optimization, security, and cost control.
Many data projects start the same way: a CSV file, a question, and no clear idea of where to host everything. Spinning up a server or a cluster is often overkill, especially for beginners.
In this tutorial you will go from a raw CSV to an interactive dashboard using only managed AWS services:
- Amazon S3 to store the data
- AWS Glue to catalog it
- Amazon Athena to query it with SQL
- Amazon QuickSight to visualize it
There are no servers to provision, patch, or shut down, and you only pay for what you use.
Prerequisites: an AWS account, the AWS CLI configured, and basic SQL knowledge.
Example data
Create a file called
sales.csv :order_id,customer_id,order_date,region,product_category,amount
1001,C-204,2024-01-15,north,electronics,249.90
1002,C-117,2024-02-03,south,books,18.50
1003,C-204,2024-02-21,east,home,89.00
1004,C-330,2025-01-09,north,books,32.75Architecture
- The CSV is uploaded to the
raw/zone in Amazon S3.
- An AWS Glue crawler infers the schema and registers the table in the Data Catalog.
- Amazon Athena queries it and uses CTAS to write Parquet files to the
curated/zone.
- Amazon QuickSight reads the curated table and publishes the dashboard.
Step 1: Create the bucket and upload the data
Bucket names are globally unique, so replace
my-sales-pipeline-demo with your own.aws s3 mb s3://my-sales-pipeline-demo --region us-east-1
aws s3 cp sales.csv s3://my-sales-pipeline-demo/raw/sales/sales.csvKeep Block Public Access enabled and turn on bucket encryption.
Step 2: Catalog the data with AWS Glue
- Create a Glue database named
db_sales.
- Create a crawler pointing to
s3://my-sales-pipeline-demo/raw/sales/, with an IAM role that has theAWSGlueServiceRolepolicy and read access to the bucket.
- Set the target database to
db_salesand the table name prefix toraw_.
- Run the crawler. It creates the table
raw_sales.
Check the inferred types: dates often end up as
string .Step 3: Query with Athena
Set the query result location to
s3://my-sales-pipeline-demo/athena-results/ , then run:SELECT COUNT(*) AS total_rows,
COUNT(DISTINCT order_id) AS unique_orders
FROM db_sales.raw_sales;Step 4: Convert to Parquet with CTAS
Parquet is columnar and compressed, so Athena scans far less data, and you pay for data scanned.
CREATE TABLE db_sales.curated_sales
WITH (
format = 'PARQUET',
parquet_compression = 'SNAPPY',
external_location = 's3://my-sales-pipeline-demo/curated/sales/',
partitioned_by = ARRAY['year']
) AS
SELECT
order_id,
customer_id,
CAST(order_date AS DATE) AS order_date,
TRIM(UPPER(region)) AS region,
TRIM(UPPER(product_category)) AS product_category,
CAST(amount AS DOUBLE) AS amount,
year(CAST(order_date AS DATE)) AS year
FROM db_sales.raw_sales
WHERE order_id IS NOT NULL;The partition column must come last, and
external_location must be empty.Compare Data scanned for the same query on both tables:
SELECT region, SUM(amount) FROM db_sales.raw_sales GROUP BY region;
SELECT region, SUM(amount) FROM db_sales.curated_sales
WHERE year = 2024 GROUP BY region;With a tiny file the difference is small, but it grows with data size.
Step 5: Visualize with QuickSight
- Sign up for QuickSight and grant access to S3 and Athena, including your bucket.
- Create a dataset from Athena:
db_sales, thencurated_sales. Use SPICE for speed or Direct Query for live data.
- Build a KPI with total sales, a line chart by month, a bar chart by region, and a chart by product category, plus filters.
- Publish and share the dashboard.
Security and costs
- Use least-privilege IAM roles and avoid the root user.
- Anonymize personal data before moving it to
curated/.
- Athena charges per data scanned, and QuickSight per user and SPICE capacity. Create an AWS Budget alert and check current pricing.
Cleanup
aws s3 rm s3://my-sales-pipeline-demo --recursive
aws s3 rb s3://my-sales-pipeline-demoThen delete the crawler, the
db_sales database, and the QuickSight datasets and dashboard.Next steps
Automate ingestion with Amazon EventBridge and AWS Lambda, use AWS Glue jobs for transformations, and define everything with AWS CloudFormation or Terraform.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article