⚡0 XP🔥0

AWS for Data Analysts (S3, Glue, Athena, Redshift, QuickSight)

Lesson 2 of 4 ⏱ 5 min read ❓ 5-question quiz

The AWS analytics services an analyst uses - S3 for storage, Glue Data Catalog and crawlers, Athena for serverless SQL on files, Redshift for warehousing, QuickSight for dashboards - with a step-by-step Athena walkthrough on the Vindhya Mart CSV.

AWS analytics services map#

Need AWS service Analyst's view
Store files (data lake) Amazon S3 buckets and folders of CSV/Parquet
Catalog / schemas AWS Glue Data Catalog (+ crawlers) table definitions over files
Prepare/transform data AWS Glue (jobs, DataBrew, Studio) visual or Spark ETL
SQL on files (serverless) Amazon Athena write SQL, pay per data scanned
Data warehouse Amazon Redshift (provisioned or serverless) fast SQL on large modelled tables
Relational databases Amazon RDS / Aurora (MySQL, PostgreSQL...) application databases you query
Dashboards Amazon QuickSight BI similar to Power BI
Notebooks / ML SageMaker Python notebooks, machine learning
हिंदी में समझें

AWS पर data analyst के मुख्य tools:

  • S3 = files रखने की जगह (data lake) - जैसे Google Drive, लेकिन बहुत बड़े पैमाने पर
  • Glue = files में कौन-से columns हैं, यह catalog में दर्ज करना और data साफ़ करना
  • Athena = S3 में रखी files पर सीधे SQL चलाना - कोई database server नहीं
  • Redshift = बड़ा data warehouse
  • QuickSight = dashboard बनाने का tool

आपने जो SQL सीखा है, वही Athena और Redshift में काम आता है।

Amazon S3 essentials#

  • Bucket: a globally unique container, e.g. vindhya-mart-data-<yourname>, created in a region such as Asia Pacific (Mumbai) ap-south-1.
  • Object: a file; its "path" is a key, e.g. raw/sales/sales.csv.
  • Prefixes act like folders: raw/, clean/, curated/.
  • Storage classes: Standard (frequent access), Infrequent Access, Glacier (archive) - cheaper for old data.
  • Block Public Access: keep ON for private data (the default for new buckets).

Typical layout:

s3://vindhya-mart-data/
   raw/sales/            ← exports as received
   clean/sales/          ← cleaned CSV / Parquet
   curated/sales_monthly/
   athena-results/       ← Athena query outputs

Walkthrough - query sales.csv with Athena#

Common Mistake

Use a free-tier/learning account with a budget alert (Billing → Budgets). Small CSVs cost very little to store and query, but always clean up afterwards.

1. Upload the data#

  1. Open the S3 console → Create bucket (region Mumbai, Block Public Access ON).
  2. Create folder raw/sales/ and upload sales.csv.
  3. Create folder athena-results/.

2. Set up Athena#

  1. Open Athena → Query editor → Settings → Query result location = s3://<your-bucket>/athena-results/.
  2. Create a database:
CREATE DATABASE vindhya_mart;

3. Create a table over the CSV#

CREATE EXTERNAL TABLE vindhya_mart.sales (
  order_id      string,
  order_date    date,
  region        string,
  state         string,
  city          string,
  customer_id   string,
  segment       string,
  category      string,
  sub_category  string,
  product       string,
  quantity      int,
  unit_price    double,
  discount      double,
  sales         double,
  cost          double,
  profit        double,
  payment_mode  string
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
LOCATION 's3://<your-bucket>/raw/sales/'
TBLPROPERTIES ('skip.header.line.count' = '1');

(Alternatively, run a Glue crawler on raw/sales/ to detect columns automatically.)

Did you know?

This simple CSV has no commas inside values. For CSVs with quoted text containing commas, use ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde' (which reads every column as string - cast them in queries or a view).

4. Query with standard SQL#

SELECT region,
       ROUND(SUM(sales), 2)  AS sales,
       ROUND(SUM(profit), 2) AS profit,
       COUNT(*)              AS orders
FROM vindhya_mart.sales
WHERE year(order_date) = 2025
GROUP BY region
ORDER BY sales DESC;
Check your result

2025 sales by region: North ≈ 12,24,914.50 · West ≈ 12,22,676.80 · East ≈ 10,48,468.85 · South ≈ 10,37,129.45 · Central ≈ 8,58,346.45 - the same numbers as your Excel, SQL and pandas analyses. Athena also shows data scanned for each query.

Athena uses the Trino/Presto SQL dialect - almost everything you learned works. Date functions differ slightly from SQLite: year(d), month(d), date_trunc('month', d), date_diff('day', d1, d2), date_format(d, '%Y-%m').

5. Convert to Parquet (CTAS)#

CREATE TABLE vindhya_mart.sales_parquet
WITH (format = 'PARQUET',
      external_location = 's3://<your-bucket>/clean/sales_parquet/',
      partitioned_by = ARRAY['year'])
AS
SELECT *, year(order_date) AS year
FROM vindhya_mart.sales;

Run the same region query on sales_parquet filtered by year = 2025 and compare data scanned - much less.

6. Visualise#

  • QuickSight: New dataset → Athena → choose the table → build a bar chart of sales by region.
  • Power BI: Get data → Amazon Athena connector (needs the Athena ODBC driver and a DSN), or connect to Amazon Redshift directly.

7. Clean up#

Delete the Athena tables you don't need, empty and delete the bucket if it was only for practice.

Amazon Redshift in one minute#

  • A columnar data warehouse for large structured data; Redshift Serverless removes cluster management.
  • Load data from S3 with COPY, model star schemas, query with SQL (PostgreSQL-like dialect).
  • Redshift Spectrum queries S3 files directly from Redshift.
  • Power BI and Tableau connect natively.

Summary#

  • S3 stores the data lake; Glue catalogs and transforms; Athena runs serverless SQL on S3 files; Redshift is the warehouse; QuickSight builds dashboards.
  • Your SQL skills transfer directly to Athena (Trino) and Redshift.
  • Use Parquet + partitions to cut cost; keep buckets private; set budget alerts; clean up practice resources.

Quick Quiz

Q1.

What is Amazon S3?

Q2.

Amazon Athena lets you...

Q3.

What does an AWS Glue crawler do?

Q4.

Which AWS service is the BI dashboard tool?

Q5.

Athena returns "Access Denied" on your S3 data. The most likely cause is...