This submit is co-written with Hemant Aggarwal and Naveen Kambhoji from Kaplan.
Kaplan, Inc. supplies people, instructional establishments, and companies with a broad array of companies, supporting our college students and companions to satisfy their numerous and evolving wants all through their instructional {and professional} journeys. Our Kaplan tradition empowers individuals to attain their objectives. Dedicated to fostering a studying tradition, Kaplan is altering the face of training.
Kaplan information engineers empower information analytics utilizing Amazon Redshift and Tableau. The infrastructure supplies an analytics expertise to a whole lot of in-house analysts, information scientists, and student-facing frontend specialists. The information engineering crew is on a mission to modernize its information integration platform to be agile, adaptive, and easy to make use of. To attain this, they selected the AWS Cloud and its companies. There are numerous forms of pipelines that must be migrated from the present integration platform to the AWS Cloud, and the pipelines have several types of sources like Oracle, Microsoft SQL Server, MongoDB, Amazon DocumentDB (with MongoDB compatibility), APIs, software program as a service (SaaS) functions, and Google Sheets. By way of scale, on the time of writing over 250 objects are being pulled from three totally different Salesforce situations.
On this submit, we focus on how the Kaplan information engineering crew applied information integration from the Salesforce software to Amazon Redshift. The answer makes use of Amazon Easy Storage Service as a knowledge lake, Amazon Redshift as a knowledge warehouse, Amazon Managed Workflows for Apache Airflow (Amazon MWAA) as an orchestrator, and Tableau because the presentation layer.
Answer overview
The high-level information move begins with the supply information saved in Amazon S3 after which built-in into Amazon Redshift utilizing numerous AWS companies. The next diagram illustrates this structure.
Amazon MWAA is our important instrument for information pipeline orchestration and is built-in with different instruments for information migration. Whereas looking for a instrument emigrate information from a SaaS software like Salesforce to Amazon Redshift, we got here throughout Amazon AppFlow. After some analysis, we discovered Amazon AppFlow to be well-suited for our requirement to tug information from Salesforce. Amazon AppFlow supplies the flexibility to instantly migrate information from Salesforce to Amazon Redshift. Nevertheless, in our structure, we selected to separate the information ingestion and storage processes for the next causes:
- We wanted to retailer information in Amazon S3 (information lake) as an archive and a centralized location for our information infrastructure.
- From a future perspective, there is perhaps eventualities the place we have to rework the information earlier than storing it in Amazon Redshift. By storing the information in Amazon S3 as an intermediate step, we are able to combine transformation logic as a separate module with out impacting the general information move considerably.
- Apache Airflow is the central level in our information infrastructure, and different pipelines are being constructed utilizing numerous instruments like AWS Glue. Amazon AppFlow is one a part of our general infrastructure, and we needed to keep up a constant strategy throughout totally different information sources and targets.
To accommodate these necessities, we divided the pipeline into two components:
- Migrate information from Salesforce to Amazon S3 utilizing Amazon AppFlow
- Load information from Amazon S3 to Amazon Redshift utilizing Amazon MWAA
This strategy permits us to benefit from the strengths of every service whereas sustaining flexibility and scalability in our information infrastructure. Amazon AppFlow can deal with the primary a part of the pipeline with out the necessity for another instrument, as a result of Amazon AppFlow supplies functionalities like making a connection to supply and goal, scheduling the information move, and creating filters, and we are able to select the kind of move (incremental and full load). With this, we had been capable of migrate the information from Salesforce to an S3 bucket. Afterwards, we created a DAG in Amazon MWAA that runs an Amazon Redshift COPY command on the information saved in Amazon S3 and strikes the information into Amazon Redshift.
We confronted the next challenges with this strategy:
- To do incremental information, we’ve got to manually change the filter dates within the Amazon AppFlow flows, which isn’t elegant. We needed to automate that date filter change.
- Each components of the pipeline weren’t in sync as a result of there was no option to know if the primary a part of the pipeline was full in order that the second a part of the pipeline might begin. We needed to automate these steps as effectively.
Implementing the answer
To automate and resolve the aforementioned challenges, we used Amazon MWAA. We created a DAG that acts because the management middle for Amazon AppFlow. We developed an Airflow operator that may carry out numerous Amazon AppFlow features utilizing Amazon AppFlow APIs like creating, updating, deleting, and beginning flows, and this operator is used within the DAG. Amazon AppFlow shops the connection information in an AWS Secrets and techniques Supervisor managed secret with the prefix appflow. The price of storing the key is included with the cost for Amazon AppFlow. With this, we had been capable of run the whole information move utilizing a single DAG.
The whole information move consists of the next steps:
- Create the move within the Amazon AppFlow utilizing a DAG.
- Replace the move with the brand new filter dates utilizing the DAG.
- After updating the move, the DAG begins the move.
- The DAG waits for the move full by checking the move’s standing repeatedly.
- Successful standing signifies that the information has been migrated from Salesforce to Amazon S3.
- After the information move is full, the DAG calls the COPY command to repeat information from Amazon S3 to Amazon Redshift.
This strategy helped us resolve the aforementioned points, and the information pipelines have grow to be extra strong, easy to know, simple to make use of with no handbook intervention, and fewer liable to error as a result of we’re controlling every little thing from a single level (Amazon MWAA). Amazon AppFlow, Amazon S3, and Amazon Redshift are all configured to make use of encryption to guard the information. We additionally carried out logging and monitoring, and applied auditing mechanisms to trace the information move and entry utilizing AWS CloudTrail and Amazon CloudWatch. The next determine reveals a high-level diagram of the ultimate strategy we took.
Conclusion
On this submit, we shared how Kaplan’s information engineering crew efficiently applied a sturdy and automatic information integration pipeline from Salesforce to Amazon Redshift, utilizing AWS companies like Amazon AppFlow, Amazon S3, Amazon Redshift, and Amazon MWAA. By making a customized Airflow operator to regulate Amazon AppFlow functionalities, we orchestrated your complete information move seamlessly inside a single DAG. This strategy has not solely resolved the challenges of incremental information loading and synchronization between totally different pipeline levels, however has additionally made the information pipelines extra resilient, simple to keep up, and fewer error-prone. We diminished the time for making a pipeline for a brand new object from an present occasion and a brand new pipeline for a brand new supply by 50%. This additionally helped take away the complexity of utilizing a delta column to get the incremental information, which additionally helped cut back the price per desk by 80–90% in comparison with a full load of objects each time.
With this contemporary information integration platform in place, Kaplan is well-positioned to supply its analysts, information scientists, and student-facing groups with well timed and dependable information, empowering them to drive knowledgeable choices and foster a tradition of studying and progress.
Check out Airflow with Amazon MWAA and different enhancements to enhance your information orchestration pipelines.
For extra particulars and code examples of Amazon MWAA, check with the Amazon MWAA Consumer Information and the Amazon MWAA examples GitHub repo.
In regards to the Authors
Hemant Aggarwal is a senior Knowledge Engineer at Kaplan India Pvt Ltd, serving to in growing and managing ETL pipelines leveraging AWS and course of/technique growth for the crew.
Naveen Kambhoji is a Senior Supervisor at Kaplan Inc. He works with Knowledge Engineers at Kaplan for constructing information lakes utilizing AWS Companies. He’s the facilitator for your complete migration course of. His ardour is constructing scalable distributed methods for effectively managing information on cloud.Exterior work, he enjoys travelling together with his household and exploring new locations.
Jimy Matthews is an AWS Options Architect, with experience in AI/ML tech. Jimy is predicated out of Boston and works with enterprise clients as they rework their enterprise by adopting the cloud and helps them construct environment friendly and sustainable options. He’s obsessed with his household, vehicles and Combined martial arts.