Querying S3 with Spectrum
Introduction: Connecting Redshift Serverless to Your Data Lake
Welcome to the first lesson of the course, Data Warehousing on AWS with Amazon Redshift. In this lesson, you will learn how to connect Amazon Redshift Serverless to your S3 data lake and run your very first cross-lake query. This is a foundational step in building a modern analytics warehouse on AWS, and it will set you up for more advanced topics in the units ahead.
Amazon Redshift Serverless is a fully managed data warehouse that automatically handles infrastructure, scaling, and maintenance. This means you can focus on analyzing your data rather than managing clusters. In this lesson, you will see how Redshift Serverless can connect directly to data stored in Amazon S3, which is often used as a data lake for raw and processed data.
To make this connection work, you will use a few key AWS services:
- Amazon S3: Stores your data files, such as Parquet or CSV.
- AWS Glue Data Catalog: Holds metadata about your data, like table definitions and schema.
- IAM Roles: Manage permissions so Redshift can securely access your S3 data.
You will use a feature called Redshift Spectrum to query data in S3 without having to load it into Redshift tables first. This is a fast way to get value from your data lake and is often the first step in building a warehouse on AWS.
Quick Reference: IAM Permissions for Redshift Data Lake Operations
Before you dive into querying, it's helpful to know what permissions are required behind the scenes. In real AWS environments, the IAM role attached to your Redshift workgroup must have the right permissions to access S3 and Glue. Here's a quick matrix to clarify what's needed for the most common operations:
| Operation | S3 Permissions | Glue Permissions | Notes |
|---|---|---|---|
| Spectrum SELECT | s3:GetObject | glue:GetDatabase, glue:GetTable, glue:GetPartitions | For reading external tables in S3 |
| COPY from S3 | s3:GetObject | (none required) | For loading data into Redshift |
| UNLOAD to S3 | s3:PutObject | (none required) | For exporting data from Redshift to S3 |
In this CodeSignal environment, all required permissions are already set up for you. But in production, you'll need to ensure your Redshift IAM role has these permissions—otherwise, your queries may fail with access errors.
