Ravindra BagaleCourses & study guides मराठी Track your progress

AWS Cloud

What Is Amazon Redshift? Data Warehouse on AWS Explained

Your app database (RDS/DynamoDB) answers single-customer lookups fast. The CFO asks for last year sales by city and product — that is analytics. Amazon Redshift is AWS cloud data warehouse: columnar storage, massively parallel queries, great at scanning large fact tables.

In this chapter

  • Why warehouses differ from OLTP
  • What Redshift clusters / Serverless / Spectrum are
  • How data lands with COPY and distribution styles
  • Industries using Redshift
  • Lab, errors, FAQ, interview

1. Everyday example first

A Surat textile marketplace dumps daily order Parquet into S3. A Glue job lands cleaned facts; Redshift COPY or Spectrum queries power Metabase dashboards for sellers. RDS MySQL stays for checkout — not for last-365-days GROUP BY.

2. Why Redshift?

Row stores excel at transactions. Columnar warehouses compress and scan only needed columns for BI. Redshift adds MPP parallelism and AWS integrations (S3, IAM, Spectrum).

  • Fast aggregations on large history
  • Separate analytics load from OLTP
  • Spectrum to query S3 without full ingest
  • RA3 / Serverless options for modern sizing

3. What is Amazon Redshift?

A checkout database handles everyday orders as they happen. A warehouse keeps a prepared copy for questions such as total sales by store for the last year. Redshift arranges data for analytics so a query can process many rows and needed columns together. COPY can bulk-load prepared files from S3 into the warehouse. With Spectrum you can query some data in S3 without loading it into a local Redshift table. Start with the user’s question: immediate updates for checkout or repeated analysis of many orders.

Redshift is a managed PostgreSQL-compatible warehouse. Classic clusters use leaders and compute nodes; RA3 separates storage; Serverless measures RPU. Distribution styles (KEY, ALL, EVEN) and sort keys shape performance. COPY loads from S3 efficiently.

PiecePlain job
Leader nodePlan/coordinate queries
Compute nodesStore data and run slices
RA3Managed storage; scale compute separately
ServerlessAuto capacity in RPUs
COPYBulk load from S3 (and friends)
SpectrumQuery external S3 tables
Bring data to an analytics workloadSource data: Files or exported operational records; Load or external query: COPY and Spectrum serve different needs; Redshift query: Processes the selected analytics data; BI result: Shows a report based on query outputSource dataFiles or exported operational recordsLoad or external queryCOPY and Spectrum serve differentneedsRedshift queryProcesses the selected analytics dataBI resultShows a report based on query output
Dashboards & SQL analysts

4. How to load and model simply

Use three rows for a first model: store A has amounts 20 and 35, and store B has 45. First verify the table contains three rows after the load, then group the amounts by store. The report should show 55 and 45. If the file and table columns disagree, fix the schema or mapping before blaming the query. Once the answer matches, consider which columns the real reports frequently filter or join. That gives a reason to measure sort and distribution choices on larger data.

  1. Keep OLTP for transactions; warehouse for analytics.
  2. Land Parquet/CSV in S3 with clear prefixes/dates.
  3. Create schemas/tables with distkey/sortkey thoughtfully (start EVEN + time sort).
  4. Associate a role that can read the lab prefix, then run COPY. For the Parquet example below, put the input in the same Region and match the table’s column count and order to the file. Confirm the loaded row count before you run the report.
  5. Use Spectrum/external schemas for rarely used cold data.
  6. Vacuum/analyze as needed on provisioned; understand Serverless behaviors.
  7. WLM / concurrency scaling for bursty BI.
  8. Encrypt with KMS; restrict network (private).
  9. CI for SQL migrations; never hot-fix prod casually.
  10. Monitor STL/SVL tables for slow queries.
-- Mental COPY
-- COPY sales FROM 's3://bucket/facts/sales/'
-- IAM_ROLE 'arn:aws:iam::111122223333:role/RedshiftLoad'
-- FORMAT AS PARQUET;

