AWS Builder Center

Building a Modern Data Warehouse with Amazon Redshift and Amazon S3

For data engineers, understanding how these services work together is an important step toward designing scalable cloud data platforms.

Aspirante a Data Engineer

Building a Modern Data Warehouse with Amazon Redshift and Amazon S3

Introduction

As organizations generate increasing amounts of data, building scalable and reliable analytical platforms becomes a major challenge.
Traditional databases are often designed to handle transactional workloads, but analytical workloads require a different approach. Businesses need to process large datasets, combine information from multiple sources, and execute complex queries to support decision-making.
This is where Amazon Redshift becomes particularly useful.
Amazon Redshift is a fully managed cloud data warehouse designed for analytical workloads. It allows organizations to analyze large volumes of structured and semi-structured data using SQL while integrating with other AWS services.
In this article, we will explore how to build a simple modern data warehouse architecture using:
  • Amazon S3 for data storage.
  • Amazon Redshift for analytical processing.
  • SQL for data transformation and analysis.
  • Redshift Spectrum for querying data directly from Amazon S3.
We will use a fictional sales analytics scenario to understand how these services work together.

1. Understanding the architecture

Imagine an e-commerce company that receives sales information from different systems:
  • Online transactions.
  • Customer databases.
  • Product catalogs.
  • Payment systems.
The company wants to consolidate this information to analyze revenue, customer behavior, and product performance.
A possible architecture looks like this:
Data flow:
  1. Raw data arrives from different sources.
  1. Amazon S3 stores the incoming files.
  1. Amazon Redshift loads selected datasets into warehouse tables.
  1. SQL transformations prepare the analytical model.
  1. Business Intelligence tools connect to Redshift to generate reports.
Amazon Redshift also supports querying data directly from S3 through Redshift Spectrum, avoiding the need to load every dataset into internal warehouse tables.

2. Amazon S3: The data storage layer

Amazon Simple Storage Service (Amazon S3) provides scalable object storage.
For our example, we can organize the data using a simple folder structure:
s3://company-data-lake/
│
├── raw/
│ ├── sales/
│ │ └── sales_2026.csv
│ │
│ ├── customers/
│ │ └── customers.csv
│ │
│ └── products/
│ └── products.csv
│
├── processed/
│
└── analytics/
This organization separates raw information from processed datasets.
In a production environment, we could also use formats such as Apache Parquet to improve analytical workloads and reduce unnecessary data scanning.

3. Loading data into Amazon Redshift

One of the most important commands when working with Amazon Redshift is  COPY .
Unlike inserting thousands or millions of records individually using INSERT statements, COPY is designed to load data efficiently in parallel from sources such as Amazon S3.
First, let's create a sales table:
CREATE TABLE sales (
sale_id INT,
customer_id INT,
product_id INT,
sale_date DATE,
quantity INT,
total_amount DECIMAL(12,2)
);
Now, we can load the CSV file from Amazon S3:
COPY sales
FROM 's3://company-data-lake/raw/sales/'
IAM_ROLE 'arn:aws:iam::123456789012:role/RedshiftS3Role'
CSV
IGNOREHEADER 1
DATEFORMAT 'YYYY-MM-DD';
The IAM role must have the necessary permissions to access the S3 objects.
The COPY command reads the source files and loads their records into the destination table.
This is particularly useful when building ETL or ELT pipelines that process large volumes of data.

4. Transforming data with SQL

Once the data is available in Redshift, we can start creating analytical datasets.
For example, suppose the business wants to calculate monthly sales revenue by product.
We can create a summarized table:
CREATE TABLE monthly_product_sales AS
SELECT
DATE_TRUNC('month', sale_date) AS sales_month,
product_id,
SUM(quantity) AS total_units,
SUM(total_amount) AS total_revenue
FROM sales
GROUP BY
DATE_TRUNC('month', sale_date),
product_id;
This transformation converts transactional information into a structure that is easier to consume for analytical reporting.
We can then query the results:
SELECT
sales_month,
product_id,
total_units,
total_revenue
FROM monthly_product_sales
ORDER BY
sales_month,
total_revenue DESC;
This is an example of how a data warehouse supports business intelligence by organizing information into analytical structures.

5. Querying data directly from Amazon S3 with Redshift Spectrum

An important feature of Amazon Redshift is its integration with Amazon S3 through Redshift Spectrum.
But why is this useful?
Imagine that the company has several years of historical sales data stored in S3.
Loading every historical file into internal Redshift tables might not always be necessary.
With Redshift Spectrum, we can query supported external data files directly from S3 without first loading them into internal tables.
The typical setup involves:
  1. Creating an external schema connected to the AWS Glue Data Catalog.
  1. Defining external tables that reference datasets in S3.
  1. Querying those tables using SQL.
For example, after configuring an external table called  historical_sales , we could execute:
SELECT
product_id,
SUM(total_amount) AS historical_revenue
FROM spectrum.historical_sales
GROUP BY product_id
ORDER BY historical_revenue DESC;
This allows us to combine data stored in the warehouse with data residing in the data lake.
It is important to remember that Redshift Spectrum external tables are read-only. Data transformations and writes must be handled through an appropriate processing workflow.

6. Redshift Serverless: Simplifying infrastructure management

Another interesting option is Amazon Redshift Serverless.
With a traditional provisioned data warehouse, organizations need to configure and manage cluster capacity.
Redshift Serverless provides an alternative by automatically provisioning and scaling compute resources according to workload requirements.
It introduces two important concepts:
  • Namespace: Manages database objects, users, and storage-related configuration.
  • Workgroup: Manages compute resources, networking, and related settings.
This approach can be useful for teams that want to focus more on analytics and less on infrastructure management.
However, Serverless does not mean unlimited or automatically free compute. Workload configuration, usage limits, and cost monitoring remain important.

7. Best practices for building a reliable data warehouse

When designing a data warehouse with Amazon Redshift, consider the following practices:
1. Organize data in Amazon S3
Separate raw, processed, and analytical datasets to improve data organization and governance.
2. Use efficient file formats
Consider columnar formats such as Parquet for analytical workloads.
3. Use COPY for bulk loading
Avoid loading large datasets through individual INSERT statements when COPY is more appropriate.
4. Optimize analytical queries
Use appropriate table design, compression, statistics, and query analysis to improve performance.
5. Implement security with IAM
Grant only the permissions required for Redshift to access the necessary S3 resources.
6. Monitor costs
Evaluate storage, compute consumption, data transfer, and query patterns. Serverless resources still require cost management.

8. Final thoughts

Building a modern data warehouse is not simply about storing large amounts of information. It is about creating an architecture that makes data accessible, reliable, and useful for business decisions.
Amazon S3 and Amazon Redshift provide complementary capabilities:
  • S3 offers scalable storage for data lake architectures.
  • Redshift provides a dedicated analytical environment.
  • COPY simplifies bulk data ingestion.
  • Redshift Spectrum enables SQL-based access to data stored in S3.
  • Redshift Serverless reduces the infrastructure management required for analytical workloads.
For data engineers, understanding how these services work together is an important step toward designing scalable cloud data platforms.
The key is not just learning individual AWS services, but understanding how to combine them into an efficient data pipeline.
What would you choose for your next data engineering project: loading data into Amazon Redshift or querying it directly from Amazon S3 using Redshift Spectrum?
I'd love to hear your thoughts!
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article