π Redshift Serverless
Master Redshift Serverless auto-scaling, cost model, and best practices.
Module: AWS Data Engineering β’ Topic 38 of 65 β’ Premium Content
Serverless Architecture
Architecture Diagram
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β REDSHIFT SERVERLESS ARCHITECTURE β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β WORKGROUP CONFIGURATION β β
β β Base Capacity: 128 - 512 RPUs β β
β β Auto-pause: 30 sec - 60 min β β
β β Managed Storage: S3-backed, auto-scaling β β
β βββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββ β
β β β
β βββββββββββββββββββΌββββββββββββββββββ β
β βΌ βΌ βΌ β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β Query Load β β Auto-scaling β β Auto-pause β β
β β 128 β 256 β β β RPUs based on β β When idle β β
β β 512 RPUs β β query demand β β (configurable) β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β
β COST MODEL: β
β RPU-hour = RPU count Γ hours used β
β 128 RPUs Γ 1 hour = $12.80 β
β 256 RPUs Γ 1 hour = $25.60 β
β Storage: $0.024/GB/month β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Serverless Configuration
import boto3
redshift = boto3.client('redshift-serverless')
# Create workgroup
response = redshift.create_workgroup(
workgroupName='analytics-serverless',
baseCapacity=128,
enhancedVpcRouting=True,
securityGroupIds=['sg-12345678'],
subnetIds=['subnet-12345678', 'subnet-87654321'],
publiclyAccessible=False,
configParameters=[
{'parameterKey': 'enable_user_activity_logging', 'parameterValue': 'true'},
{'parameterKey': 'max_query_execution_time', 'parameterValue': '3600'}
]
)
# Create namespace
namespace = redshift.create_namespace(
namespaceName='analytics-namespace',
adminUsername='admin',
adminUserPassword='SecurePassword123!',
dbName='analytics_db',
iamRoles=['arn:aws:iam::123456789012:role/ServerlessRole']
)
Interview Q&A
Q1: Serverless vs Provisioned?
Answer: Serverless for variable workloads, dev/test. Provisioned for steady-state production with predictable costs.
Q2: How does auto-scaling work?
Answer: RPUs scale automatically based on query complexity. Base capacity sets minimum; max is 4x base or 512 RPUs.
Q3: What is the minimum auto-pause setting?
Answer: 5 minutes. Redshift Serverless will pause after 5 minutes of inactivity to save costs.
Summary
- Architecture: Serverless auto-scaling based on query demand
- Pricing: Per RPU-hour + managed storage
- Auto-pause: Configurable 5 min to 60 min
- Best For: Variable workloads, dev/test, unpredictable queries
- Storage: S3-backed managed storage, auto-scaling