5. Redshift vs RDS vs Athena

ChoiceWhen
RDS/AuroraOLTP app traffic
RedshiftRepeated BI on large curated warehouse
AthenaAd-hoc SQL on S3 lake; pay per query
Glue ETLTransform/catalog before warehouse

6. Multi-industry notes

Retail chains warehouse POS facts nightly. Insurers run actuarial SQL with concurrency scaling during month-end. Gaming studios analyze event aggregates without touching the live player DB.

7. Industries and roles

  • Retail/ecommerce analytics
  • Fintech ledgers & risk marts
  • Healthcare cohort reporting (with privacy controls)
  • AdTech click aggregates
  • Data engineers / analysts / BI developers

8. Lab: Serverless or tiny cluster + COPY mindset

For the paper version, mark the S3 object path, table columns and two store totals. In a sandbox, confirm the role can read the exact input and compare the loaded row count with the file before querying. After the lab, confirm the resources you own are removed, including the disposable namespace or separate snapshots if you no longer need them.

Do this in ap-south-1 (Mumbai) unless your org forbids it. Set a budget alert first.

  1. Create Redshift Serverless workgroup (or tiny cluster if Serverless unavailable).
  2. Create IAM role for S3 read; associate to namespace/cluster.
  3. Upload a tiny CSV/Parquet sample to S3.
  4. CREATE TABLE then COPY; run a GROUP BY query.
  5. Optional: create external schema for Spectrum on the same prefix.

Cleanup (stop billing)

  1. Delete the lab Serverless workgroup, then review and remove the lab namespace and any unnecessary snapshots. For a provisioned cluster, delete the lab cluster after deciding whether to retain a final snapshot. Remove only the lab S3 objects.
  2. Detach IAM roles you created only for lab.

9. Common errors and fixes

Each row is a real mistake students and juniors hit. Read the fix before you panic.

Error / symptomFix
Ran heavy reports on RDS and melted appMove analytics to warehouse/lake.
COPY without IAM roleAssociate role; trust redshift.amazonaws.com.
Wrong distkey causing redistribution stormsStart EVEN; evolve with evidence.
Selected * on huge fact dailyProject columns; aggregate early.
Publicly reachable warehousePrivate subnets + SG.
No compression/encoding awarenessLet COPY analyze or set encodings.
Spectrum over millions tiny filesCompact files; partition wisely.
Forgot vacuum on provisioned after mass deletesSchedule maintenance.
Shared superuser for all analystsRoles/groups least privilege.
Cost shock leaving cluster 24x7 idleRA3/Serverless/pause strategies.

10. Troubleshooting checklist

  1. COPY error: access denied S3 — role/bucket policy.
  2. Queue wait: WLM slots / concurrency.
  3. Slow join: skew on dist keys — check SVV.
  4. Disk full on dense nodes: archive/resize/RA3.
  5. SSL required failures: force encryption settings.
  6. Spectrum: Glue catalog permissions.

11. FAQ

Q. Postgres compatible?

SQL flavor similar; not every PG extension.

Q. Redshift vs Snowflake?

Both warehouses; evaluate lock-in/cost/skills.

Q. Serverless vs provisioned?

Variable vs steady workloads.

Q. Need ETL?

Usually yes — Glue/dbt/etc.

Q. Row-level security?

Features exist; design carefully.

Q. Backup?

Snapshots / recovery features — enable.

12. Interview Q&A

Q. What is Redshift?

AWS managed columnar MPP data warehouse.

Q. Columnar benefit?

Read only needed columns; better compression for BI.

Q. COPY?

Bulk parallel load typically from S3.

Q. Distkey?

How rows are placed across nodes to reduce reshuffle.

Q. Spectrum?

Query S3 external tables from Redshift.

Q. OLTP vs warehouse?

Transactions vs analytical scans.

13. Tips in English, Marathi and Hindi

Ravindra Bagale's Tip (EN)

Do not just point Metabase at RDS. Warehouses exist so checkout stays fast while finance scans history.

