<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by harish reddy on Medium]]></title>
        <description><![CDATA[Stories by harish reddy on Medium]]></description>
        <link>https://medium.com/@harishreddy05?source=rss-51bab452d7d8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*UpO_VG6uC0enrKQO.</url>
            <title>Stories by harish reddy on Medium</title>
            <link>https://medium.com/@harishreddy05?source=rss-51bab452d7d8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 23:19:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@harishreddy05/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Automating EMR Sandbox Provisioning Using AWS Lambda and APIs]]></title>
            <link>https://medium.com/@harishreddy05/automating-emr-sandbox-provisioning-using-aws-lambda-and-apis-16b60258ff19?source=rss-51bab452d7d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/16b60258ff19</guid>
            <dc:creator><![CDATA[harish reddy]]></dc:creator>
            <pubDate>Mon, 06 Jul 2026 15:19:30 GMT</pubDate>
            <atom:updated>2026-07-06T15:39:09.300Z</atom:updated>
            <content:encoded><![CDATA[<p>How we eliminated manual infrastructure provisioning and simplified EMR Sandbox management.</p><h3>Introduction</h3><p>Provisioning an Amazon EMR sandbox sounds simple until every request involves multiple manual steps, infrastructure approvals, environment-specific configurations, and repetitive validation activities.</p><p>For data engineers, EMR sandboxes are invaluable. They provide isolated environments for testing Spark applications, debugging production issues, validating data pipelines, and experimenting with new workloads without impacting production systems. However, when provisioning these environments becomes a manual process, engineers spend more time managing infrastructure than solving business problems.</p><p>As the number of sandbox requests increased, our existing approach became increasingly difficult to maintain. Each request required manual intervention, resulting in longer provisioning times, inconsistent configurations, and additional operational overhead.</p><p>To solve this challenge, we designed an <strong>API-driven automation framework</strong> that automates the complete lifecycle of an EMR sandbox from creation and validation to termination and rehydration. Leveraging AWS Lambda, backend APIs, and configuration-driven workflows, we transformed a repetitive manual process into a streamlined, reliable, and scalable solution.</p><p>In this article, I’ll walk through the problem, architecture, implementation, and lessons learned while building this automation framework.<br>Why EMR Sandboxes Matter</p><p>Amazon EMR provides a managed platform for processing large-scale data using frameworks such as Apache Spark, Hive, and Hadoop.</p><p>Engineering teams frequently require temporary EMR clusters for purposes such as:</p><ul><li>Testing Spark applications before deployment</li><li>Debugging production failures</li><li>Validating infrastructure changes</li><li>Running one-time data processing jobs</li><li>Performing performance benchmarking</li></ul><p>Since these clusters are temporary by nature, provisioning them should be quick, reliable, and repeatable.</p><p>Unfortunately, that wasn’t our reality.As the number of sandbox requests increased, the manual approach became difficult to scale and maintain.<br>Design Goals</p><h3>The Problem</h3><p>Provisioning an EMR sandbox initially involved several manual activities.</p><p>A typical provisioning request required engineers to:</p><ul><li>Configure environment-specific parameters</li><li>Execute multiple infrastructure scripts</li><li>Validate deployment status</li><li>Verify cluster health</li><li>Coordinate approvals</li><li>Handle cleanup manually</li></ul><p>While these steps were individually straightforward, together they introduced several operational challenges.</p><h3>Common Pain Points</h3><ul><li>Multiple manual provisioning steps</li><li>Environment-specific configuration dependencies</li><li>Infrastructure approval processes</li><li>Long provisioning times</li><li>Higher risk of configuration errors</li><li>Manual validation after deployment</li><li>Complex sandbox recovery and rehydration</li></ul><p>As sandbox usage increased, this approach became increasingly difficult to scale.</p><p>Instead of focusing on building data pipelines, engineers spent valuable time performing repetitive infrastructure tasks.</p><h3><strong>Design Goals</strong></h3><p>Before implementing the solution, we established several design objectives.</p><p>The automation framework should:</p><ul><li>Fully automate EMR sandbox provisioning</li><li>Reduce manual intervention</li><li>Standardize infrastructure configuration</li><li>Support multiple environments</li><li>Simplify sandbox recovery</li><li>Reduce operational overhead</li><li>Improve provisioning reliability</li><li>Provide a consistent developer experience</li></ul><h3><strong>Solution Overview</strong></h3><p>Rather than manually provisioning infrastructure resources, we introduced an API-driven workflow.</p><p>Developers interact with a simple command line interface, while backend services handle the entire provisioning lifecycle.</p><p>The framework performs the following activities automatically:</p><ul><li>Validates provisioning requests</li><li>Retrieves environment configuration</li><li>Orchestrates infrastructure provisioning</li><li>Creates the EMR cluster</li><li>Continuously monitors deployment</li><li>Returns the cluster endpoint once provisioning completes</li></ul><p>Because the workflow is driven by APIs instead of manual execution, provisioning becomes repeatable, reliable, and significantly easier to maintain.</p><p><strong>High-Level Architecture</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/194/0*RPFHOdadDKjx2Ojc.png" /></figure><p>This significantly reduces operational complexity while improving consistency across environments.</p><p>Architecture Components<br>Developer</p><p>The provisioning process begins when a developer executes a simple command-line utility.</p><pre>./emrsbx.sh create --env nonprod --region us-east-1</pre><h3>Infrastructure API</h3><p>The Infrastructure API receives provisioning requests from the CLI.</p><p>Its responsibilities include:</p><ul><li>Request validation</li><li>Environment verification</li><li>Authentication</li><li>Request routing</li></ul><p>After validation, the request is forwarded to the orchestration layer.<br><strong>Configuration Store</strong></p><p>Instead of hardcoding infrastructure values, all environment-specific metadata is stored centrally.</p><p>Typical configuration includes:</p><ul><li>Environment details</li><li>Network configuration</li><li>EMR settings</li><li>Security parameters</li><li>Cluster sizing</li></ul><p>Separating configuration from application logic improves maintainability and enables onboarding new environments without modifying code.</p><h3>Orchestration API</h3><p>The Orchestration API coordinates the complete provisioning workflow.</p><p>Rather than directly creating infrastructure, it invokes downstream services responsible for provisioning and monitoring.</p><p>This separation of responsibilities keeps the architecture modular and easier to extend.</p><h3>AWS Lambda</h3><p>AWS Lambda performs the infrastructure automation.</p><p>When invoked, the Lambda function:</p><ul><li>Creates the required EMR resources</li><li>Applies infrastructure configuration</li><li>Handles provisioning logic</li><li>Reports provisioning status</li></ul><p>Because provisioning is event-driven and short lived, Lambda provides a scalable serverless solution without requiring dedicated infrastructure.</p><h3>Monitoring Service</h3><p>Provisioning infrastructure is only part of the workflow.</p><p>A monitoring service continuously checks the status of the EMR cluster until it becomes available.</p><p>Once provisioning completes successfully, the developer receives confirmation along with the EMR endpoint.</p><h3>End-to-End Workflow</h3><p>The complete provisioning workflow follows these steps:</p><ol><li>A developer executes the CLI command.</li><li>The Infrastructure API validates the request.</li><li>Environment configuration is retrieved from the configuration store.</li><li>The Orchestration API initiates the provisioning workflow.</li><li>AWS Lambda provisions the EMR infrastructure.</li><li>The monitoring service periodically checks cluster status.</li><li>Once provisioning completes successfully, the EMR endpoint is returned.</li></ol><p>This workflow removes nearly all manual intervention while ensuring consistent infrastructure deployment across environments.</p><h3>Automation Workflow</h3><p>Creating an EMR sandbox becomes as simple as running:</p><pre>./emrsbx.sh create --env nonprod --region us-east-1</pre><p>Similarly, terminating or rehydrating a sandbox requires only a single command.</p><pre>./emrsbx.sh terminate --env nonprod --region us-east-1</pre><pre>./emrsbx.sh rehydrate --env nonprod --region us-east-1</pre><p>The automation framework handles validation, orchestration, provisioning, monitoring, and cleanup without requiring additional manual steps.</p><h3>Benefits</h3><p>The automation framework significantly improved the developer experience.</p><p>Key improvements included:</p><ul><li>Fully automated provisioning workflow</li><li>Standardized infrastructure configuration</li><li>Reduced operational overhead</li><li>Consistent provisioning across environments</li><li>Simplified recovery and cleanup</li><li>Lower risk of configuration errors</li><li>Improved scalability</li><li>Easier maintenance</li></ul><p>Instead of manually managing infrastructure, engineers can focus on developing and validating data pipelines.</p><h3>Lessons Learned</h3><p>Building infrastructure automation provided several valuable insights.</p><h3>Design APIs First</h3><p>Infrastructure workflows become significantly easier to maintain when exposed through well-defined APIs.</p><h3>Externalize Configuration</h3><p>Keeping infrastructure configuration outside application code improves flexibility and simplifies environment management.</p><h3>Serverless Fits Provisioning Workloads</h3><p>Provisioning operations are event driven and short lived, making AWS Lambda an excellent fit.</p><h3>Monitoring Is Just as Important as Provisioning</h3><p>Infrastructure should not only be created it should also be continuously monitored until it reaches a healthy state.</p><h3>Monitoring Is Just as Important as Provisioning</h3><p>Infrastructure should not only be created it should also be continuously monitored until it reaches a healthy state.</p><h3>Future Enhancements</h3><p>Although the automation framework significantly improved provisioning, several enhancements are possible.</p><p>Potential future improvements include:</p><ul><li>Infrastructure-as-Code integration using Terraform or AWS CloudFormation</li><li>Self-service web portal for sandbox management</li><li>Cost optimization through automatic sandbox expiration</li><li>Notification integration using Amazon SNS or Slack</li><li>Automated usage reporting and analytics</li><li>Role-based access control for provisioning operations</li></ul><h3>Conclusion</h3><p>Automating the EMR Sandbox lifecycle transformed what was once a manual, error-prone operational process into a repeatable, reliable, and scalable workflow.</p><p>By combining backend APIs, AWS Lambda, and configuration-driven automation, we eliminated repetitive infrastructure tasks while improving consistency across environments.</p><p>Beyond reducing operational effort, the framework established a foundation for future infrastructure automation initiatives and allowed engineers to spend less time provisioning resources and more time building data solutions.</p><p>As infrastructure continues to evolve, investing in automation is no longer just a convenience it is essential for delivering scalable, reliable, and developer-friendly platforms.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16b60258ff19" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Legacy Systems to Modern Orchestration: Automating Migration to Airflow]]></title>
            <link>https://medium.com/@harishreddy05/from-legacy-systems-to-modern-orchestration-automating-migration-to-airflow-c299a03bf1d4?source=rss-51bab452d7d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/c299a03bf1d4</guid>
            <dc:creator><![CDATA[harish reddy]]></dc:creator>
            <pubDate>Sun, 20 Jul 2025 23:54:34 GMT</pubDate>
            <atom:updated>2025-07-20T23:54:34.316Z</atom:updated>
            <content:encoded><![CDATA[<p>Migrating thousands of batch jobs from a legacy scheduler to a modern orchestration platform is no small feat. When your old system speaks in dusty XML files and tangled dependencies, the thought of manually rewriting every workflow can be overwhelming — and frankly, a little terrifying. Enter automation.</p><p>In this article, join Andeana and Maya as they walk you through the behind-the-scenes story of how their team tackled this massive migration. With a clever Python framework, smart XML parsing, and dynamic Airflow DAG generation, they turned what could have been a months-long nightmare into a sleek, repeatable process.</p><p>Through their lively conversation, you’ll get a clear picture of the technical challenges, creative solutions, and even a few laughs along the way. Whether you’re wrestling with legacy systems or just curious about automated workflow migrations, this tale has something for you!</p><p><strong>Andeana:</strong> Hey Maya! Remember that epic saga when we migrated thousands of batch jobs from our ancient scheduler, Arow, to Shairflow, our shiny, customized Apache Airflow? It was like moving the entire city’s traffic lights to a new control system — without causing a jam!</p><p><strong>Maya:</strong> Oh yeah, I recall you saying the scale was massive, with complex workflows and dependencies everywhere. How did you even begin to automate that?</p><p><strong>Andeana:</strong> The secret sauce was a Python-based migration framework. At the heart of it, we took those legacy XML files — each packed with detailed job definitions and dependencies — and transformed them into Airflow DAGs automatically.</p><p><strong>Maya:</strong> XML? So the legacy system exported everything as XML?</p><p><strong>Andeana:</strong> Exactly! The XML had job metadata, schedules, predecessor and successor task info. The challenge was reading those files programmatically, interpreting the relationships, and producing equivalent DAGs that Airflow could run.</p><h3>The Core of the Automation: Parsing XML and Building Task Graphs</h3><p><strong>Maya:</strong> Those XML files must have been monsters. Did you summon some heavy-duty parser?</p><p><strong>Andeana:</strong> Nope! We kept it lean with Python’s trusty xml.etree.ElementTree. It’s like the Swiss Army knife of XML parsing — lightweight and does the job without complaining. Plus, we told it, “Hey, keep the CDATA intact!” because some job scripts were hiding there like secret agents.</p><pre>from xml.etree import ElementTree as etree<br>parser = etree.XMLParser(strip_cdata=False)</pre><p><strong>Maya:</strong> Cool! But how did you represent each job inside your code?</p><p><strong>Andeana:</strong> We created a Task class. Each instance captured key attributes:</p><ul><li>The original job alias or object name</li><li>Job type (like “JOBS”, “SCRI”, or “EVNT”)</li><li>Unique ID (task identifier)</li><li>Predecessor and successor task IDs</li><li>Any job parameters or embedded scripts</li></ul><p>This abstraction let us easily navigate and manipulate each task.<br>Mapping Dependencies — The Magic Graph Construction</p><p><strong>Maya:</strong> Sounds neat. But the tricky part is dependencies, right? How did you handle those?</p><p><strong>Andeana:</strong> Exactly. For every task, the XML contained predecessor info. We first gathered predecessor_ids for each task, then inverted the mapping to find successor_ids. This double linkage was crucial because Airflow needs explicit downstream dependencies.</p><p>Here’s the snippet:</p><pre>for task_id, preds in id_to_predecessor_ids.items():<br>    for pred in predps:<br>        id_to_successor_ids.setdefault(pred, []).append(task_id)</pre><p><strong>Maya:</strong> Nice! That way you knew exactly which task should follow which.</p><h3>Generating Airflow DAG Python Code Dynamically</h3><p><strong>Maya:</strong> Once you had your tasks and dependencies, how did you generate Airflow DAG code?</p><p><strong>Andeana:</strong> We used multi-line string templates with placeholders for DAG and task names. Then, we dynamically replaced those placeholders for each task.</p><p>Example of the DAG header template:</p><pre><br>GEN_HEAD_TEMPLATE = &#39;&#39;&#39;<br>from airflow import DAG<br>from airflow.operators.python import PythonOperator<br>from datetime import timedelta<br>import pendulum<br><br>default_args = {{<br>    &#39;owner&#39;: &#39;airflow&#39;,<br>    &#39;start_date&#39;: pendulum.datetime(2024, 5, 9, tz=&#39;America/New_York&#39;),<br>    &#39;retries&#39;: 1,<br>    &#39;retry_delay&#39;: timedelta(minutes=5),<br>}}<br><br>dag = DAG(<br>    dag_id=&#39;{dag_name}&#39;,<br>    default_args=default_args,<br>    schedule_interval=timedelta(days=1),<br>    catchup=False,<br>)<br></pre><p><strong>Maya:</strong> So for each task, you had something like this?</p><pre>TASK_TEMPLATE = &#39;&#39;&#39;<br>{task_id} = PythonOperator(<br>    task_id=&#39;{task_id}&#39;,<br>    python_callable={python_callable},<br>    dag=dag,<br>)</pre><p><strong>Andeana:</strong> Exactly. We mapped legacy job types to specific Airflow operators or Python functions. That way, the generated DAGs could run jobs exactly as intended.</p><h3>Handling Task Parameters and Scripts</h3><p><strong>Maya:</strong> How about job parameters and embedded scripts?</p><p><strong>Andeana:</strong> The legacy XML often had &lt;PRE_SCRIPT&gt; tags containing environment variables and commands. Our code parsed those, cleaned the parameters, and passed them as arguments or templated strings in Airflow tasks.</p><h3>Validation, Error Handling, and Code Formatting</h3><p><strong>Maya:</strong> Did you validate the DAGs?</p><p><strong>Andeana:</strong> Yes! We built validation steps to catch cycles, missing dependencies, and orphan tasks. If any issues popped up, those DAGs were flagged for manual review.</p><p><strong>Maya:</strong> What about formatting the generated Python files?</p><p><strong>Andeana:</strong> We used autopep8 to automatically clean up the generated code, making it PEP8-compliant and readable. No messy code on our watch!</p><h3>Bonus: Monitoring and Alerts</h3><p><strong>Maya:</strong> Did you integrate monitoring?</p><p><strong>Andeana:</strong> For sure. We wired in PagerDuty alerts for production DAG failures, so on-call engineers get instant notifications. That greatly improved operational reliability.</p><h3>Wrapping Up</h3><p><strong>Maya:</strong> This sounds like a massive efficiency boost.</p><p><strong>Andeana:</strong> It was! Manual migration would have taken thousands of engineering hours and carried a ton of risk. Our automation framework cut that to weeks and made the whole process repeatable and maintainable.</p><p><strong>Maya:</strong> I’m impressed. You turned a huge headache into an elegant, scalable solution. Thanks for the walkthrough!</p><p><strong>Andeana:</strong> Anytime! Now if only debugging those 3 AM alerts was as fun as writing the migration scripts… 😄</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c299a03bf1d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>