Extract, Load, and Transform (ELT) is a modern design strategy where raw data is first loaded into the data warehouse and then transformed with familiar Structured Query Language (SQL) semantics leveraging the power of massively parallel processing (MPP) architecture of the data warehouse. When you use an ELT pattern, you can also use your existing SQL workload while migrating from your on-premises data warehouse to Amazon Redshift. This eliminates the need to rewrite relational and complex SQL workloads into a new framework. With Amazon Redshift, you can load, transform, and enrich your data efficiently using familiar SQL with advanced and robust SQL support, simplicity, and seamless integration with your existing SQL tools. When you adopt an ELT pattern, a fully automated and highly scalable workflow orchestration mechanism will help to minimize the operational effort that you must invest in managing the pipelines. It also ensures the timely and accurate refresh of your data warehouse.
AWS Step Functions is a low-code, serverless, visual workflow service where you can orchestrate complex business workflows with an event-driven framework and easily develop repeatable and dependent processes. It can ensure that the long-running, multiple ELT jobs run in a specified order and complete successfully instead of manually orchestrating those jobs or maintaining a separate application.
Amazon DynamoDB is a fast, flexible NoSQL database service for single-digit millisecond performance at any scale.
This post explains how to use AWS Step Functions, Amazon DynamoDB, and Amazon Redshift Data API to orchestrate the different steps in your ELT workflow and process data within the Amazon Redshift data warehouse.
In this solution, we will orchestrate an ELT process using AWS Step Functions. As part of the ELT process, we will refresh the dimension and fact tables at regular intervals from staging tables, which ingest data from the source. We will maintain the current state of the ELT process (e.g., Running or Ready) in an audit table that will be maintained at Amazon DynamoDB. AWS Step Functions allows you to directly call the Data API from a state machine, reducing the complexity of running the ELT pipeline. For loading the dimensions and fact tables, we will be using Amazon Redshift Data API from AWS Lambda. We will use Amazon EventBridge for scheduling the state machine to run at a desired interval based on the customer’s SLA.
For a given ELT process, we will set up a JobID in a DynamoDB audit table and set the JobState as “Ready” before the state machine runs for the first time. The state machine performs the following steps:
JobID as input to the process that is configured as JobID 101 in Step Functions and DynamoDB by default via the CloudFormation template.JobState for the given JobID by running a query against the DynamoDB audit table using Lambda Data API.JobState is “Running,” then it indicates that the previous iteration is not completed yet, and the process should end.JobState is “Ready,” then it indicates that the previous iteration was completed successfully and the process is ready to start. So, the next step will be to update the DynamoDB audit table to change the JobState to “Running” and JobStart to the current time for the given JobID using DynamoDB Data API within a Lambda function.JobState to “Ready” and JobEnd to the current time for the given JobID, using DynamoDB Data API within a Lambda function.
Components and dependencies
The following architecture diagram highlights the end-to-end solution using AWS services:
Before diving deeper into the code, let’s look at the components first:
To complete this walkthrough, you must have the following prerequisites:
AmazonS3ReadOnlyAccessAmazonRedshiftFullAccessTo set up the ETL orchestration demo, the steps are as follows:

| CloudFormation template parameter | Allowed values | Description |
RedshiftClusterIdentifier | Amazon Redshift cluster identifier | Enter the Amazon Redshift cluster identifier |
DatabaseUserName | Database user name in Amazon Redshift cluster | Amazon Redshift database user name which has access to run SQL Script |
DatabaseName | Amazon Redshift database name | Name of the Amazon Redshift primary database where SQL script would be run |
RedshiftIAMRoleARN | Valid IAM role ARN attached to Amazon Redshift cluster | AWS IAM role ARN associated with the Amazon Redshift cluster |


DemoETLOrchestration, so the table name will begin with DemoETLOrchestration-DynamoDBETLAuditTable.Ready status.


Running with JobStart time.
In the real world sometimes, the ELT process can fail due to unexpected data anomalies or object related issues. In that case, the step function execution will also fail with the failed step marked in red as shown in the screenshot below:

Once you identify and fix the issue, please follow the below steps to restart the step function:
DemoETLOrchestration-DynamoDBETLAuditTable. Click on Explore table items and select the row with the specific JobID for the failed job.Ready as shown below:
The step function loads the dimension tables public.supplier and public.customer and the fact table public.fact\_yearly\_sale. To validate the orchestration, the process steps are as follows:
The steps are as follows to schedule the Step Functions:

Trigger-Redshift-ELTStepFunction.default.Schedule.
A schedule that runs at a regular rate, such as every 10 minutes.5 and choose Unit as Minutes.
AWS service.Step Functions state machine.Create a new role for this specific resource.
After the rule has been created, it will automatically trigger the step function every 5 minutes to perform ELT processing in Amazon Redshift.
Please note that deploying a CloudFormation template incurs cost. To avoid incurring future charges, delete the resources you created as part of the CloudFormation stack by navigating to the AWS CloudFormation console, selecting the stack, and choosing Delete.
In this post, we described how to easily implement a modern, serverless, highly scalable, and cost-effective ELT workflow orchestration process in Amazon Redshift using AWS Step Functions, Amazon DynamoDB and Amazon Redshift Data API. As an alternate solution, you can also use Amazon Redshift for metadata management instead of using Amazon DynamoDB. As part of this demo, we show how a single job entry in DynamoDB gets updated for each run, but you can also modify the solution to maintain a separate audit table with the history of each run for each job, which would help with debugging or historical tracking purposes. Step Functions manage failures, retries, parallelization, service integrations, and observability so your developers can focus on higher-value business logic. Step Functions can integrate with Amazon SNS to send notifications in case of failure or success of the workflow. Please follow this AWS Step Functions documentation to implement the notification mechanism.
Poulomi Dasgupta is a Senior Analytics Solutions Architect with AWS. She is passionate about helping customers build cloud-based analytics solutions to solve their business problems. Outside of work, she likes travelling and spending time with her family.
Raks Khare is an Analytics Specialist Solutions Architect at AWS based out of Pennsylvania. He helps customers architect data analytics solutions at scale on the AWS platform.
Tahir Aziz is an Analytics Solution Architect at AWS. He has worked with building data warehouses and big data solutions for over 13 years. He loves to help customers design end-to-end analytics solutions on AWS. Outside of work, he enjoys traveling
and cooking.