Ravindra Bagale's Tip (MR)

Metabase थेट RDS ला नका. Checkout जलद राहू द्या; finance warehouse स्कॅन करो.

Tip (HI)

Metabase सीधे RDS पर मत लगाओ — checkout तेज रहे, history warehouse स्कैन करे।

Try at home

  1. Write one query that belongs on RDS and one on Redshift.
  2. Explain KEY vs EVEN dist in two lines.
  3. List S3 landing folder naming for daily sales.

In short

  1. Redshift = analytics warehouse, not app OLTP.
  2. COPY/Spectrum from S3 are core patterns.
  3. Dist/sort keys and WLM shape speed.
  4. Keep it private and encrypted.

Revision, interview and comparison cards

Revise this lesson in a few minutes. Save the cards on your phone or download them as PNG files. The QR code on each card opens this lesson.

Revision card: What is Amazon Redshift?. OLTP databases choke on heavy analytic joins across years of facts. Redshift is a managed columnar data warehouse for BI and complex SQL at scale. Launch cluster or Serverless → COPY from S3 → model tables with DIST/SORT keys → connect BI. Nightly sales facts land via COPY; Looker dashboards query Redshift all day.
Revision card: What is Amazon Redshift? · Download PNG · Open card page
Revision card: DISTKEY and SORTKEY. Wrong distribution causes broadcast joins and slow scans. DISTKEY co-locates join keys across nodes; SORTKEY orders data for zone-map pruning on filters. DIST on common join key; SORT on frequent filter (date); ANALYZE after load. orders DIST customer_id SORT order_date cuts join+filter time sharply.
Revision card: DISTKEY and SORTKEY · Download PNG · Open card page
Comparison: Amazon Redshift vs Amazon Athena. Amazon Redshift: Managed warehouse; heavy joins/concurrency/BI. Amazon Athena: Serverless SQL over S3; pay per scan.
Comparison: Amazon Redshift vs Amazon Athena · Download PNG · Open card page
Comparison: Amazon Redshift vs Amazon RDS/Aurora. Amazon Redshift: Columnar analytics at scale. Amazon RDS/Aurora: Row-store transactions and apps.
Comparison: Amazon Redshift vs Amazon RDS/Aurora · Download PNG · Open card page
Interview card: Redshift in one sentence?. Managed columnar warehouse for analytics/BI, not OLTP transactions. Use RDS/Aurora for OLTP; Redshift for warehouse. COPY from S3 then BI tools connect.
Interview card: Redshift in one sentence? · Download PNG · Open card page
Interview card: What does DISTKEY do?. Co-locates rows with the same key on the same node to speed joins. Pick a high-cardinality join key used often. fact and dim both DIST on customer_id.
Interview card: What does DISTKEY do? · Download PNG · Open card page
Interview card: What does SORTKEY do?. Physically orders data so zone maps skip irrelevant blocks on filter columns. Time columns are common sort keys. WHERE order_date = today skips old blocks.
Interview card: What does SORTKEY do? · Download PNG · Open card page
Interview card: What is Redshift Spectrum?. Query S3 data lake tables from Redshift SQL without loading everything. Great for cold history; hot stays in local tables. SELECT from spectrum schema for 2019 logs.
Interview card: What is Redshift Spectrum? · Download PNG · Open card page

More cards: Ravi Sir's Cards.

Practise this chapter

Interview questions and answers

When would you use COPY instead of querying a file through Spectrum?

Use COPY when the data should be loaded into a Redshift table for repeated warehouse use and modeling. Spectrum can query supported external S3 data without loading it locally. Check file schema, query needs and expected load results before choosing.

Check your understanding

Choose an answer, then compare your reasoning with the explanation.

0 of 3 answered correctly
1. Which workflow is the best fit for a data warehouse?

Answer and explanation

B. Summarising many stores’ sales over a year

A warehouse is designed for analytical queries over larger curated data sets.

2. What is the first verification after loading the three-row sample with COPY?

Answer and explanation

C. Confirm the expected rows and columns were loaded before aggregating

Validate inputs before debugging calculated results. The loaded row count gives a clear check.

3. In Redshift Serverless, what does deleting only a workgroup leave behind?

Answer and explanation

B. The namespace that holds database objects and associated data

Compute and database storage entities have separate lifecycles. Review remaining lab resources before cleanup.

Practice Tasks

Practice checks run in your browser. They check the answer for this exercise; they do not create resources or connect to your AWS account.

About this scenario

Ahmednagar Sugar Co-op is a sugar co-operative business in Ahilyanagar. Balasaheb Pawar looks after its IT and cloud work. They count money in INR and run their AWS resources in the ap-south-1 Region. In the tasks below you do real jobs for them using what this lesson teaches. All names, account IDs, IP addresses and numbers are made up for practice.

0 / 16

Easy Describe Redshift clusters

Warehouse list.

Describe clusters.

  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Easy Describe parameter groups

WLM/settings.

Describe cluster parameter groups.

  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Easy Describe tags

Cost/owner.

Describe tags for arn:aws:redshift:ap-south-1:131959625285:cluster:nagarsugar-dw.

  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Easy Apply the lesson: scenario 4

A query reads three columns from a wide analytics table. Which storage organization helps avoid reading unrelated columns: columnar or row-oriented?

  1. Read the situation and identify what you need to decide.
  2. Work through the relevant concept or calculation.
  3. Enter only the requested term or number.
  4. Check your answer, then read the explanation.

Easy Apply the lesson: scenario 5

Which workload best matches Redshift's main purpose: large analytical scans or frequent small OLTP transactions?

  1. Read the situation and identify what you need to decide.
  2. Work through the relevant concept or calculation.
  3. Enter only the requested term or number.
  4. Check your answer, then read the explanation.

Medium Describe one cluster

Inspect size.

Describe cluster nagarsugar-dw.

  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Medium Describe snapshots

Backup points.

Describe cluster snapshots.

  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Medium Describe security groups

Network access.

Describe cluster security groups.

  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Medium Describe subnet groups

VPC placement.

Describe cluster subnet groups.

  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Medium Allow PauseCluster one

Cost control.

Allow redshift:PauseCluster on arn:aws:redshift:ap-south-1:131959625285:cluster:nagarsugar-dw.

  1. Start with { "Version": "2012-10-17", "Statement": [ ... ] }.
  2. In each statement write Effect, Action and Resource.
  3. Give only what the task needs (least privilege).
  4. Use double quotes and commas correctly. Click Check answer.

Medium DISTKEY JSON

Join key.

JSON distkey customer_id.

  1. Start from the top-level keys the task names.
  2. Indent child keys with 2 spaces (no tabs).
  3. Fill in each property with the value from the task.
  4. Click Check answer. Key order does not matter.

Medium Apply the lesson: scenario 12

Which Redshift feature can query supported external data in S3 without loading it all into local Redshift tables?

  1. Read the situation and identify what you need to decide.
  2. Work through the relevant concept or calculation.
  3. Enter only the requested term or number.
  4. Check your answer, then read the explanation.

Medium Sample node count small lab

Size.

Sample small lab node count (enter 2)?

  1. Write down the numbers the task gives you.
  2. Work it out step by step on paper.
  3. Type only the final answer in the box.
  4. Click Check answer.

Hard Describe events

Ops signals.

Describe events.

  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Hard Allow DescribeClusters

Analyst LP.

Allow redshift:DescribeClusters on *.

  1. Start with { "Version": "2012-10-17", "Statement": [ ... ] }.
  2. In each statement write Effect, Action and Resource.
  3. Give only what the task needs (least privilege).
  4. Use double quotes and commas correctly. Click Check answer.

Hard SORTKEY JSON

Filter key.

JSON sortkey order_date.

  1. Start from the top-level keys the task names.
  2. Indent child keys with 2 spaces (no tabs).
  3. Fill in each property with the value from the task.
  4. Click Check answer. Key order does not matter.