<?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 Isaac Martin on Medium]]></title>
        <description><![CDATA[Stories by Isaac Martin on Medium]]></description>
        <link>https://medium.com/@isaac-martin?source=rss-22629b92f6a0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*ZxCXQnUyVJoPOr_-</url>
            <title>Stories by Isaac Martin on Medium</title>
            <link>https://medium.com/@isaac-martin?source=rss-22629b92f6a0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 16:51:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@isaac-martin/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[The Half-Million Dollar AWS Diet: Grabyo’s Cost-Cutting Success Story — Part 2]]></title>
            <link>https://isaac-martin.medium.com/the-half-million-dollar-aws-diet-grabyos-cost-cutting-success-story-part-2-1d632ade5b06?source=rss-22629b92f6a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d632ade5b06</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[cloud-cost-optimization]]></category>
            <category><![CDATA[live-streaming]]></category>
            <dc:creator><![CDATA[Isaac Martin]]></dc:creator>
            <pubDate>Mon, 09 Jun 2025 10:34:46 GMT</pubDate>
            <atom:updated>2025-09-17T18:27:43.387Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Half-Million Dollar AWS Diet: Grabyo’s Cost-Cutting Success Story — Part 2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6G-9e7EpD1dAyy0--yVEeg.png" /></figure><h3>Introduction</h3><p>Welcome to Part II of Grabyo’s AWS cost optimization journey. In Part I, we explored our initial approach and the quick wins we achieved through performance enhancements and resource optimizations. We saw how these efforts led to an impressive annual saving of $409,644.</p><p>In this second part, we’ll dive into the more strategic, long-term changes we implemented to further reduce costs and improve our AWS infrastructure. These initiatives not only contributed to additional savings but also streamlined our operations and enhanced our system architecture.</p><h3>Strategic Service Migrations</h3><h4>3rd Party IDS to GuardDuty Migration: $7,620</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bzQfpXk3XxBvD2x-wN4NdA.png" /></figure><p>In Grabyo’s early days, when our platform primarily ran on EC2 instances, a 3rd party Intrusion Detection System (IDS) served as our trusted security solution. However, as we embraced containerization and began migrating significant portions of our platform to Docker containers running on AWS Fargate, we encountered a challenge. The 3rd party IDS’s support for Fargate at the time wasn’t as robust as we needed, creating a potential gap in our security coverage.</p><p>Faced with this situation, we made a strategic decision to pivot. Amazon GuardDuty emerged as the ideal solution, offering native integration with AWS services (including Fargate), comprehensive coverage, and scalability to match our growing infrastructure needs. This transition not only enhanced our security posture but also delivered significant cost savings.</p><p>The switch to GuardDuty resulted in an annual reduction of $7,620 in EC2 costs alone. It’s worth noting that this figure doesn’t even account for the additional savings we realized from eliminating the 3rd party IDS licensing fees. The total cost reduction, when including these licensing savings, was substantially higher.</p><p>Key benefits of this migration included:</p><ul><li>Improved security coverage across our entire AWS infrastructure</li><li>Native integration with AWS services, including Fargate</li><li>Simplified management and reduced operational overhead</li><li>Significant cost savings on both EC2 instances and licensing fees</li></ul><h4>Open Source Migration: $18,000</h4><p>At Grabyo, we identified an opportunity to optimize costs by re-evaluating our reliance on proprietary servers crucial to our live streaming capabilities. These servers incurred an annual licensing fee of $18,000, prompting us to explore open-source alternatives.</p><p>The migration process was not without its challenges. It required meticulous planning, extensive testing, and careful coordination to ensure a seamless transition without impacting our service quality. However, the results were significant:</p><ul><li>Eliminated the $18,000 annual licensing cost</li><li>Maintained live streaming performance at par with the proprietary solution</li><li>Increased flexibility and customization options to better suit our specific needs</li><li>Reduced vendor lock-in, giving us more control over our technology stack</li></ul><p>While we can’t disclose the specific technologies involved due to competitive reasons, this initiative demonstrates that open-source solutions can often match or even surpass proprietary systems at a fraction of the cost. It aligns with our philosophy of leveraging community-driven technologies and highlights the value of regularly re-evaluating our technology stack for optimization opportunities.</p><h4>Nexus Repository Migration: $1,368</h4><p>Our journey to Nexus began with a startling price hike from our previous provider, JFrog. Initially, we were paying a reasonable $15 per month ($180 per year) for our repository needs. However, in September 2023, JFrog implemented a dramatic price increase, multiplying their rates by a factor of ten. Suddenly, our monthly costs skyrocketed to $150, which would translate to an annual expense of $1,800.</p><p>This unexpected price surge prompted us to explore alternatives, leading us to Nexus. After careful evaluation, we determined that Nexus could meet all our repository needs while offering a much more cost-effective solution. The migration process was meticulously planned and executed to ensure a smooth transition with minimal disruption to our development workflows.</p><p>By switching to Nexus, we reduced our monthly repository costs to just $36. This translates to an annual saving of $1,368 — a significant reduction from what we would have paid with JFrog’s new pricing.</p><p>Beyond the cost savings, this migration brought additional benefits:</p><ul><li>Improved developer workflow with faster artifact retrieval</li><li>Enhanced flexibility in managing our repositories</li><li>Reduced dependency on a single vendor</li></ul><p>This initiative underscores the importance of regularly reviewing and challenging our tooling choices, especially in response to significant price changes from vendors.</p><h4>Microservices to Lambda Migration: $1,468 (98% cost reduction)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bhv6c3vXvfN3FHCJdIUV2w.png" /></figure><p>Our cost optimization efforts led us to migrate two of our microservices to AWS Lambda, yielding impressive results. This transition resulted in a 98% overall cost reduction for the two services, translating to annual savings of $1,468. The benefits, however, extended far beyond mere cost savings.</p><p>Key advantages of this migration included:</p><ul><li>Improved scalability through automatic workload adjustment</li><li>Reduced operational overhead by minimizing server maintenance</li><li>Enhanced development agility with quicker deployments and updates</li><li>Better alignment of costs with the actual value derived from these services</li></ul><p>This successful transition has had a profound impact on our development strategy. The significant cost savings and operational benefits have led to a shift in our approach: Lambda is now becoming our go-to technology for microservices across all our teams, gradually replacing our Docker-based services.</p><p>As we continue to expand its implementation, this initiative serves as a blueprint for future serverless migrations across our platform. It promises not only continued cost optimizations but also improved operational efficiency, reinforcing our commitment to leveraging the most effective technologies in our quest for optimal performance and resource utilization.</p><h3>Service Retirement and Consolidation</h3><h4>Retiring Social Analytics: $5,080</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j881NNMVOde_uIWZoYHYjQ.png" /></figure><p>In our optimization efforts, we faced a decision regarding our social analytics module. Recent API changes by platforms like Twitter (now X) and Facebook significantly reduced the depth and quality of data we could access. As a result, our analytics were no longer providing the comprehensive insights our customers sought.</p><p>Recognizing this shift in value proposition, we seized the opportunity to retire the feature altogether. This decision not only aligned with our cost-saving goals but also ensured we weren’t maintaining a feature that fell short of our quality standards. The results were significant:</p><ul><li>Cost Savings: $5,080 annually by shutting down associated compute resources.</li><li>Simplified Architecture: Eliminated 38,368 lines of code, reducing system complexity.</li><li>Enhanced Developer Productivity: Faster iterations and reduced cognitive load for our team.</li><li>Easier Maintenance: Fewer potential failure points and simplified processes.</li><li>Improved Focus: Resources redirected to features providing more value to our customers.</li></ul><p>The key takeaway from this initiative is the importance of continually evaluating our product features. By staying vigilant and identifying components that no longer serve their original purpose due to external changes or evolving user needs, we can proactively retire them. This approach not only reduces complexity and operational costs but also ensures our platform remains lean and agile.</p><h4>Eliminating Unused Services: $432</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l7-QK99r5RItGOGrqIO-aw.png" /></figure><p>In our ongoing effort to optimize costs, a routine inspection of AWS Cost Explorer revealed an unexpected charge: we were paying $36 monthly for AWS Global Accelerator, a service we weren’t actively using.</p><p>Further investigation uncovered that this service had been enabled by one of our developers for a proof of concept (POC) that never became a platform feature. The Global Accelerator instance, however, remained active, silently accruing charges.</p><p>This discovery presented us with a classic “low-hanging fruit” opportunity. By simply stopping this unused service, we immediately reduced our monthly AWS bill by $36, translating to an annual saving of $432.</p><p>Key takeaways from this experience:</p><ul><li>Regular cost reviews can reveal unexpected savings opportunities.</li><li>It’s crucial to track and clean up resources used for POCs.</li><li>Even seemingly small monthly costs can add up to significant annual savings.</li></ul><p>This incident reinforced the importance of vigilance in cost management. We’re now implementing processes to better track POC projects and their associated resources, ensuring our AWS environment remains lean and efficient. It’s a reminder that in cloud infrastructure management, sometimes the most impactful savings come from simply eliminating what’s no longer needed.</p><h3>Conclusion</h3><p>Our journey of cost optimization at Grabyo has been both challenging and rewarding. Through a combination of performance enhancements, resource optimization, strategic migrations, and service consolidation, we’ve managed to achieve annual savings of approximately $500,000. This significant reduction in our AWS costs not only improves our bottom line but also allows us to reinvest these savings into innovation and growth.</p><p>Key lessons from our experience include:</p><ol><li>Regular Review is Crucial: Continuously monitor and analyze your cloud spend to identify optimization opportunities.</li><li>Think Holistically: Cost savings can come from various sources — from major architectural changes to simple cleanup tasks.</li><li>Embrace New Technologies: Stay informed about new AWS services and features that can offer better performance at lower costs.</li><li>Challenge the Status Quo: Don’t be afraid to question existing setups and explore alternatives, including open-source solutions.</li><li>Automate Where Possible: Tools like our EC2 Cost Detective can prevent unnecessary spending and foster a cost-conscious culture.</li><li>Balance Cost and Function: Always ensure that cost-saving measures don’t compromise the quality or functionality of your services.</li><li>Retire Unused Features: Regularly evaluate your product features and be willing to retire those that no longer provide value.</li><li>Mind the Small Costs: Even small, recurring charges can add up to significant amounts over time.</li></ol><p>As we move forward, we remain committed to continuous improvement and cost optimization. Our journey has shown us that there’s always room for improvement, whether it’s in fine-tuning our existing systems or making bold moves to new technologies.</p><p>We hope that sharing our experiences will inspire and help other organizations in their own cost-efficiency journeys. Remember, every dollar saved is a dollar that can be invested in growth and innovation. The path to optimal cloud cost management is ongoing, but with diligence, creativity, and a willingness to challenge assumptions, significant savings are within reach for any organization.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d632ade5b06" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Half-Million Dollar AWS Diet: Grabyo’s Cost-Cutting Success Story — Part I]]></title>
            <link>https://isaac-martin.medium.com/the-half-million-dollar-aws-diet-grabyos-cost-cutting-success-story-part-i-0d6f3b50724e?source=rss-22629b92f6a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/0d6f3b50724e</guid>
            <category><![CDATA[cloud-cost-optimization]]></category>
            <category><![CDATA[ec2]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[fargate]]></category>
            <dc:creator><![CDATA[Isaac Martin]]></dc:creator>
            <pubDate>Mon, 24 Mar 2025 15:39:10 GMT</pubDate>
            <atom:updated>2025-09-17T18:13:53.805Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Half-Million Dollar AWS Diet: Grabyo’s Cost-Cutting Success Story — Part I</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mYRmrsoSDdzHnFH6PGRZqA.png" /></figure><h3>Introduction</h3><p>At Grabyo, our engineering team thrives on innovation, constantly pushing the boundaries with cutting-edge technologies. As the head of the Platform team, my focus has traditionally centered on elevating developer experience and maintaining ironclad security. However, the landscape shifted dramatically in early 2023 when our CEO initiated a company-wide cost optimization drive.</p><p>This directive prompted a strategic pivot. While continuing our efforts in developer experience and security, we expanded our scope to include aggressive cost optimization. Over the subsequent months, we meticulously dissected our infrastructure, hunting for inefficiencies and opportunities to streamline.</p><p>The results were remarkable: we managed to slash Grabyo’s annual AWS spend by nearly half a million pounds. This post, the first in a two-part series, details the initial phase of our journey, sharing the strategies employed, challenges encountered, and key insights gained.</p><h3>Our Approach: Leveraging AWS Cost Explorer for Strategic Insights</h3><p>Our cost-saving odyssey began with a deep dive into AWS Cost Explorer. This powerful tool provided crucial insights into our spending patterns across all AWS accounts and services.</p><p>The approach was methodical:</p><ol><li>Analyze utilization of every AWS service</li><li>Prioritize high-impact areas with the most significant saving potential</li><li>Examine expenditure history over the past few years</li><li>Identify anomalies where spending didn’t align with platform growth</li></ol><p>This process uncovered both justified cost increases (like higher network traffic due to enhanced security measures) and unwarranted spikes (such as a malfunctioning content deletion system leading to unnecessary S3 storage costs).</p><h3>Our Cost-Saving Strategy: A Four-Pronged Approach</h3><p>Our journey to optimize AWS costs was guided by four key strategies:</p><ul><li><strong>Enhancing system performance:</strong> We focused on improving the efficiency of our existing systems, allowing us to do more with less.</li><li><strong>Optimizing resource allocation:</strong> We identified and eliminated waste, ensuring our resources were used effectively.</li><li><strong>Strategic service migrations:</strong> We explored alternative services that could provide similar or better functionality at a lower cost.</li><li><strong>Retiring and consolidating services:</strong> We critically evaluated our services, retiring those that were no longer providing value and consolidating where possible.</li></ul><p>These strategies formed the backbone of our decision-making process, helping us prioritize our efforts and maximize our cost savings. In the following sections, we’ll dive into specific initiatives that exemplify each of these strategies.</p><h3>Performance Enhancements and Refinements</h3><h4>Live Encoder Performance Tuning: $320,000</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rMnYoiK7iJ4HuLA6vVrzuA.png" /></figure><p>At Grabyo, live encoding forms the core of our operations, consuming a significant portion of our infrastructure budget. When we embarked on our cost-saving journey, it was the obvious place to start. This initiative not only yielded the most substantial savings but was also surprisingly straightforward to implement, slashing our EC2 costs by $320,000 per year — accounting for nearly 70% of our total cost savings.</p><p>We’ve always prioritized keeping our live encoding fleet current with the latest instance families. Newer generations typically offer improved performance at a slightly lower cost, providing consistent benefits in efficiency and economy. During our most recent instance family upgrade, however, we discovered something extraordinary.</p><p>Beyond the expected minor cost reduction, we observed a significant performance increase. This boost was substantial enough to allow us to reduce the instance size of our live encoders by half without compromising on quality or capabilities. It was an unexpected windfall, turning a routine upgrade into a major cost-saving opportunity.</p><p>While we’re excited to share our success, we also need to protect our competitive edge. The specific instance families and sizes we use are closely guarded secrets — they’re key to Grabyo’s efficient live encoding. But the principle remains: always be on the lookout for opportunities to optimize, even in areas where you think you’ve already maximized efficiency.</p><h4>Fargate Rightsizing: $14,400</h4><p>Our cost optimization efforts revealed an unexpected issue within our AWS Fargate-based microservices: systemic over-provisioning caused by our own microservices template.</p><p>The template, designed to accelerate development with boilerplate code, included overly generous default resource allocations. This “one-size-fits-all” approach ensured smooth operation but led to excessive unused capacity across many services.</p><p>We conducted a thorough review of our Fargate-based services, analyzing CPU and memory usage patterns. Through careful optimization, we right-sized our Fargate tasks to match each service’s actual requirements while maintaining a safety buffer.</p><p>Key outcomes:</p><ul><li>Reduced AWS costs by $1,200 monthly ($14,400 annually)</li><li>Refined our microservices template with more appropriate default allocations</li><li>Established a new best practice: running databases and services within a 50% to 70% utilization range</li></ul><p>The Fargate performance tuning initiative reminds us that optimizing cloud costs often involves fine-tuning small, everyday defaults that can have a large cumulative impact.</p><h4>Database Architecture Rethinking: $10,140</h4><p>In the world of microservices, the principle of “one service, one database” is often treated as gospel. At Grabyo, we had diligently followed this rule across our infrastructure, encompassing ElastiCache for caching, RDS for microservices databases, and OpenSearch for analytics. While this approach promised perfect isolation, it led us down a path of increasing inefficiency and complexity.</p><p>As our platform grew, so did our challenges. We found ourselves managing a sprawling landscape of underutilized databases, each incurring full costs despite often minimal usage. The overhead of maintaining these numerous instances became a significant burden on our team. Perhaps most concerning, the high cost and effort required to deploy new services with dedicated databases began to stifle our ability to innovate and scale efficiently.</p><p>It was clear that a change was needed, but the solution wasn’t immediately obvious. How could we optimize without sacrificing the benefits of isolation? The answer came in the form of a comprehensive strategy that would transform our database infrastructure.</p><p>Our approach centered on consolidation across our entire database ecosystem. We merged all databases of each type into a single cluster, leveraging built-in auto-scaling for ElastiCache and OpenSearch. The game-changer was our approach to RDS: we transitioned all microservices to a shared Aurora Serverless cluster. Aurora Serverless’s automatic scaling mitigated the typical challenges of shared databases, giving us confidence in our consolidation strategy. For ElastiCache and OpenSearch, we also migrated to AWS’s ARM-based Graviton processors, yielding a 20% cost reduction while maintaining or improving performance. Finally, we enhanced security by relocating all database services to private subnets, eliminating the need for public Elastic IPs and further reducing costs.</p><p>The results of this unified approach were remarkable:</p><ul><li>ElastiCache optimization: $4,880 annual savings</li><li>Microservices database consolidation (RDS): $1,600 annual savings</li><li>OpenSearch consolidation: $3660 annual savings</li></ul><p>Beyond the financial benefits, we saw dramatic improvements in resource utilization and scalability, particularly with Aurora Serverless adeptly handling our microservices’ varying workloads.</p><p>Perhaps the most significant outcome was the removal of barriers to innovation. No longer did our teams need to justify the high costs of dedicated databases for new services. This newfound flexibility accelerated our development cycles and allowed us to respond more nimbly to market demands.</p><h4>GP2 to GP3 Migration: $5,475</h4><p>As part of our ongoing efforts to scrutinize every aspect of our infrastructure, we turned our attention to our EC2 instances’ storage. We realized that all our EC2 servers were using General Purpose SSD (gp2) volumes, which had been the standard choice for many years. However, AWS had recently introduced a new generation of General Purpose SSD volumes: gp3.</p><p>The gp3 volumes offered a compelling proposition — significantly lower costs without compromising on performance. In fact, in many cases, gp3 volumes provide better performance than their gp2 counterparts.</p><p>We embarked on a straightforward yet highly effective initiative: migrating all our EC2 servers from gp2 to gp3 volumes. The process was relatively simple, involving minimal downtime and risk.</p><p>The results? This seemingly small change led to an impressive annual saving of $5,475. It’s a perfect example of how staying informed about the latest AWS offerings and being willing to make incremental changes can lead to substantial cost reductions over time.</p><h3>Resource Optimization and Waste Reduction</h3><h4>EC2 Cost Detective Implementation: $27,600</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*ScQNYaqubMFHuazst3KPTw.png" /></figure><p>At Grabyo, our extensive video transcoding operations necessitate significant EC2 usage across our infrastructure. This high utilization isn’t limited to our production environments; it extends to our development and sales processes as well. Our engineering team relies on EC2 encoders for development and testing, while our sales and marketing teams frequently spin up instances to demonstrate our platform to potential clients.</p><p>To keep our operational costs in check, we’ve always encouraged both teams to shut down these non-production instances when they’re no longer needed. However, relying on manual shutdown processes was far from foolproof. Instances were often left running unnecessarily, silently accumulating costs.</p><p>Enter the EC2 Cost Detective — our automated solution to this persistent problem. This service monitors EC2 usage across all our regions and accounts, focusing on non-client instances. When it detects a server that’s been running for over 8 hours without a valid reason (i.e., not associated with a real client), it sends an alert to our team via Slack.</p><p>The implementation of EC2 Cost Detective yielded immediate and substantial results. We quickly identified and shut down numerous forgotten instances, leading to direct savings of approximately $27,600 per year in unnecessary EC2 costs.</p><p>However, the true value of this initiative extends beyond these quantifiable savings. The proactive nature of our alerting system has prevented countless instances from running unnecessarily for extended periods. While it’s challenging to put an exact figure on these preventive savings, we estimate they significantly surpass our directly measurable cost reductions.</p><p>Moreover, EC2 Cost Detective has fostered a culture of cost-awareness among our teams. The regular Slack notifications serve as constant reminders of the impact of our infrastructure usage, encouraging more mindful resource management across the organization.</p><h4>AMI &amp; Docker Cost Detective: $21,612</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k7oIODLcgIvfgrDLy8n88A.png" /></figure><p>At Grabyo, our commitment to immutable infrastructure has long been a cornerstone of our deployment strategy. Each software release spawns a new Amazon Machine Image (AMI) for our EC2 instances and a new Docker image for our containerized services. This approach facilitates our blue/green deployments and ensures consistent, reliable infrastructure. However, it inadvertently led to significant, and initially overlooked, cost centers.</p><p>The problem emerged gradually. As our release frequency increased, so did our AMI and Docker image production rates. Coupled with the cumulative effect of years of retention, we found ourselves facing mounting AMI and Docker image storage costs. The root cause? A lack of structured lifecycle management for both AMIs and Docker images in our systems.</p><p>To tackle this issue, we developed the AMI &amp; Docker Cost Detective. This tool operates by:</p><ol><li>Scanning all AMIs and Docker images across our AWS accounts</li><li>Cross-referencing AMIs with existing launch templates and launch configurations, and Docker images with task definitions in Fargate</li><li>Identifying resources that are:<br>a) Not referenced by any active configurations or task definitions<br>b) Older than three months, while preserving the latest 10 versions</li><li>Automatically removing the identified AMIs and Docker images</li></ol><p>The implementation of AMI &amp; Docker Cost Detective yielded immediate and substantial results. The total annual savings from this initiative amount to $21,612, an 83% reduction in our combined AMI and Docker image storage costs. Moreover, this figure doesn’t capture the full impact of the Cost Detective. By implementing this solution, we’ve also prevented all the compounding costs that would have accumulated if we had continued without a structured deletion process.</p><p>It’s worth noting that for our newer AMI build processes, we now rely on AWS EC2 Image Builder, which provides native AMI lifecycle management. However, this service wasn’t available when we initially set up our AMI creation workflows. The AMI &amp; Docker Cost Detective continues to play a crucial role in managing our legacy systems that predate our EC2 Image Builder implementation.</p><p>This initiative underscores the importance of implementing structured lifecycle management for all types of infrastructure images. By addressing both AMIs and Docker images with a unified approach, we’ve significantly reduced our storage costs while maintaining the flexibility and reliability our development and deployment processes require.</p><h4>ElasticIP Management Optimization: $9,482</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-j_4MXyO0U5WNjNGccGUPQ.png" /></figure><p>Our cost-saving journey led us to an often-overlooked area: Elastic IP (EIP) management. We discovered we were incurring significant costs for unused public Elastic IPs, a situation stemming from our unique operational requirements.</p><p>At Grabyo, our encoders frequently need to connect to client infrastructure, necessitating IP allowlisting for content access. This requirement obliges us to maintain a pool of Elastic IPs for our client encoders. However, our investigation revealed inefficiencies in our EIP management, particularly in client offboarding processes.</p><p>To address this, we developed “ElasticIP Detective,” a system that maps all Elastic IPs across our accounts to their corresponding Grabyo organization or infrastructure. This tool alerts us when organizations leave, enabling prompt release of associated IPs and preventing unnecessary ongoing expenses.</p><p>We also identified optimization opportunities in our application server and database setups. Historically, these ran in public subnets, protected by security groups. As part of this initiative, we migrated these components to private subnets, eliminating the need for public IP allocation.</p><p>The combined effect of improved EIP management and infrastructure relocation was substantial, yielding annual savings of $9,482.</p><h3>Conclusion of Part I</h3><p>In this first part of our cost optimization journey, we’ve explored the quick wins and performance enhancements that led to significant savings. Through our efforts in tuning live encoders, optimizing Fargate performance, rethinking our database architecture, and implementing smart detection systems, we’ve achieved a total saving of $409,644 annually.</p><p>Our journey demonstrates the power of systematic analysis and targeted optimizations. We’ve seen how small changes, like switching from gp2 to gp3 volumes, can lead to substantial savings. We’ve also learned the importance of challenging established practices, as seen in our database consolidation efforts.</p><p>But our journey doesn’t end here. In Part II, we’ll delve into our strategic changes and long-term optimizations, including service migrations and retirement of unused systems. We’ll see how these moves not only further reduced our costs but also streamlined our operations and improved our overall system architecture. Stay tuned for more insights and lessons learned in our AWS cost optimization journey!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0d6f3b50724e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Going Codeless with AWS API Gateway and Step Functions]]></title>
            <link>https://isaac-martin.medium.com/from-code-to-codeless-my-quest-to-simplify-with-aws-sam-api-gateway-and-step-functions-4ce9243e9517?source=rss-22629b92f6a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ce9243e9517</guid>
            <category><![CDATA[aws-step-functions]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[serverless]]></category>
            <dc:creator><![CDATA[Isaac Martin]]></dc:creator>
            <pubDate>Fri, 06 Dec 2024 12:12:34 GMT</pubDate>
            <atom:updated>2025-09-08T08:50:42.237Z</atom:updated>
            <content:encoded><![CDATA[<h3>Embarking on an Uncharted Path</h3><p>This idea came out of nowhere: <strong>what if I could take a fully coded microservice and rebuild it with almost no code at all?</strong> Bold? Definitely. Maybe even a little reckless. But it felt like the kind of challenge worth chasing. With AWS SAM, API Gateway, and Step Functions in hand, I wanted to see if I could strip a simple TypeScript-based SAM microservice down to its bare bones. What I didn’t expect was how many twists, hurdles, and little lightbulb moments I’d run into along the way. <strong>Here’s what happened when I went all in on serverless simplicity.</strong></p><h3>The Spark Behind the Journey</h3><p>The motivation was pretty simple: <strong>write less code, make life easier</strong>. Fewer lines to maintain means fewer bugs, less technical debt, and more time to solve actual business problems. I’d spent too many hours babysitting codebases that did little more than keep the lights on — especially when AWS was rolling out new native features every other month.</p><p>There was another reason too. <strong>We always got stuck in language wars when building microservices.</strong> In a Java-heavy team, Java was the safe default. Our DevSecOps folks leaned towards Go for its performance, while others argued for TypeScript because of its tight fit with AWS serverless. These debates burned time and split the way we built things.</p><p>Going down the <strong>codeless path</strong> looked like a way out. No language lock-in meant no endless debates, easier collaboration, and services that were accessible to everyone on the team.</p><p>And then there’s the cold start issue with Lambda. Sure, most users don’t notice those few seconds of delay — but to me, it felt wasteful. I couldn’t help but think: <em>What if I could push AWS serverless to the edge and build something truly lean?</em>Something without custom code, without language baggage, and without those pesky cold starts.</p><h3>Setting the Stage: The Original Microservice</h3><p>To appreciate the magnitude of this endeavour, let’s rewind to where it all began — the <strong>GenAI-Media-To-Text microservice</strong>. This was a fresh addition to our platform, designed to infuse AI capabilities by generating titles and descriptions for social media from video clips.</p><p>Initially, this service was built using AWS SAM with TypeScript. The <strong>API Gateway</strong> routed requests to <strong>Lambda functions</strong>, which housed the core business logic. Here’s a snippet of the original TypeScript code:</p><pre>export const lambdaHandler = async (event: APIGatewayProxyEvent): Promise&lt;APIGatewayProxyResult&gt; =&gt; {<br>    try {<br>        // 1 - Validate JWT<br>        let jwtResult: JwtResult;<br>        try {<br>            jwtResult = await GrabyoJWTUtils.getInstance().extractAndValidateGrabyoJwt(event);<br>        } catch (error) {<br>           ...<br>        }<br><br>        // 2 - Use the RequestValidator to validate the incoming request<br>        const validator = RequestValidator.getInstance();<br>        const { isValid, error, value } = validator.validateRequest(event, createJobSchema);<br>          <br>        ...<br><br>        // 3 - Request pres-signed URL media<br>        finalMediaUrl = await uDVRManager.getInstance().getuDVRPreSignedUrl(params, jwtResult.rawToken);<br>        <br>        ...<br><br>        // 4 - Request AI job<br>        const aiResponse = await AIManager.getInstance().createTranscribeJob(finalMediaUrl);<br><br>        return {<br>            statusCode: 200,<br>            body: aiResponse,<br>        };<br>    } catch (err) {<br>        console.log(err);<br>        return {<br>            statusCode: 500,<br>            body: JSON.stringify({<br>                message: &#39;some error happened&#39;,<br>            }),<br>        };<br>    }<br>};</pre><p>Let’s rewind for a moment to where this all kicked off — the <strong>GenAI-Media-To-Text microservice</strong>. We wanted to spice up our platform by adding a bit of AI magic: automatically generating titles and descriptions for social media straight from video clips.</p><p>At first, the service followed a pretty standard playbook: built with AWS SAM and TypeScript. <strong>API Gateway</strong> would catch the requests and hand them over to <strong>Lambda functions</strong>, where the business logic lived. Clean, reliable, and code-heavy.</p><p>Here’s a quick look at what that original TypeScript setup looked like:</p><p>And the corresponding YAML configuration:</p><pre>...<br><br>Resources:<br>  ApiGatewayApi:<br>    Type: AWS::Serverless::Api<br>    Properties:<br>      StageName: prod<br>      TracingEnabled: true<br>    Metadata:<br>      SamResourceId: ApiGatewayApi<br><br>  ApiCustomDomain:<br>    ...<br>  ApiCustomDomainMapping:<br>    ...<br>  ApiGatewayApiDnsRecord:<br>    ...<br><br>  CreateJobFunction:<br>    Properties:<br>      CodeUri: src/<br>      Handler: CreateJob.lambdaHandler<br>      Runtime: nodejs20.x<br>      Architectures:<br>        - x86_64<br>      Environment:<br>        Variables:<br>          ...<br>      Policies:<br>        ...<br>      Events:<br>        CreateJob:<br>          Type: Api<br>          Properties:<br>            RestApiId:<br>              Ref: ApiGatewayApi<br>            Path: /jobs<br>            Method: post<br>    Metadata: # Manage esbuild properties<br>      BuildMethod: esbuild<br>      BuildProperties:<br>        Minify: true<br>        Target: es2020<br>        Sourcemap: true<br>        EntryPoints:<br>          - CreateJob.ts<br><br>  GetJobFunction:<br>    Properties:<br>      CodeUri: src/<br>      Handler: GetJob.lambdaHandler<br>      Runtime: nodejs20.x<br>      Architectures:<br>        - x86_64<br>      Environment:<br>        Variables:<br>          ...<br>      Policies:<br>        ...<br>      Events:<br>        GetJob:<br>          Type: Api<br>          Properties:<br>            RestApiId:<br>              Ref: ApiGatewayApi<br>            Path: /jobs/{id}<br>            Method: get<br>    Metadata: # Manage esbuild properties<br>      BuildMethod: esbuild<br>      BuildProperties:<br>        Minify: true<br>        Target: es2020<br>        Sourcemap: true<br>        EntryPoints:<br>          - GetJob.ts<br><br>  ApplicationResourceGroup:<br>    Type: AWS::ResourceGroups::Group<br>    Properties:<br>      Name:<br>        Fn::Sub: ApplicationInsights-SAM-${AWS::StackName}<br>      ResourceQuery:<br>        Type: CLOUDFORMATION_STACK_1_0<br>  ApplicationInsightsMonitoring:<br>    Type: AWS::ApplicationInsights::Application<br>    Properties:<br>      ResourceGroupName:<br>        Ref: ApplicationResourceGroup<br>      AutoConfigurationEnabled: &quot;true&quot;<br>Outputs:<br>  JobsAPI:<br>    Description: API Gateway endpoint URL for Prod stage for Jobs<br>    Value: !Sub &quot;https://${APIDomainName}/jobs/&quot;<br>  CreateJobFunction:<br>    Description: CreateJobFunction ARN<br>    Value: !GetAtt CreateJobFunction.Arn<br>  GetJobFunction:<br>    Description: GetJobFunction ARN<br>    Value: !GetAtt GetJobFunction.Arn</pre><p>The Lambda function performed several key tasks:</p><ol><li><strong>Validate the JWT</strong> to authenticate users.</li><li><strong>Validate incoming parameters</strong>.</li><li><strong>Generate a pre-signed URL</strong>.</li><li><strong>Send a request to the AI service</strong>.</li><li><strong>Process the AI service response</strong> and send it back.</li></ol><p>While functional, I couldn’t shake the feeling that there was a more efficient way to achieve the same results.</p><h3>Step 1: Offloading Logic to Step Functions</h3><p>The first step of my journey was to <strong>offload some of the business logic to AWS Step Functions</strong>. The idea was to replace the direct call to the AI service and the parsing of the API request within the Lambda function with a Step Function that could handle these tasks independently.</p><p>To implement this change, we removed these lines of code:</p><pre>...<br>// 4 - Request AI job<br>        const aiResponse = await AIManager.getInstance().createTranscribeJob(finalMediaUrl);<br><br>        return {<br>            statusCode: 200,<br>            body: aiResponse,<br>        };<br>...</pre><p>And added these lines:</p><pre>...<br>        // 4 - Start the Step Function execution synchronously<br>        const command = new StartSyncExecutionCommand({<br>            stateMachineArn: process.env.STEP_FUNCTION_ARN, // Make sure this is an Express workflow ARN<br>            input: JSON.stringify({<br>                &quot;mediaUrl&quot;: finalMediaUrl<br>            })<br>        });<br>        const sfnClient = new SFNClient({});<br>        const response = await sfnClient.send(command);<br>        // Parse the output from the Step Function<br>        const stepFunctionOutput = JSON.parse(response.output || &#39;{}&#39;);<br><br>        return {<br>            statusCode: stepFunctionOutput.statusCode,<br>            body: stepFunctionOutput.body,<br>        };<br>...</pre><p>We also updated the Lambda’s SAM template to include the required IAM permissions to call the Step Function:</p><pre>...<br>        - Statement:<br>            - Sid: CallStepFunction<br>              Effect: Allow<br>              Action:<br>                - states:StartExecution<br>                - states:StartSyncExecution<br>              Resource:<br>                - !GetAtt CreateJobStateMachine<br>...</pre><p>In addition, we needed to define the new Step Function in our SAM template:</p><pre>...<br><br>Resources:<br>  ########################<br>  ## GENERIC COMPONENTS ##<br>  ########################<br>  EventBridgeConnection:<br>    Type: &quot;AWS::Events::Connection&quot;<br>    Properties:<br>      Name: !Sub &quot;${ParentStackName}-aiservice-credentials&quot;<br>      Description: &quot;The credentials to the AI service API&quot;<br>      AuthorizationType: API_KEY<br>      AuthParameters:<br>        ApiKeyAuthParameters:<br>          ApiKeyName: X-API-Key<br>          ApiKeyValue: !Sub &quot;{{resolve:secretsmanager:${SecretsManagerAIServiceAPIKey}:SecretString}}&quot;<br><br>  StateMachineRole:<br>    Type: AWS::IAM::Role<br>    Properties:<br>      AssumeRolePolicyDocument:<br>        Version: &quot;2012-10-17&quot;<br>        Statement:<br>          - Effect: Allow<br>            Principal:<br>              Service: states.amazonaws.com<br>            Action: &quot;sts:AssumeRole&quot;<br>      Policies:<br>        - PolicyName: InvokeHTTPCall<br>          PolicyDocument:<br>            Version: &quot;2012-10-17&quot;<br>            Statement:<br>              - Effect: Allow<br>                Action:<br>                  - &quot;states:InvokeHTTPEndpoint&quot;<br>                Resource: &quot;XX&quot;<br>        - PolicyName: RetrieveCredentials<br>          PolicyDocument:<br>            Version: &quot;2012-10-17&quot;<br>            Statement:<br>              - Effect: Allow<br>                Action:<br>                  - &quot;events:RetrieveConnectionCredentials&quot;<br>                Resource: !GetAtt EventBridgeConnection.Arn<br>              - Effect: Allow<br>                Action:<br>                  - &quot;secretsmanager:GetSecretValue&quot;<br>                  - &quot;secretsmanager:DescribeSecret&quot;<br>                Resource: !GetAtt EventBridgeConnection.SecretArn<br>        - PolicyName: StepFunctionsCloudWatchLogs<br>          PolicyDocument:<br>            Version: &quot;2012-10-17&quot;<br>            Statement:<br>              - Effect: Allow<br>                Action:<br>                  - &quot;logs:CreateLogDelivery&quot;<br>                  - &quot;logs:GetLogDelivery&quot;<br>                  - &quot;logs:UpdateLogDelivery&quot;<br>                  - &quot;logs:DeleteLogDelivery&quot;<br>                  - &quot;logs:ListLogDeliveries&quot;<br>                  - &quot;logs:PutResourcePolicy&quot;<br>                  - &quot;logs:DescribeResourcePolicies&quot;<br>                  - &quot;logs:DescribeLogGroups&quot;<br>                Resource: &quot;XXX&quot;<br>        - PolicyName: StepFunctionsExecution<br>          PolicyDocument:<br>            Version: &quot;2012-10-17&quot;<br>            Statement:<br>              - Effect: Allow<br>                Action:<br>                  - &quot;states:StartExecution&quot;<br>                  - &quot;states:StopExecution&quot;<br>                  - &quot;states:DescribeExecution&quot;<br>                Resource: &quot;XXX&quot;<br><br>  ################<br>  ## CREATE JOB ##<br>  ################<br>  CreateJobStateMachine:<br>    Type: AWS::Serverless::StateMachine<br>    Properties:<br>      Name: !Sub &quot;${ParentStackName}-create-job&quot;<br>      DefinitionUri: api-create-job.json<br>      Type: EXPRESS<br>      Logging:<br>        Destinations:<br>          - CloudWatchLogsLogGroup:<br>              LogGroupArn: !GetAtt CreateJobStateMachineLogGroup.Arn<br>        ...<br>      Role: !GetAtt StateMachineRole.Arn<br>      DefinitionSubstitutions:<br>        EventBridgeConnectionArn: !GetAtt EventBridgeConnection.Arn<br><br>  CreateJobStateMachineLogGroup:<br>    Type: AWS::Logs::LogGroup<br>    Properties:<br>      LogGroupName: !Sub &quot;/aws/vendedlogs/states/${ParentStackName}-create-job&quot;<br>      RetentionInDays: 7<br>...</pre><p>The new Step Function orchestrated the workflow and looked like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CJNIWda-8D1NVboho5hg1A.png" /></figure><p>A few important points about this change:</p><ul><li><strong>Defining a New IAM Role</strong>: We had to create a new IAM role to allow the Step Function to perform its actions. This role grants the necessary permissions for the Step Function to interact with other AWS services and resources.</li><li><strong>EventBridge Connection for Third-Party API Calls</strong>: Calling a third-party API from within the Step Function required including the API token in an EventBridge connection. This is a security requirement for Step Functions when interacting with external services.</li><li><strong>Choosing the Right Step Function Type</strong>: A critical consideration was the choice between Step Function types. To handle API requests <strong>synchronously</strong>, it’s essential to use the <strong>Express Workflow</strong>, as the Standard Workflow is intended for asynchronous tasks.</li><li><strong>Manual Creation of CloudWatch Logs</strong>: Because the Step Function is asynchronous, we had to manually create the CloudWatch Logs configuration. This is something that AWS SAM would automatically handle if the Step Function were a Standard Workflow.</li></ul><p>This move not only offloaded significant logic from the Lambda function but also set the stage for a more modular and efficient architecture. By delegating responsibilities to the Step Function, we reduced the complexity within the Lambda and leveraged AWS’s orchestration capabilities to manage the workflow more effectively.</p><h3>Step 2: Moving JWT Validation to API Gateway</h3><p>Next up was the JWT validation. Originally performed within a Lambda function, this step added unnecessary latency and contributed to cold starts. <strong>I needed a better solution.</strong></p><p>Enter the <strong>Lambda authorizer</strong> in API Gateway. By offloading JWT validation to API Gateway, authentication became decoupled from the core business logic. This shift meant that only authenticated requests would reach the Step Function, enhancing both security and efficiency.</p><p>The API Gateway authorizer was configured in the SAM template:</p><pre>...<br>Resources:<br>  ApiGatewayApi:<br>    Type: AWS::Serverless::Api<br>    Properties:<br>      StageName: prod<br>      TracingEnabled: true<br>      # ⭐️ LAMBDA AUTHORIZER<br>      Auth:<br>        DefaultAuthorizer: GenAIMediaToTextAuthorizer<br>        Authorizers:<br>          GenAIMediaToTextAuthorizer:<br>            FunctionPayloadType: REQUEST<br>            FunctionArn: !GetAtt GenAiMediaToTextAuthorizerFunction.Arn<br>            Identity:<br>              ReauthorizeEvery: 0<br>...<br>   GenAiMediaToTextAuthorizerFunction:<br>    Type: AWS::Serverless::Function<br>    Properties:<br>      CodeUri: src/<br>      Handler: LambdaAuthorizer.lambdaHandler<br>      Runtime: nodejs20.x<br>      Architectures:<br>        - x86_64<br>      ...           <br>...</pre><p>This is the code of the new GenAiMediaToTextAuthorizerFunction:</p><pre>export const lambdaHandler = async (event: APIGatewayRequestAuthorizerEvent): Promise&lt;APIGatewayAuthorizerResult&gt; =&gt; {<br><br>    // Validate JWT<br>    let jwtResult: JwtResult;<br>    try {<br>        jwtResult = await GrabyoJWTUtils.getInstance().extractAndValidateGrabyoJwt(event);<br>    } catch (error) {<br>        console.error(&#39;JWT validation failed:&#39;, error);<br>        return {<br>            principalId: &#39;user&#39;,<br>            policyDocument: {<br>                Version: &#39;2012-10-17&#39;,<br>                Statement: [<br>                    {<br>                        Action: &#39;execute-api:Invoke&#39;,<br>                        Effect: &#39;Deny&#39;,<br>                        Resource: event.methodArn,<br>                    },<br>                ],<br>            }<br>        };<br>    };<br><br>    return {<br>        principalId: &#39;user&#39;,<br>        policyDocument: {<br>            Version: &#39;2012-10-17&#39;,<br>            Statement: [<br>                {<br>                    Action: &#39;execute-api:Invoke&#39;,<br>                    Effect: &#39;Allow&#39;,<br>                    Resource: event.methodArn,<br>                },<br>            ],<br>        },<br>        context: {<br>            &quot;organizationId&quot;: jwtResult.payload.organizationId,<br>            &quot;userId&quot;: jwtResult.payload.sub<br>        }<br>    };<br>}</pre><p>With this change, we can skip entirely the JWT validation in the initial lambda. This is the code removed:</p><pre>// 1 - Validate JWT<br>let jwtResult: JwtResult;<br>try {<br>    jwtResult = await GrabyoJWTUtils.getInstance().extractAndValidateGrabyoJwt(event);<br>} catch (error) {<br>   ...<br>}</pre><p>A couple of key insights emerged from this transition:</p><ul><li><strong>Policy Responses</strong>: The Lambda authorizer needed to respond with a policy allowing or denying the request, maintaining strict access control.</li><li><strong>Context Passing</strong>: The JWT contained vital data required downstream (organizationId and userId). By leveraging the context feature in the policy, I ensured this data was passed along seamlessly.</li></ul><h3>Step 3: Parameter Validation and Direct Step Function Invocation</h3><p>With authentication now streamlined, my next focus was on <strong>parameter validation</strong> and enabling <strong>direct invocation of the Step Function from API Gateway</strong>. This step significantly transformed the API definition, introducing a considerable amount of YAML configuration. Let’s walk through the changes that were necessary to achieve this.</p><h4>Granting Permissions with a New IAM Role</h4><p>First, I needed to create a new <strong>IAM Role</strong> to grant API Gateway the necessary permissions to invoke the Step Functions. Since API Gateway doesn’t inherently have permissions to interact with other AWS services on your behalf, defining this role was essential for secure and controlled interactions, allowing API Gateway to start executions of the Step Functions directly.</p><h4>Implementing Request Validation</h4><p>Next, I set up a <strong>request validator</strong> in API Gateway to ensure that incoming requests met the required criteria before being processed. Validators check whether the necessary parameters are present and conform to the specified schema, enhancing security and reliability by preventing malformed or invalid requests from reaching downstream services.</p><h4>Defining Models for Data Structures</h4><p>To complement the validator, I defined <strong>models</strong> representing the expected data structures in the requests. These models serve as schemas that outline the structure of the API’s request and response payloads, providing a blueprint for data validation and ensuring consistency.</p><h4>Configuring API Paths and Integrations</h4><p>Finally, I redefined the <strong>API paths</strong> for the different endpoints, specifying how API Gateway should handle requests and interact with the Step Functions. This involved detailing the HTTP methods, setting up request and response mappings, and utilizing templates to appropriately transform the data.</p><p>An important part of this configuration was introducing additional <strong>VTL (Velocity Template Language) code</strong>. This code was crucial for preprocessing the request data before it reached the Step Functions. It handled necessary transformations such as extracting tokens, adding timestamps, and mapping the incoming HTTP requests into the format expected by the Step Functions.</p><h3>The Complete YAML Definition</h3><p>After implementing these changes, the YAML configuration for the API grew substantially. Below is the complete YAML definition that encapsulates all the components — roles, validators, models, paths, and integrations.</p><p>This is the API Gateway role:</p><pre># ⭐️ API GATEWAY CONFIGURATION<br>GenAiMediaToTextApiGateway:<br>  Type: AWS::Serverless::Api<br>  Properties:<br>    StageName: prod<br>    TracingEnabled: true<br>    # ⭐️ LAMBDA AUTHORIZER<br>    Auth:<br>      DefaultAuthorizer: GenAIMediaToTextAuthorizer<br>      Authorizers:<br>        GenAIMediaToTextAuthorizer:<br>          FunctionPayloadType: REQUEST<br>          FunctionArn: !GetAtt GenAiMediaToTextAuthorizerFunction.Arn<br>          Identity:<br>            ReauthorizeEvery: 0<br>    DefinitionBody:<br>      openapi: &quot;3.0.0&quot;<br>      info:<br>        title: GenAI Media To Text API<br>        version: &quot;1.0&quot;<br>      # ⭐️ VALIDATORS<br>      x-amazon-apigateway-request-validators:<br>        genai-request-validator:<br>          validateRequestParameters: true<br>          validateRequestBody: true<br>      # ⭐️ MODELS<br>      components:<br>        schemas:<br>          CreateJobRequestModel:<br>            title: CreateJobRequestModel<br>            type: object<br>            oneOf:<br>              - properties:<br>                  streamId:<br>                    type: string<br>                    pattern: &quot;^[A-Za-z0-9]{11}$&quot;<br>                  startTimestamp:<br>                    type: number<br>                    minimum: 0<br>                  endTimestamp:<br>                    type: number<br>                    minimum: 0<br>                  prompts:<br>                    type: array<br>                    minItems: 1<br>                    items:<br>                      type: object<br>                      properties:<br>                        name:<br>                          type: string<br>                        prompt:<br>                          type: string<br>                      required:<br>                        - name<br>                        - prompt<br>                required:<br>                  - streamId<br>                  - startTimestamp<br>                  - endTimestamp<br>                  - prompts<br>              - properties:<br>                  mediaUrl:<br>                    type: string<br>                    format: uri<br>                  prompts:<br>                    type: array<br>                    minItems: 1<br>                    items:<br>                      type: object<br>                      properties:<br>                        name:<br>                          type: string<br>                        prompt:<br>                          type: string<br>                      required:<br>                        - name<br>                        - prompt<br>                required:<br>                  - mediaUrl<br>                  - prompts<br>      paths:<br>        # ⭐️ Create Job API<br>        /jobs:<br>          post:<br>            x-amazon-apigateway-request-validator: &quot;genai-request-validator&quot;<br>            requestBody:<br>              content:<br>                application/json:<br>                  schema:<br>                    $ref: &quot;#/components/schemas/CreateJobRequestModel&quot;<br>              required: true<br>            x-amazon-apigateway-integration:<br>              uri: !Sub &quot;arn:aws:apigateway:${AWS::Region}:states:action/StartSyncExecution&quot;<br>              httpMethod: POST<br>              type: aws<br>              credentials: !GetAtt ApiGatewayStepFunctionsRole.Arn<br>              requestParameters:<br>                integration.request.header.Content-Type: &quot;&#39;application/x-amz-json-1.0&#39;&quot;<br>              requestTemplates:<br>                application/json: !Sub |<br>                  #set($currentTimeEpoch = $context.requestTimeEpoch)<br>                  #set($expirationTimestamp = $currentTimeEpoch + (60 * 60 * 1000))<br>                  #set($inputBody = $util.escapeJavaScript($input.body))<br><br>                  {<br>                    &quot;stateMachineArn&quot;: &quot;${CreateJobStateMachine}&quot;,<br>                    &quot;input&quot;: &quot;{\&quot;body\&quot;:$util.escapeJavaScript($input.body),\&quot;expirationTimestamp\&quot;:\&quot;$expirationTimestamp\&quot;,\&quot;authorizer\&quot;:{\&quot;organizationId\&quot;:\&quot;$context.authorizer.organizationId\&quot;,\&quot;userId\&quot;:\&quot;$context.authorizer.userId\&quot;, \&quot;accountId\&quot;: \&quot;$context.accountId\&quot;}}&quot;<br>                  }<br>              passthroughBehavior: &quot;WHEN_NO_MATCH&quot;<br>              responses:<br>                &quot;200&quot;:<br>                  statusCode: &quot;200&quot;<br>                  responseTemplates:<br>                    application/json: |<br>                      #set($stepOutput = $util.parseJson($input.path(&#39;$.output&#39;)))<br>                      $stepOutput.body<br>                &quot;400&quot;:<br>                  statusCode: &quot;400&quot;<br>                  responseTemplates:<br>                    application/json: |<br>                      #set($stepOutput = $util.parseJson($input.path(&#39;$.output&#39;)))<br>                      $stepOutput.body<br>                &quot;500&quot;:<br>                  statusCode: &quot;500&quot;<br>                  responseTemplates:<br>                    application/json: |<br>                      {<br>                        &quot;message&quot;: &quot;Internal server error&quot;<br>                      }<br>            responses:<br>              &quot;200&quot;:<br>                description: &quot;200 response&quot;<br>                content:<br>                  application/json:<br>                    schema:<br>                      $ref: &quot;#/components/schemas/GetJobResponse&quot;<br>              &quot;400&quot;:<br>                description: &quot;400 response&quot;<br>                content:<br>                  application/json:<br>                    schema:<br>                      type: object<br>              &quot;500&quot;:<br>                description: &quot;500 response&quot;<br>                content:<br>                  application/json:<br>                    schema:<br>                      type: object<br>...</pre><p>This is the full API Gateway definition:</p><pre># ⭐️ API GATEWAY ROLE<br>ApiGatewayStepFunctionsRole:<br>  Type: AWS::IAM::Role<br>  Properties:<br>    AssumeRolePolicyDocument:<br>      Version: &quot;2012-10-17&quot;<br>      Statement:<br>        - Effect: Allow<br>          Principal:<br>            Service:<br>              - apigateway.amazonaws.com<br>          Action:<br>            - sts:AssumeRole<br>    Policies:<br>      - PolicyName: StepFunctionsInvokePolicy<br>        PolicyDocument:<br>          Version: &quot;2012-10-17&quot;<br>          Statement:<br>            - Effect: Allow<br>              Action:<br>                - states:StartSyncExecution<br>              Resource:<br>                - !GetAtt CreateJobStateMachine<br>      - PolicyName: LambdaInvokePolicy<br>        PolicyDocument:<br>          Version: &quot;2012-10-17&quot;<br>          Statement:<br>            - Effect: Allow<br>              Action:<br>                - lambda:InvokeFunction<br>              Resource:<br>                - !GetAtt CreateJobStateMachine</pre><p>By laying out the changes before presenting the full YAML, I hope it’s clearer how each component contributes to the overall functionality and why the API definition became more extensive. This expanded template showcases the significant transformation from the original configuration, emphasizing the additional complexity introduced when moving towards a codeless architecture.</p><h3>The Challenges and the Breakthroughs</h3><p>Of course, the journey wasn’t without its challenges.</p><h4>Wrestling with VTL Mappings</h4><p>Working with VTL (Velocity Template Language) in API Gateway was a real patience test. Compared to TypeScript, it felt clunky, and debugging was painful. Every tiny misstep felt like searching for a needle in a haystack.</p><h4>Complexity of Step Functions</h4><p>As the workflow expanded, the Step Functions state machine grew harder to manage. Keeping track of states and transitions demanded extra focus and discipline.</p><h4>Limitations of Step Functions</h4><p>One surprise was just how limited Step Functions could be for basic tasks. For example, I needed a simple <strong>epoch timestamp</strong> — something trivial in code — but Step Functions had no straightforward way to do it without dragging in a Lambda. I ended up writing a bit of VTL in API Gateway:</p><pre>#set($currentTimeEpoch = $context.requestTimeEpoch)<br>#set($expirationTimestamp = $currentTimeEpoch + (60 * 60 * 1000))</pre><p>This workaround highlighted a significant limitation. <strong>Relying on multiple Lambdas within a Step Function can negate the benefits of reduced cold starts</strong>, and in some cases, it might even make performance worse due to the added complexity and latency.</p><h4>Missing Canary Releases and Testing Hooks</h4><p>Another downside was losing <strong>canary releases and testing hooks</strong> that come out-of-the-box with SAM and Lambdas. These safety nets are huge for shipping confidently. Without them, I either had to accept the risk or rebuild similar tooling from scratch.</p><h3>The Wins: Embracing Simplicity</h3><p>Still, the upside was hard to ignore.</p><ul><li><strong>Reduced Operational Overhead</strong>: No more dependency updates, no security patches, and far fewer bugs creeping in. Honestly, it felt freeing.</li><li><strong>Faster Iterations</strong>: Changing workflows in Step Functions and API Gateway was quicker than rewriting and redeploying code.</li><li><strong>Cost Savings</strong>: With fewer Lambdas firing off, costs went down. Direct integrations did more of the heavy lifting for less.</li></ul><h3>Reflecting on the Journey</h3><p>This experiment wasn’t just technical — it pushed me to rethink how I approach building services. <strong>Codeless doesn’t mean effortless.</strong> The complexity didn’t disappear; it just shifted into configs and mappings.</p><p>Step Functions are great, but the limitations show up fast when you go all-in. Simple things like generating a timestamp either meant clever hacks or circling back to Lambda, which reintroduced the very cold starts I was trying to avoid.</p><p>And losing canary releases and testing hooks stung more than I expected. These are the kinds of tools you take for granted until they’re gone.</p><p>In the end, the big takeaway for me is this: the sweet spot usually lies in <strong>blending both worlds</strong> — using codeless orchestration where it shines, and code where it’s simply the better tool.</p><h3>Conclusion: The Road Ahead</h3><p>Rebuilding a TypeScript SAM microservice into a codeless one with API Gateway and Step Functions was an eye-opener. It proved just how far you can push the AWS serverless ecosystem. The simplicity, speed, and cost benefits were real.</p><p>But over time, the cracks started to show. Every new feature demanded either a hack or extra effort to keep things “purely codeless.” At some point, I realized: <strong>if the overhead keeps climbing, falling back to a Lambda-based microservice might be the smarter play.</strong></p><p>So if you’re thinking about this path, my advice is: <strong>start small.</strong> Swap out a single Lambda for a Step Function or a direct integration. See what works, note what doesn’t, and build from there. Don’t be afraid to land on a hybrid approach — it often gives you the best of both worlds.</p><p>Have you tried building codeless architectures, or are you considering it? I’d love to hear what worked for you, what didn’t, and where you see this heading. Let’s swap stories.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ce9243e9517" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Missing Out on the AI Revolution? Here’s What You’re Losing]]></title>
            <link>https://isaac-martin.medium.com/the-ai-advantage-my-six-month-journey-from-skeptic-to-advocate-412771a53a24?source=rss-22629b92f6a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/412771a53a24</guid>
            <category><![CDATA[innovation]]></category>
            <category><![CDATA[the-future-is-here]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Isaac Martin]]></dc:creator>
            <pubDate>Sun, 06 Oct 2024 19:47:21 GMT</pubDate>
            <atom:updated>2024-10-06T19:50:31.042Z</atom:updated>
            <content:encoded><![CDATA[<p>It was a typical Tuesday morning when I first decided to give AI a serious try in my workflow. As an engineering leader with years of experience under my belt, I was skeptical. After all, I’d built my career on my own skills and intuition. How could a machine learning model really improve on that? Little did I know, this decision would mark the beginning of a six-month journey that would completely transform my approach to work and productivity.</p><p>My first foray into AI assistance was for a task that had always been a thorn in my side: writing. As a non-native English speaker, I’d always struggled to polish my writing to a professional standard. It was time-consuming and often frustrating.</p><p>The results were nothing short of astonishing. What usually took me hours of meticulous editing was accomplished in minutes. The AI didn’t just correct grammar; it refined my phrasing, enhanced clarity, and even suggested more impactful ways to present my ideas. Suddenly, I was producing the same high-quality content with just 20% of my previous effort. It was as if I’d unlocked a hidden superpower.</p><p>Emboldened by this success, I began to explore other areas where AI could assist me. As the leader of our platform team, one of my recurring challenges was explaining our complex technical projects to non-technical stakeholders. Our work was crucial for the company’s infrastructure, but conveying its importance often felt like trying to explain quantum physics to a kindergartener.</p><p>That’s when I had an idea. If AI could help me write better, could it also help me communicate more effectively? I spent an evening crafting a detailed prompt for Claude, outlining the structure I wanted for our internal product announcements. The next day, I put it to the test.</p><p>The results exceeded my wildest expectations. The AI-generated announcement took our technical jargon and transformed it into a clear, engaging narrative that anyone in the company could understand. It highlighted the project’s benefits and its impact on our organization in a way that resonated with both the tech team and the marketing department.</p><p>Word spread quickly about these new, accessible updates. Soon, colleagues from all departments were stopping me in the hallway, eager to discuss our latest innovations. For the first time, I felt like the entire organization truly understood and appreciated the work we were doing behind the scenes.</p><p>As the weeks turned into months, I found more and more ways to incorporate AI into my workflow. It became my go-to tool for writing Terraform and CloudFormation code, quickly generating complex infrastructure-as-code templates that would have taken hours to write manually. When I needed to brush up on a technology I hadn’t used in a while, the AI was there with concise, accurate explanations and examples.</p><p>But the real game-changer came just last week, pushing me to share my experiences in this blog post. We had an old JavaScript library for JWT generation and validation that needed a major overhaul. It was a daunting task, especially since I hadn’t worked with some of the auxiliary frameworks.</p><p>At first, I made good progress, updating most of the core libraries without issue. But when it came to upgrading the build processes, linting tools, and deployment scripts, I hit a wall. In the past, this would have been the point where I’d either spend days researching or, more likely, shelve the project as too time-consuming.</p><p>Instead, I turned to my new AI assistant. I described the project, pasted in error messages, and asked for guidance. What followed was like a virtual pair programming session. The AI suggested potential fixes, explained unfamiliar concepts, and helped me debug issues in real-time. In less than a day, we had the library updated, secured, and ready for modern use.</p><p>This experience was a revelation. It wasn’t that the AI was replacing my skills as a developer. Rather, it was augmenting them, filling in gaps in my knowledge and allowing me to take on projects that would have been impractical before. It was like having a brilliant junior developer at my beck and call, one who could instantly recall any documentation I needed and never got tired or frustrated.</p><p>But as I shared my experiences with colleagues, I encountered some resistance. “Won’t this make us lazy?” some asked. “What if we become dependent on it?” others worried. Their concerns reminded me of a story my father often told.</p><p>You see, my father prided himself on knowing the streets of his city by heart. He could navigate from any point to another without a second thought, a skill honed over decades. When GPS systems first became popular, he scoffed. “That’ll make people lose their ability to navigate,” he’d say. “What happens when the technology fails?”</p><p>Fast forward to today, and nearly everyone has a GPS in their pocket. Far from making us helpless, it’s expanded our horizons, allowing us to confidently explore new places and find efficient routes in unfamiliar territories. My father, too, eventually came around, realizing that GPS wasn’t replacing his knowledge but enhancing his ability to navigate.</p><p>I see AI in much the same light. It’s not about replacing our skills or making us lazy. It’s about enhancing our capabilities, allowing us to go further and achieve more than we ever could alone. Just as we wouldn’t choose to navigate a new city without GPS, I believe future engineers will find it unthinkable to work without AI assistance.</p><p>As I reflect on my six-month journey with AI, I’m filled with excitement for the future. I’ve seen firsthand how this technology can dramatically increase our output, allow us to tackle a broader range of tasks with confidence, and free up our human creativity for the most challenging problems.</p><p>The AI revolution isn’t coming — it’s already here. And just like the GPS transformed navigation, AI is reshaping the landscape of productivity across industries. As engineering leaders, we have a choice: embrace this technology and harness its power, or risk falling behind.</p><p>My challenge to you is this: identify one area of your work where you struggle with efficiency. It could be writing, coding, explaining complex concepts, or anything else. Then, explore how AI can help you overcome that challenge. You might just find, as I did, that it opens up a world of new possibilities.</p><p>Remember, the goal isn’t to replace human ingenuity but to augment it. By integrating AI into our workflows, we can free ourselves to focus on what truly matters: innovation, strategic thinking, and pushing the boundaries of what’s possible in our field.</p><p>The future of engineering is AI-assisted. It’s not about losing our skills, but about enhancing them, about going further than we ever could before. The question isn’t whether AI will transform our industry — it’s already happening. The real question is: Are you ready to be at the forefront of this transformation?</p><p>Don’t get left behind reading the metaphorical map while others are using AI to chart new territories. Embrace the AI revolution. Trust me, the view from here is incredible, and the journey has only just begun.</p><blockquote><strong>And yes, I’ll let you in on a little secret: this blog post was generated with AI! Well, to be precise, it was a collaboration between AI and myself. The AI helped structure my thoughts, refine my language, and even suggested some analogies. But the experiences, insights, and enthusiasm? Those are 100% human-generated. Welcome to the future of writing — and working!</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=412771a53a24" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cloud-Native Search: Our Path to a Fully Serverless Architecture]]></title>
            <link>https://isaac-martin.medium.com/cloud-native-search-our-path-to-a-fully-serverless-architecture-ff84c816df8d?source=rss-22629b92f6a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff84c816df8d</guid>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[opensearch]]></category>
            <category><![CDATA[serverless]]></category>
            <dc:creator><![CDATA[Isaac Martin]]></dc:creator>
            <pubDate>Thu, 27 Jun 2024 13:45:55 GMT</pubDate>
            <atom:updated>2024-09-19T16:37:22.961Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s2ATAy0EHQG64oFqjYhssg.png" /></figure><p>Picture this: It’s another bustling day at Grabyo, and our trusty search infrastructure is humming along, helping users find exactly what they need. But behind the scenes, our engineering team has been exchanging knowing glances. Our beloved search cluster, built on AWS ElasticSearch, has been showing its age. It’s not just the growing complexity of our data — it’s the realization that we’re running on borrowed time with a soon-to-be deprecated service.</p><p>One day, over a virtual coffee break, someone finally says what we’ve all been thinking: “Folks, it’s time for an upgrade.”</p><p>And just like that, our search infrastructure saga began. We weren’t setting out to change the world — we just wanted to tackle some much-needed improvements and set ourselves up for future success. Our mission, should we choose to accept it (spoiler: we did), was fourfold:</p><p>First on our list was giving our search cluster a well-deserved upgrade. AWS OpenSearch was calling our name, promising newer features and long-term support. But we knew it wouldn’t be a simple flip of a switch — there’d be code to refactor and libraries to update.</p><p>As we dug deeper, we realized this was our chance to address another pain point — those scheduled maintenance windows when we had to pause data ingestion. “What if,” someone mused, “we could buffer our data somehow?” And thus, our quest for queue-driven insertion began, aiming to make our system more resilient during these necessary maintenance periods.</p><p>But why stop there? Our disaster recovery strategy, while functional, had started to feel a bit like a Rube Goldberg machine — overly complex and always one script away from potential headaches. We dreamed of a more elegant solution, one that could handle our ever-growing data with grace and efficiency.</p><p>And throughout all of this planning, a common theme emerged. More and more, we found ourselves drawn to the world of serverless technologies. It felt like the right direction for Grabyo — more scalable, more manageable, more… well, more us.</p><p>So there we were, with a clear mission and a lot of work ahead. It wasn’t going to be a walk in the park, but we were excited about the possibilities. In this post, we’ll take you along on our journey — the challenges we faced, the decisions we made, and yes, even the facepalm moments (because what’s an engineering project without a few of those?).</p><p>Whether you’re contemplating your own infrastructure upgrades or just curious about what goes on behind the scenes of a search system, we hope you’ll find our story informative, and maybe even a little entertaining. So grab a coffee (or your beverage of choice), and let’s dive into the tale of how we at Grabyo nudged our search infrastructure into the cloud-native era.</p><h3>The Architecture Behind Grabyo’s Search Capabilities</h3><p>To understand the evolution of Grabyo’s search infrastructure, it’s crucial to start with the foundation of our data storage and retrieval system. At the core of our platform lies Amazon DynamoDB, our primary database for storing and managing data. However, while DynamoDB excels in many aspects, it lacks robust search capabilities, particularly for complex queries across multiple attributes or tables.</p><p>This limitation led us to implement OpenSearch (previously Amazon ElasticSearch) as our search engine. OpenSearch allows us to create indexes that enable fast and efficient searching across our data. These indexes are essentially optimized representations of our data, structured for quick retrieval based on various search criteria.</p><p>In our search infrastructure, we utilize two types of indexes:</p><ol><li><strong>Single Indexes:</strong> These are straightforward mappings between a single DynamoDB table and an equivalent OpenSearch index. The OpenSearch index contains the same data as the DynamoDB table, allowing for quick searches on that specific dataset.</li><li><strong>Composite Indexes:</strong> These are more complex, combining data from multiple DynamoDB tables into a single OpenSearch index. This approach is crucial for scenarios where we need to search across attributes from different tables simultaneously, providing a unified search experience across related datasets.</li></ol><p>In our previous architecture, data consistency between DynamoDB and OpenSearch was maintained through direct, real-time synchronization. Whenever a record was inserted, updated, or deleted in a DynamoDB table, the corresponding change was immediately reflected in the OpenSearch cluster. This approach, while straightforward, had its limitations, particularly during cluster maintenance windows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IZA-AzxoGBEGMQ6WYByOZg.png" /></figure><p>Our new architecture introduces several improvements to enhance reliability and efficiency:</p><ol><li>For single table synchronizations:<br>• We now leverage DynamoDB streams to capture changes in the database.<br>• These change events trigger a Lambda function.<br>• The Lambda function sends the data to an SQS queue.<br>• Another Lambda function consumes from this queue and applies the changes to the OpenSearch cluster.</li><li>For multiple table synchronizations:<br>• Our monolithic application retains responsibility for detecting changes.<br>• Instead of directly modifying the OpenSearch cluster, it now writes these changes to a dedicated SQS queue.<br>• A Lambda function consumes from this queue and applies the changes to the appropriate composite index in the OpenSearch cluster.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oLcYkqWR6Bf-zg3m8yXZ8A.png" /></figure><p>The introduction of this queuing mechanism is a key improvement in our system. It acts as a buffer, ensuring that no data is lost during cluster maintenance windows or in the event of temporary issues with the OpenSearch cluster. Changes are queued and processed once the cluster is available, maintaining data integrity and consistency.</p><p>This new architecture provides several benefits:</p><ul><li>Improved resilience during OpenSearch cluster maintenance or outages</li><li>Better scalability for handling large volumes of updates</li><li>Reduced direct coupling between our application and the OpenSearch cluster</li><li>Enhanced ability to handle backpressure during peak loads</li></ul><h3>Streamlining Deployments: SAM and Integration Testing</h3><p>In developing our new microservice and state machines, we leveraged the AWS Serverless Application Model (SAM) framework. While SAM’s benefits are numerous, I want to focus on how we’ve implemented integration testing to ensure robust deployments.</p><p>At Grabyo, we prioritize security with weekly releases to address vulnerabilities. This process underscores the importance of thorough integration testing. We’ve created a post-hook process that simulates real data traffic between DynamoDB and OpenSearch during deployments.</p><p>Here’s our deployment verification process:</p><ol><li>Write a new entry to the database</li><li>Verify the data in OpenSearch after 5 seconds</li><li>Delete the data from the database</li><li>Confirm data removal from OpenSearch after 5 minutes</li></ol><p>If any step fails, the deployment is automatically rolled back. We implement this using SAM’s PostTraffic hook, which executes after the lambda is deployed. In our queue-based architecture, if the process fails, SAM and CodeDeploy roll back the changes, and queued objects are processed later, causing only a minor delay.</p><p>It’s worth noting a limitation we encountered with SAM: there’s no built-in hook that runs for every change in a release. Instead, we needed to create a separate hook for each lambda function we wanted to test. With two lambda functions per pipeline, this added some boilerplate to our configuration. While not a major issue, it’s something to be aware of when implementing similar testing strategies.</p><p>Here’s the SAM template code for our deployment strategy:</p><pre>DeploymentPreference:<br>    Type: AllAtOnce<br>    Hooks:<br>      PostTraffic: !Ref PostTrafficHookReplicationDDBStreamProcessorFunction<br>    TriggerConfigurations:<br>      - TriggerName: ReplicationDDBStreamProcessorFunctionDeploymentAlerts<br>        TriggerTargetArn: !Ref ReplicationAlarmTopic<br>        TriggerEvents:<br>        - DeploymentSuccess<br>        - DeploymentFailure</pre><p>Key components:</p><ul><li>AllAtOnce: Deploys updates simultaneously, suitable for our queue-based solution.</li><li>PostTraffic: Specifies our post-deployment verification hook.</li><li>TriggerConfigurations: Sets up deployment status notifications.</li></ul><p>Looking ahead, we’re considering implementing queue size monitoring to prevent potential issues related to queue overflow.</p><p>This approach verifies data integrity specifically during the deployment process, allowing us to quickly identify and address any synchronization issues between DynamoDB and OpenSearch. While not a constant monitoring solution, this deployment-time verification serves as a crucial safeguard for our data pipeline during system updates.</p><h3>Migration and Disaster Recovery: Building Resilience into Our Search Infrastructure</h3><p>As we embarked on our journey to upgrade our search infrastructure, we quickly realized that migration and disaster recovery were critical aspects that needed careful consideration. Our move from ElasticSearch to OpenSearch wasn’t just about upgrading software; it was an opportunity to rethink our entire approach to data consistency and recovery.</p><h4>The Migration Challenge</h4><p>Migrating from ElasticSearch to OpenSearch presented us with a significant challenge: we needed to transfer all our existing data to the new cluster. This process had to be seamless, ensuring no data loss and minimal downtime for our users.</p><h4>Leveraging DynamoDB as Our Single Source of Truth</h4><p>One of the key realizations that shaped our strategy was the role of DynamoDB in our architecture. As our primary database and single source of truth for all search data, DynamoDB offered us a unique advantage. We didn’t need to rely on traditional backup methods for our search cluster because all the necessary data was already stored securely in DynamoDB.</p><h4>Building a Robust Re-synchronization System</h4><p>Instead of focusing on backups, we set our sights on creating a system that could efficiently re-synchronize all data between DynamoDB and the OpenSearch cluster. This approach would not only support our migration efforts but also provide a reliable mechanism for disaster recovery.</p><p>Our goals for this system were clear:</p><ol><li>Eliminate reliance on scripts or manual processes</li><li>Create a solution that could be easily triggered and monitored</li><li>Ensure scalability to handle our growing data needs</li></ol><h4>Introducing DR State Machines</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*pZWg4796G6uLja_Q5ExgQQ.png" /></figure><p>To meet these objectives, we decided to leverage AWS Step Functions to build a series of Disaster Recovery (DR) state machines. We created one state machine for each index, designed to perform a complete re-sync of data from DynamoDB to OpenSearch.</p><p>Each DR state machine follows these key steps:</p><ol><li><strong>DynamoDB Dump</strong>: Create a dump of the required tables from DynamoDB into Amazon S3.</li><li><strong>Data Transformation</strong>: Use Amazon Athena to combine the data and generate the correct format for OpenSearch. This step produces a set of new JSON files in S3 containing the final, formatted data.</li><li><strong>Data Insertion</strong>: Execute a Lambda function that reads these files and performs batch insertions into the OpenSearch cluster.</li></ol><h4>The Master DR Runbook</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2DDGdH4a-mc3wW_IfnsHGw.png" /></figure><p>To tie everything together, we created a master state machine that acts as our DR runbook. This state machine can synchronize and parallelize the execution of all individual DR state machines for each index.</p><p>The beauty of this approach is its simplicity from an operational standpoint. In the event of a full disaster recovery scenario, an end user only needs to click a button to initiate the entire process. This “one-click” solution significantly reduces the potential for human error and ensures a consistent, repeatable recovery process.</p><h4>Benefits of Our New Approach</h4><p>By implementing this system, we’ve gained several key advantages:</p><ol><li><strong>Flexibility</strong>: The same process can be used for both migrations and disaster recovery events.</li><li><strong>Scalability</strong>: As we add new indexes or our data grows, we can easily adapt our DR state machines to handle the increased load.</li><li><strong>Reliability</strong>: By automating the process, we’ve reduced the risk of human error during critical recovery operations.</li><li><strong>Speed</strong>: Parallel execution of state machines allows for faster overall recovery times.</li><li><strong>Consistency</strong>: Every recovery operation follows the same, tested process, ensuring consistent results.</li></ol><h3>The Road Not Taken: Technologies We Considered</h3><p>In the process of upgrading our search infrastructure, we explored several alternatives that, while promising, didn’t quite align with our specific needs:</p><p><strong>Amazon OpenSearch Service Zero-ETL</strong> initially appeared to be an ideal solution. As a managed service designed to synchronize data between DynamoDB and OpenSearch seamlessly, it promised to simplify our architecture significantly. However, two key issues emerged during our evaluation. First, the pricing model proved problematic. With a minimum charge of $0.25 per hour per DynamoDB table (approximately $182.5 per month), it represented a substantial overcharge for our use case, where most indices are infrequently updated. Our Lambda-based solution, by comparison, operates at a fraction of that cost. Secondly, our system relies on combined indexes that aggregate data from multiple DynamoDB tables, a feature not supported by Zero-ETL at the time of our evaluation.</p><p>We also considered <strong>AWS Database Migration Service (DMS)</strong> and <strong>AWS Glue</strong>, not for constant data synchronization, but as potential tools for cluster migrations and disaster recovery operations. These services offer robust capabilities for data movement and transformation, which initially seemed well-suited for large-scale data operations. However, we encountered two primary obstacles. Both services require enabling Fine-grained access control in our OpenSearch cluster, necessitating updates to all our cluster clients. Given the infrequent nature of our migration and disaster recovery operations, this added complexity across our entire system was difficult to justify. Additionally, implementing either of these tools would have introduced a new technology stack unfamiliar to most of our team, potentially problematic during critical recovery scenarios where time and reliability are crucial.</p><p>Our journey through these technological possibilities proved invaluable in clarifying our priorities. We learned that while feature-rich, managed services can offer significant benefits, they need to align closely with our specific use case, existing infrastructure, and team expertise to be truly effective. The decision-making process reinforced the importance of considering not just the technical capabilities of a solution, but also its impact on our operational costs and team workflow.</p><p>As we move forward with our chosen solution, we remain open to reevaluating these technologies as our needs evolve and the services mature. In the dynamic world of cloud infrastructure, maintaining this adaptable mindset is crucial for long-term success.</p><h4>Wrapping Up: Lessons from Our Search Infrastructure Journey</h4><p>As we conclude our search infrastructure upgrade saga, we’re excited to share some key takeaways:</p><ol><li><strong>Exploring New Horizons</strong>: This project was more than just an upgrade — it was an adventure into new technological territories. We had the opportunity to explore cutting-edge technologies that not only solved our immediate challenges but also equipped us with knowledge that will be invaluable for future projects.</li><li><strong>Learning Through Integration</strong>: Our deep dive into integration testing with SAM (Serverless Application Model) was particularly enlightening. We also gained insights into step functions and other technologies that, while not implemented in this project, have expanded our toolkit for future solutions.</li><li><strong>Raising the Bar for Disaster Recovery</strong>: Perhaps our proudest achievement is the new standard we’ve set for our disaster recovery processes. We’ve built a solution that significantly reduces complexity while increasing our responsiveness during critical scenarios. The beauty of our new system lies in its simplicity — any engineer on our team can now implement DR procedures with ease, drastically improving our resilience.</li></ol><p>While this project may not have revolutionized our entire system, it has certainly added valuable tools to our technical repertoire. We’ve gained practical experience with new technologies and methodologies that will inform our approach to future challenges. As we move forward, we’re looking forward to applying these insights to continually improve Grabyo’s infrastructure.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff84c816df8d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Alerting Nirvana: How Grabyo Tamed the Notification Beast]]></title>
            <link>https://isaac-martin.medium.com/alternate-broadcasting-for-sport-five-wins-for-rights-holders-0675e9e94ff8?source=rss-22629b92f6a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/0675e9e94ff8</guid>
            <dc:creator><![CDATA[Isaac Martin]]></dc:creator>
            <pubDate>Fri, 15 Mar 2024 13:02:17 GMT</pubDate>
            <atom:updated>2024-09-09T14:11:40.730Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ofmqf7zLquYDvtpM3KOcGw.png" /></figure><h3>The Alerting Challenge: Our Pain Points</h3><p>Picture this: You’re deep in concentration, working on a complex piece of code, when your screen lights up with a series of alerts. Sound familiar? At Grabyo, we found ourselves facing some common challenges with our alerting system. While our setup was functional, we knew there was room for improvement. Here’s what we were dealing with:</p><ul><li><strong>Alert Volume:</strong> Our engineers were receiving a high number of notifications. While many were important, we also had our fair share of false positives and incorrectly prioritized alerts. It was becoming increasingly challenging to distinguish critical issues from minor hiccups.</li><li><strong>Diverse Alert Sources:</strong> We had alerts coming from various channels — Slack, email, Amazon SNS, Opsgenie, you name it. Our backend services, databases, Grafana, and AWS X-Ray all contributed to this diverse alert ecosystem. While this diversity had its benefits, it also created some complexity in managing and responding to alerts efficiently.</li><li><strong>Visibility Issues:</strong> Some alerts were only reaching specific email inboxes or individual engineers. This sometimes led to important information not being shared as widely as it could be, occasionally hampering our ability to collaborate effectively across teams.</li><li><strong>Inconsistent Definitions:</strong> Different teams had developed their own alert languages and priorities over time. This lack of standardization sometimes led to confusion when collaborating on cross-team issues.</li><li><strong>Limited Analytics:</strong> We had limited insights into our alert patterns, which made it challenging to systematically improve our alerting system. We knew there was valuable data in our alerts, but we weren’t fully leveraging it.</li></ul><p>While these challenges were not crippling our operations, we recognized that addressing them could significantly enhance our efficiency and responsiveness. We saw an opportunity to evolve from a functional alerting system to an exceptional one.</p><h3>The Alerting Promised Land: Our Must-Have Requirements</h3><p>After experiencing one too many alert-induced headaches, we knew it was time for a change. We gathered our team and outlined a set of requirements for our ideal alerting system. Here’s what we came up with:</p><ul><li><strong>Noise Reduction:</strong> We needed a system capable of differentiating between critical issues and minor hiccups. Only actionable alerts should make it through, and they needed to be properly prioritized.</li><li><strong>Unified Alert Delivery:</strong> We envisioned a single, centralized alert delivery system to replace our scattered approach.</li><li><strong>Improved Visibility:</strong> Every alert should be visible to all relevant team members, eliminating information silos and fostering collaboration.</li><li><strong>Consistent Alert Definitions:</strong> We wanted a standardized approach to defining and setting up alerts across all teams and services.</li><li><strong>Insightful Analytics:</strong> We needed clear visibility into our alert patterns to identify problematic areas and prioritize improvements.</li><li><strong>User-Friendly Management:</strong> The system should be intuitive, allowing for easy creation, modification, and retirement of alerts.</li><li><strong>Seamless Integration:</strong> Our new alerting system needed to integrate smoothly with our existing tools and processes, including our incident management workflow and communication channels.</li><li><strong>Adaptability:</strong> As our systems evolve, our alerting needed to keep pace. We wanted the flexibility to adapt our alerts without major overhauls.</li><li><strong>Contextual Information:</strong> Alerts should come packed with all the necessary details for quick troubleshooting and resolution.</li></ul><h3>Alert Priorities</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3T_rBDTULXTdJvFodFa_Mg.png" /></figure><p>One of our key improvements was establishing a clear, universal system of alert priorities. This ensures all teams interpret urgency and impact consistently. Here’s our streamlined classification:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*Gfl4tG2ug-AlU-nTQPmSPw.png" /></figure><p>Key points about our priority system:</p><ul><li>P1 and P2 alerts demand rapid response, with P1 indicating complete service failure and P2 signifying major degradation.</li><li>P4 and P5 are lower-priority, important for long-term system health but not requiring immediate action.</li><li>P3 serves as our triage category for alerts that need review and proper classification.</li></ul><p>This system aids in quick decision-making, proper resource allocation, and setting clear expectations. It also allows us to track alert volumes at each priority level, helping identify areas for improvement.</p><p>Our goal isn’t zero alerts, but rather a manageable number of meaningful, actionable notifications. This priority system is crucial in achieving that balance.</p><h3>The Secret Sauce: Our Key Technology Choices</h3><p>After careful consideration, we identified two key technologies that would form the backbone of our new alerting system:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R2kJipS3xurzFEoYnLDcNQ.png" /></figure><h4>Opsgenie: Our Alert Central Station</h4><p>We chose Opsgenie as the platform where all our alerts would converge. Here’s why it was a game-changer for us:</p><ul><li><strong>Rich Integrations:</strong> Opsgenie offers a wide array of integrations for both incoming alerts and outgoing notifications, allowing us to centralize our alerting ecosystem.</li><li><strong>Scalability:</strong> The platform is built to handle an enormous volume of alerts, ensuring we won’t outgrow it as our systems expand.</li><li><strong>Cost-Effective:</strong> Opsgenie’s pricing model aligned well with our needs, providing excellent value for the features offered.</li><li><strong>Alert Fatigue Reduction:</strong> It provides useful tools to help reduce alerting fatigue, such as the ability to set thresholds before triggering notifications.</li><li><strong>Powerful Analytics:</strong> Opsgenie’s analytics capabilities give us the insights we need to continually improve our alerting system.</li></ul><h4>Slack: Our Collaborative Hub</h4><p>We decided to keep our engineers on Slack for managing alerts, and here’s why:</p><ul><li><strong>Familiarity:</strong> Our engineers are already comfortable using Slack for daily communications in our remote work environment.</li><li><strong>Rapid Response:</strong> Keeping alerts in Slack enables faster response times, as our team is already actively engaged on the platform.</li><li><strong>Enhanced Visibility:</strong> Slack channels increase the visibility of alerts across teams, ensuring that critical information reaches all relevant parties.</li><li><strong>Improved Collaboration:</strong> Slack’s features facilitate real-time collaboration between teams when addressing and resolving alerts.</li></ul><p>By combining Opsgenie’s robust alerting capabilities with Slack’s collaborative environment, we’ve created an alerting system that addresses our major pain points and meets our key requirements.</p><h3>Fostering Transparency with Slack</h3><p>Our Slack channel structure is the secret sauce that brings transparency without drowning our teams in a sea of notifications. Let’s break it down:</p><h4>The Control Tower: alerts-engineering (P1 &amp; P2)</h4><p>Imagine a control tower at a busy airport. That’s our alerts-engineering channel.</p><ul><li><strong>Purpose:</strong> This channel is the eyes and ears for platform-wide issues. It’s where P1 and P2 alerts from across our entire platform make their grand entrance.</li><li><strong>Who’s Invited:</strong> Everyone, but it’s BYOB (Bring Your Own Bandwidth). We’ve made this channel optional, especially for our newer engineers who might not need the full firehose of platform-wide alerts just yet.</li></ul><h4>Team Channels: Where the Magic Happens</h4><p>Each team gets two channels, like a mullet — business in the front, party in the back.</p><ol><li>alerts-team-TEAM_NAME</li></ol><ul><li><strong>Purpose:</strong> This is where P1 and P2 alerts specific to each team land.</li><li><strong>Who’s Invited:</strong> All team members, no exceptions. It’s like your team’s daily standup, but for alerts.</li></ul><ol><li>alerts-team-TEAM_NAME-notifications</li></ol><ul><li><strong>Purpose:</strong> The more casual cousin of the above, this channel catches all P4 and P5 alerts for the team.</li><li><strong>Who’s Invited:</strong> It’s an open invitation, but attendance is optional. Not everyone needs to know about every successful deployment, right?</li></ul><h4>Service Channels: For the Collaborative Spirits</h4><p>Some services are like the office water cooler — everyone gathers around them. For these special cases, we have service-specific channels.</p><ol><li>alerts-service-SERVICE_NAME</li></ol><ul><li><strong>Purpose:</strong> All P1 and P2 alerts for a specific service call this channel home.</li><li><strong>Who’s Invited:</strong> Anyone interested, no RSVP required.</li></ul><ol><li>alerts-service-SERVICE_NAME-notifications</li></ol><ul><li><strong>Purpose:</strong> The P4 and P5 alerts for the service hang out here.</li><li><strong>Who’s Invited:</strong> Same as above — come if you’re curious, stay if you’re interested.</li></ul><p>This setup allows us to maintain transparency without forcing engineers to join multiple team channels just to stay in the loop on services they’re collaborating on. It’s our way of saying, “Here’s all the info, take what you need.”</p><h3>Routing Alerts: The Traffic Control System</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wPrWx7JImxAgulYcOZypEA.jpeg" /></figure><p>Now, let’s peek under the hood at how we route our alerts. We use tags to determine where an alert should go. To do so, we only need to add a line like this to the body of the alert message:</p><p><strong>[<em>priority</em>: P1] [<em>tags</em>: team_devsecops service_deploy_tools env_prod]</strong></p><p>Let’s break it down:</p><ul><li><strong>Priority:</strong> This is the urgency level of the alert (P1/P2/P3/P4/P5).</li><li><strong>Tags:</strong> We can include up to 10 tags to define team, service, and/or environment.</li></ul><p>Once this line is included in the alert, Opsgenie takes over. We’ve set up integrations that use regular expressions to convert these lines into the right priority and tags. It’s like having a multilingual translator for our alerts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/1*eQdXF9in2ad8D62lNABswQ.png" /></figure><p>The final piece of the puzzle is our outbound integrations for Slack channels. For each alert-dedicated Slack channel, we create a Slack integration in Opsgenie. This integration acts like a bouncer at a club, only letting in alerts with the right priority and team/service tags.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l3ZkQ3oODOv3IbnPT6vq9Q.png" /></figure><p>For example, our #alerts-team-platform Slack channel only allows P1 and P2 alerts tagged with team_platform. It’s our way of ensuring that the right alerts reach the right people at the right time.</p><h3>The Great Migration: Moving Existing Alerts</h3><p>Unless you’re starting from scratch (lucky you!), you probably have an existing system with alerts flying around like confetti. We certainly did, and we couldn’t just flip a switch to the new system overnight.</p><p>So, we got creative. We reserved a specific priority (P3) for all alerts that weren’t following our new conventions. Any alert categorized as P3 and tagged with dep_eng (department_engineering) gets sent to a special Slack channel called alerts-to-moderate.</p><p>This channel is like a halfway house for our alerts. All engineering managers keep an eye on it and are responsible for scheduling the necessary sprint work to migrate these alerts to the new system. It’s like spring cleaning, but for our alert system.</p><p>During this migration, teams take the time to decide if each alert is still needed and what its new priority should be. It’s a great opportunity to declutter and optimize our alert ecosystem.</p><h3>Lessons Learned and Future Plans</h3><p>Our journey to alerting nirvana has taught us valuable lessons and opened up exciting possibilities for the future:</p><ol><li>Centralization is key: By consolidating our alerts into a single platform, we’ve dramatically improved our ability to manage and respond to issues.</li><li>Prioritization matters: Our clear priority system has helped teams quickly identify and address the most critical issues first.</li><li>Transparency fosters collaboration: Our Slack channel structure has increased visibility across teams, leading to faster problem-solving and better cross-team cooperation.</li><li>Continuous improvement is crucial: The analytics provided by Opsgenie have become an indispensable tool in our alerting ecosystem. They allow us to:</li></ol><ul><li>Stay on top of our Key Performance Indicators (KPIs) for alerts</li><li>Quickly identify and address new sources of alert spam</li><li>Track the effectiveness of our alert reduction efforts</li><li>Make data-driven decisions about our alerting strategy</li></ul><ol><li>Migration takes time: Our approach of using P3 alerts as a transitional category has allowed for a smoother migration process, giving teams the time to thoughtfully review and update their alerts.</li></ol><p>Looking ahead, we plan to:</p><ul><li>Further refine our alert categories based on the insights gained from Opsgenie’s analytics</li><li>Explore advanced features of Opsgenie to enhance our alerting capabilities</li><li>Continue to educate teams on best practices for creating and managing alerts</li><li>Regularly review and optimize our Slack channel structure to ensure it meets our evolving needs</li></ul><p>By staying vigilant and leveraging the power of analytics, we’re committed to maintaining an efficient, effective alerting system that evolves with our organization.</p><p>In conclusion, our journey from alert hell to alerting nirvana wasn’t just about implementing new tools. It was about rethinking our entire approach to alerts, from how we generate them to how we consume them. By centralizing our alerts in Opsgenie, leveraging Slack’s collaborative power, and thoughtfully structuring our communication channels, we’ve created a system that keeps us informed without overwhelming us.</p><p>Remember, the perfect alerting system isn’t about seeing everything — it’s about seeing the right things at the right time. And for us at Grabyo, that’s made all the difference.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0675e9e94ff8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Internal SSO at Grabyo]]></title>
            <link>https://isaac-martin.medium.com/internal-sso-at-grabyo-616b38bea39e?source=rss-22629b92f6a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/616b38bea39e</guid>
            <category><![CDATA[idp]]></category>
            <category><![CDATA[google-workspace]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[sso]]></category>
            <category><![CDATA[cognito]]></category>
            <dc:creator><![CDATA[Isaac Martin]]></dc:creator>
            <pubDate>Thu, 21 Dec 2023 09:23:11 GMT</pubDate>
            <atom:updated>2023-12-21T09:30:13.300Z</atom:updated>
            <content:encoded><![CDATA[<p>We’re all about keeping things locked down and tight on the security front. So, kicking off the year, we decided to shake things up with our internal tools. Ditched the usual username and password setup with the whole two-factor authentication vibe and embraced the coolness of a Single Sign-On (SSO) system.</p><p>Just a heads up, this isn’t the same as the SSO we’re cooking up for our bigger platform. That’s a different ball game. The good news? You’ll get to experience the upgraded tools firsthand in early 2024. I’m stoked to spill the beans on all the details in a follow-up blog post. Stay tuned for the lowdown on our beefed-up security game!</p><h3>Why SSO?</h3><p>If you’ve ever used your Google or Facebook login to access an app, you’ve used SSO. In simple terms, it is the ability to login into another application using your identity from another platform (i.e. Google, Facebook, Okta, etc.).</p><p>In this blog post, we will uncover how SSO has transformed our user management for our internal tools, exploring its benefits and the leading technologies we have used to make it happen.</p><p>To fully understand the benefits of SSO, let’s compare the different user workflows before and after implementing SSO.</p><h4>Access to AWS accounts</h4><p><strong>Before SSO</strong></p><p>Before implementing SSO to access our AWS accounts, we had a dedicated AWS account for user management called “the Identity account” per AWS recommendation.</p><p>For better governance, this account only held IAM user permissions to other AWS accounts and did not run any other workflows or services.</p><p>When a new employee joined or left the business, our operations team would need to manually create or destroy a new user.</p><p>In the old setup, to access our AWS accounts, our employees had to first log into the Identity account with usernames and passwords and then assume a role to access other accounts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*fppaJPGu-e6aUc_GqKy3og.png" /></figure><p>One of the most significant downsides of this approach was letting our engineers know which roles they had access to in our different accounts.</p><p><strong>After SSO</strong></p><p>With the introduction of SSO, we migrated our user permissions from the Identity account to the AWS IAM Identity Center (we’ll cover this technology in more detail later in this post). Unfortunately, our operations team still must manually provision users and permissions on this tool for all our AWS users.</p><p>User access is one of the most significant benefits of SSO. Users no longer need to manage multiple usernames and passwords. Instead, they log in using their Identity Provider account (IdP from now on — we’ll cover this technology later) to access the following portal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*Al-e3BZbMbIUyfAoW-BEjg.png" /></figure><p>As you can see, this console lets the user know the accounts and roles to which he has access. Furthermore, accessing these accounts is as simple as clicking a button.</p><p><strong>Finally, when a user leaves the business, their access to our AWS accounts will be immediately revoked as soon as their IdP account is revoked (the first offboarding step).</strong></p><h4>Access to AWS Client VPN</h4><p><strong>Before SSO</strong></p><p>Before we implemented SSO, the workflow for provisioning new users required:</p><ul><li>First, create an individual certificate for every user.</li><li>Then, generate a custom VPN configuration file so the VPN client can connect to the VPN endpoint with the certificate.</li><li>Finally, distribute these files safely to the end user.</li></ul><p>If you are unfamiliar with SSL certificates, let me tell you that storing and distributing them securely is not a trivial process!</p><p>The end users of our VPN needed to download the previously mentioned files to their computer, install the VPN client software, and load the given configuration. Once the setup was completed, connecting to the VPN required a simple button click. However, please note that this connection does not require any additional password prompt, bringing an additional security risk.</p><p>Revoking access to our VPN for a user required revoking the certificate on the VPN endpoint.</p><p><strong>After SSO</strong></p><p>AWS Client VPN has direct integration with AWS IAM Identity Center. Providing access to our VPN requires an AWS user with the right IAM permission to access the VPN client. Once the user is created, they can log into the SSO portal using their IdP account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*0kd5kmLnfnbPACz4HuDI-g.png" /></figure><p>On the SSO portal, they get direct access to the AWS Client VPN Self-Service Portal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_P8WcytKgx6cP7ueTX4zYg.png" /></figure><p>On this portal, they can easily download a fully auto-generated configuration for their user and the right client for its architecture.</p><p>Once they set up the client, connecting to the VPN will prompt a browser tab where the user will need to authenticate with their IdP account without requiring certificates or passwords.</p><p><strong>Finally, when a user leaves the business, their access to our AWS Client VPN will be immediately revoked as soon as their IdP account is revoked (the first offboarding step).</strong></p><h4>Access to Grabyo Tools</h4><p>Grabyo Tools is a web application built in-house whose primary purpose is to help Grabyo employees manage the Grabyo platform for our customers.</p><p><strong>Before SSO</strong></p><p>These tools had their user database, and these users were created by any of the admin users of the tool. Revoking access was again a manual process driven by the same admins.</p><p>All users of these tools must be connected to our VPN and use multifactor authentication when logging in for added security.</p><p><strong>After SSO</strong></p><p>The workflow for user provisioning is almost identical to what it was before. An admin user on the Tools platform must create a user inside Tools. However, there is no need to set up passwords or MFA because users will now log in using their IdP account instead.</p><p><strong>Finally, when a user leaves the business, their access to our Grabyo Tools will be immediately revoked as soon as their IdP account is revoked (the first offboarding step).</strong></p><h4>In summary</h4><p>Now that you have seen how our workflows changed with the introduction of SSO, I think it’s worth highlighting the significant benefits we were seeking with the introduction of SSO.</p><p><strong>Passwordless logins</strong></p><p>In conjunction with a good password policy, employees have to use unique passwords for each tool and service, and these passwords should be rotated regularly.</p><p>However, with SSO, managing these different passwords is no longer needed as access to tools and platforms is federated through the identity provider.</p><p><strong>Centralize user access management</strong></p><p>Before SSO, when an employee left the company, we had to revoke their access to all these tools manually. This was time-consuming and a considerable security risk in case one of the platforms was forgotten.</p><p>With the introduction of SSO, we only need to revoke the user access to Grabyo’s Identity Provider, and access to all other tools will immediately be revoked.</p><p><strong>A final comment about user provisioning</strong></p><p>User provisioning is the process of assigning permissions based on roles and event changes throughout an account’s lifecycle. Provisioning (and de-provisioning) grants, modifies, or revokes access and privileges based on triggers such as:</p><ul><li>New hire.</li><li>Role change.</li><li>A move to a different business unit.</li><li>Termination.</li></ul><p>It’s important to clarify that user provisioning is a future milestone of our security roadmap. However, it was not a requirement for this project, where we solely focused on implementing SSO.</p><h3>Let’s get technical</h3><p>We don’t want to dive deep into the technologies and protocols used to leverage SSO. You can find tons of material online explaining these concepts in great detail.</p><p>Instead, we want to discuss the architecture and main technologies used to highlight that most of this work was achieved with minimal development effort.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K1jYKRhO7Is5KuzAQU_P2Q.png" /></figure><h4>The identity provider</h4><p>An identity provider (IdP) is a service that stores and manages digital identities. Companies use these services to allow their employees or users to connect with the resources they need.</p><p>There are many identity providers (i.e. Active Directory, Okta, Auth0, etc.) out there. Choosing one is not a simple decision. Your choice will be driven by the support you require with modern and legacy authentication technologies.</p><p>As you can see in the previous diagram, the Identity Provider is the common link that governs access to all the other applications. Therefore, users must have a valid account on our identity provider if they want to access our internal applications.</p><h4>AWS IAM Identity Center (Successor to AWS Single Sign-On)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0b4xGdj1H731Ij71q6H4Fg.png" /></figure><p>AWS IAM Identity Center (known before as AWS SSO) sits at the center of our architecture, and it provides the following features:</p><ul><li>It can integrate with external identity providers like Active Directory, Okta, Google Workspace, etc.</li><li>If you don’t have access to any of these identity providers, you can use it as an identity provider for other applications.</li><li>AWS IAM Identity Center does support automatic provisioning for some identity providers.</li><li>AWS IAM Identity Center can then give users access to AWS consoles (1), Business cloud applications (2) like Slack, Dropbox, or even custom SAML applications (3).</li></ul><p>In the context of Grabyo, we use the AWS IAM Identity Center to define all the AWS users and their access permissions to all the AWS accounts in our AWS Organisation, Grabyo’s VPN, and AWS Managed Grafana.</p><h4>AWS Cognito</h4><p>AWS Cognito is a user identity service that allows developers to add user sign-up and sign-in and access control to their web and mobile apps quickly and easily. AWS Cognito takes care of most of the heavy lifting around user identity and lets developers focus on application development.</p><p>Before SSO, our Grabyo Tools had its user database and login workflow. We migrated all this built-in-house logic to AWS Cognito to implement SSO and leveraged their out-of-the-box support for federated login with AWS.</p><p>This is the only piece of work that requires some development. However, this effort was considerably less than extending our application to start supporting SAML to integrate it with our IdP.</p><p>Here’s the diagram of the authentication flow:</p><ol><li>The app starts the sign-up and sign-in process by directing our user to Cognito.</li><li>Our user is redirected to the IdP.</li><li>The IdP authenticates the user if necessary. If the IdP recognizes that the user has an active session, the IdP skips the authentication to provide a single sign-on (SSO) experience.</li><li>The IdP POSTs the SAML assertion to Amazon Cognito.</li><li>After verifying the SAML assertion, Amazon Cognito returns a JWT token to the app for the now signed-in user.</li><li>The app can now make API requests to our backend services as long as it passes along the JWT token that it received from Cognito.</li></ol><h3>Final comments</h3><p>Initially, we thought integrating Single Sign-On (SSO) into our tools would be a time-consuming ordeal. Surprise, surprise! Turns out, with the help of AWS’s managed services, we pulled it off smoothly and without breaking the bank.</p><p>Now that we’ve got this slick SSO solution in place, looking back, it’s clear that the benefits, both in terms of security and automation, are game-changers. Our hindsight advice? Don’t wait around. From day one, small or big, we highly recommend organizations jump on the SSO bandwagon. It’s a total win-win.</p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=616b38bea39e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Microservice Lightning-Fast with AWS SAM]]></title>
            <link>https://isaac-martin.medium.com/building-a-microservice-lightning-fast-with-aws-sam-cf69725c6ddd?source=rss-22629b92f6a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf69725c6ddd</guid>
            <category><![CDATA[aws-sam]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[amazon-web-services]]></category>
            <dc:creator><![CDATA[Isaac Martin]]></dc:creator>
            <pubDate>Mon, 06 Nov 2023 16:19:59 GMT</pubDate>
            <atom:updated>2023-11-06T16:19:59.284Z</atom:updated>
            <content:encoded><![CDATA[<p>This blog post is a follow-up to my previous blog post, <a href="https://isaacmartin.net/enforcing-iam-least-privilege-with-aws-sam-airtable-a3aa622dcf0c">Enforcing IAM least privilege with AWS SAM + Airtable</a> to go over the backend for that microservice. I will shift the focus of this blog post from the actual microservice, which is very simple, to the great benefits of using AWS SAM to build it.</p><p>I don’t write code regularly anymore. However, I built this service at a production-ready level using AWS SAM in a few days without much effort. Leaving the code aside, I’ll try to walk you through the steps I had to take to define the required supporting infrastructure using SAM and hopefully highlight how easy it was.</p><h3>Why do I ❤️ SAM?</h3><p>Before diving deep into the microservice, let’s cover some key features that make me like SAM.</p><h4>Cloud deployments and sandbox environments</h4><p>SAM allows you to deploy your full microservice in the cloud in seconds. During my tests with the HelloWorld example, SAM took about 10 seconds to deploy the entire stack (API GW + Lambda) into an AWS account. However, more importantly, you can create dedicated sandbox environments by naming your stack differently:</p><pre>sam deploy --profile sam-dev --stack-name bob-iam-detective</pre><p>This approach allows multiple developers to create a dedicated stack for their development and testing without interfering with other developers/stages.</p><h4>Live sync deployments</h4><p>SAM relies on CloudFormation to deploy your stack. This approach translates to long waiting times (i.e. 10 seconds) when making micro changes. To solve this problem, AWS provides live sync deployments by using the following command:</p><pre>sam sync --profile sam-dev --stack-name bob-iam-detective</pre><p>The previous command syncs your application with your cloud deployment using direct AWS APIs instead of CloudFormation. This translates into near real-time updates to your stack when making changes to your code.</p><p>However, note that SAM only supports this feature on AWS Lambda, Amazon API Gateway, and AWS StepFunctions APIs.</p><h4>Localhost development made it easy</h4><p>The following SAM command launches your stack in a Localhost Docker container for testing. If you pair this environment with <a href="https://localstack.cloud/">Localstack</a>, you get an excellent environment for local development and testing.</p><pre>sam local start-api<br># For example: you can invoke the hello world API like this<br>curl http://127.0.0.1:3000/hello</pre><h4>CI/CD pipelines</h4><p>Last but not least, <a href="https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-pipeline-bootstrap.html">SAM provides templates</a> for CI/CD for a dual account setup (i.e. development &amp; production). This CI/CD template would start on every commit to Git, run tests and deploy your application to both accounts. To initialize the pipeline, run the following command:</p><pre>sam pipeline init --bootstrap</pre><blockquote>However, out of the box it would fail on the build phase unless you <strong>remove</strong> the line <strong><em>resolve_s3 = true</em></strong> from the samconfig.toml file:</blockquote><pre>[default.package.parameters]<br>resolve_s3 = true</pre><p>If you are new to SAM, I recommend looking at <a href="https://catalog.workshops.aws/complete-aws-sam/en-US">this SAM workshop</a> from AWS.</p><p><strong>Enabling testing on the pipeline</strong></p><p>It’s important to note that the CI/CD template generated by SAM does not have any testing enabled by default. You must do the following:</p><ul><li><strong>In the file Codepipeline.yaml:</strong> Uncomment all the sections related to unit tests. The file has a few lines with the text <em>“# Uncomment and modify the following step for running the unit-tests”.</em></li><li><strong>In the same file Codepipeline.yaml:</strong> This might be only specific to my TypeScript setup. However, to make it work, I had to replace the existing Image (<em>Image: aws/codebuild/amazonlinux2-x86_64-standard:3.0</em>) with a later version (<em>Image: aws/codebuild/amazonlinux2-x86_64-standard:5.0</em>). The pipeline will work without this change.</li><li><strong>In the file buildspec_unit_test.yml:</strong> I had to add the following code to run the tests for my TypeScript code:</li></ul><pre>version: 0.2<br>phases:<br>  install:<br>    runtime-versions:<br>      nodejs: 18<br>  pre_build:<br>    commands:<br>      - cd iam-detective/<br>      - npm install<br>  build:<br>    commands:<br>      # trigger the unit tests here<br>      - echo &#39;Running unit tests&#39;<br>      - npm run test</pre><h3>The architecture</h3><p>The primary responsibility of the backend is to read data from AWS and push it to Airtable. Concretely, these are the main tasks:</p><ol><li>List all the IAM roles from the current account running our lambda.</li><li>For all the roles, create an Access Advisor report and push only the unused permissions (at Grabyo, we consider a permission “unused” after three months) to Airtable for manual review. We don’t send used permissions as they don’t need reviewing.</li></ol><p>Because this logic only needs to run once daily, AWS Lambda was the best option. Subsequently, AWS SAM was the obvious choice.</p><p>However, because we have over 800 roles in our AWS accounts, the whole process can’t run in a single lambda (the max execution time for a lambda at the time of writing is 15 minutes).</p><p>To solve this challenge, we decided to go for the following architecture:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2rV9YGRsrP5VGO96C9ZYwQ.png" /></figure><p>The main components of this architecture are:</p><ul><li><strong>EventBridge Schedule:</strong> Executes the IAM inspector Lambda daily.</li><li><strong>IAM Inspector Lambda:</strong> Assumes the role cross-account-role to list all the roles from all the different development or production accounts. For each of these roles, it sends a new job to an SQS queue.</li><li><strong>Role Processor Lambda:</strong> For every job, it creates an Access Advisor report and sends the unused permissions results to Airtable.</li></ul><h3>The IAM inspector lambda</h3><p>These are the general steps implemented on this lambda:</p><ul><li><strong>List all the roles from all the AWS accounts:</strong> The lambda is responsible for listing IAM roles from multiple accounts. We need a cross-account IAM role to allow it to access all the accounts.</li><li><strong>Get all the existing roles in Airtable:</strong> We need to query this data to avoid notifying Airtable of permissions already in Airtable.</li><li><strong>Push all non-existing roles to an SQS queue:</strong> We need to push all new unused permissions to an SQS for later processing.</li></ul><p>To kickstart the project, I built the service using one of the SAM templates as a solid foundation to build upon. Concretely, I went for these options for the Hello World Example (a simple API gateway endpoint link to a lambda that responds with a <em>Hello World</em> test) on top of NodeJS18 with TypeScript and packaged as ZIP.</p><p>I selected this stack for several reasons. TypeScript is a language I’m well-versed in, and it offers notably quick build and Lambda cold start times. Just for context, building this application in Node.js takes roughly 10 seconds, while its Java equivalent requires about 45 seconds. Furthermore, if you opt for an Image package deployment (i.e., Docker running on Lambda), these times increase significantly.</p><p>This is the final <em>template.yaml,</em> after renaming the hello-world application, it looks like this:</p><pre>AWSTemplateFormatVersion: &#39;2010-09-09&#39;<br>Transform: AWS::Serverless-2016-10-31<br>Description: &gt;<br>  iam-detective<br><br>  Sample SAM Template for iam-detective<br>  <br># More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst<br>Globals:<br>  Function:<br>    Timeout: 60<br><br>Resources:<br>  InvestigateIAMPermissionsFunction:<br>    Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction<br>    Properties:<br>      Tags:<br>        Service: iam-detective<br>      CodeUri: iam-detective<br>      Handler: InvestigateIAMPermissions.listAllIAMRoles<br>      Runtime: nodejs18.x<br>      Architectures:<br>        - x86_64<br>      Events:<br>        IAMDetectiveInvestigateIAMPermissionsAPI:<br>          Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api<br>          Properties:<br>            Path: /iam-detective<br>            Method: get<br>    Metadata: # Manage esbuild properties<br>      BuildMethod: esbuild<br>      BuildProperties:<br>        Minify: false<br>        Target: &quot;es2020&quot;<br>        Sourcemap: true<br>        EntryPoints: <br>        - InvestigateIAMPermissions.ts<br><br>Outputs:<br>  # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function<br>  # Find out more about other implicit resources you can reference within SAM<br>  # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api<br>  InvestigateIAMPermissionsFunctionApi:<br>    Description: &quot;API Gateway endpoint URL for IAM Detective&quot;<br>    Value: !Sub &quot;https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/iam-detective/&quot;<br>  InvestigateIAMPermissionsFunction:<br>    Description: &quot;Investiage IAM Permissions Lambda Function ARN&quot;<br>    Value: !GetAtt InvestigateIAMPermissionsFunction.Arn<br>  InvestigateIAMPermissionsFunctionIamRole:<br>    Description: &quot;Implicit IAM Role created for Investiage IAM Permissions function&quot;<br>    Value: !GetAtt InvestigateIAMPermissionsFunctionRole.Arn</pre><p>The previous template contains a lambda with an API gateway that should be removed as it doesn’t have any authentication attached and it still misses a few critical components for the lambda to perform its tasks.</p><p>I recommend creating the CI/CD pipeline at this stage as it will allow you to regularly merge your changes to the infrastructure and code into Git and deploy the changes automatically in the cloud. I like to do this regularly after I add a new feature to ensure the system works in the cloud and not only locally.</p><h4>SQS queue</h4><p>The lambda must list all IAM roles and send them to a queue. Defining this queue together with a dead-letter queue on the template can be achieved like this:</p><pre>  # This is an SQS queue with all default configuration properties. To learn more about the available options, see<br>  # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html<br>  InvestigateIAMPermissionsQueue:<br>    Type: AWS::SQS::Queue<br>    Properties:<br>      VisibilityTimeout: 901 # Max lambda timeout + 1 second<br>      RedrivePolicy:<br>        deadLetterTargetArn:<br>          Fn::GetAtt: [InvestigateIAMPermissionsDeadLetterQueue, Arn]<br>        maxReceiveCount: 3<br><br>  InvestigateIAMPermissionsDeadLetterQueue:<br>    Type: AWS::SQS::Queue<br>...<br>Outputs:<br>...<br>  InvestigateIAMPermissionsQueue:<br>    Description: &quot;The SQS queue to communicate the two lambda functions&quot;<br>    Value: !Ref InvestigateIAMPermissionsQueue<br>  InvestigateIAMPermissionsDeadLetterQueue:<br>    Description: &quot;The dead letter SQS queue to send messages that can&#39;t be processed&quot;<br>    Value: !Ref InvestigateIAMPermissionsDeadLetterQueue</pre><p>We can use environment variables to pass the SQS URL to the lambda. To do this, we need to include the following code inside the Lambda properties definition inside the template:</p><pre>    Properties:<br>      Environment:<br>        Variables:<br>          SQS_URL_TO_PROCESS_IAM_ROLES: !Ref InvestigateIAMPermissionsQueue</pre><p>This is the TypeScript code required to pull that URL from the environment variables:</p><pre>const sqsURL = process.env.SQS_URL_TO_PROCESS_IAM_ROLES ?? &quot;ERROR&quot;;</pre><h4>Permissions</h4><p>For the lambda function to perform its tasks, it requires the following permissions:</p><p><strong>Cross-account access role:</strong></p><p>At Grabyo, we have different AWS accounts. For this reason, the lambda needs to list all roles in the different AWS accounts. We have decided to create a cross-account access role in all the accounts and allow the lambda to assume all these roles. This is the CloudFormation for this cross-account IAM role:</p><pre>AWSTemplateFormatVersion: &quot;2010-09-09&quot;<br>Resources:<br>  IAMDetectiveCrossAccountAccessRole:<br>    Type: &quot;AWS::IAM::Role&quot;<br>    Properties:<br>      RoleName: &quot;cross-account-access&quot;<br>      AssumeRolePolicyDocument:<br>        Version: &quot;2012-10-17&quot;<br>        Statement:<br>          - Effect: &quot;Allow&quot;<br>            Principal:<br>              AWS:<br>                - &quot;arn:aws:iam::XXXXXXXXXXXX:root&quot;<br>            Action: &quot;sts:AssumeRole&quot;<br>      Policies:<br>        - PolicyName: &quot;IAMDetectiveCrossAccountAccessRolePermissions&quot;<br>          PolicyDocument:<br>            Version: &quot;2012-10-17&quot;<br>            Statement:<br>              - Effect: &quot;Allow&quot;<br>                Action:<br>                  - &quot;iam:GenerateServiceLastAccessedDetails&quot;<br>                  - &quot;iam:ListRoles&quot;<br>                  - &quot;iam:GetServiceLastAccessedDetails&quot;<br>                Resource: &quot;*&quot;<br><br>Outputs:<br>  IAMDetectiveCrossAccountAccessRoleArn:<br>    Value: !GetAtt IAMDetectiveCrossAccountAccessRole.Arn</pre><p>Using the aws cli, you can create this IAM role in all the accounts needed using this command:</p><pre>aws cloudformation create-stack <br>  --stack-name detective-cross-account-access-role<br>  --template-body file://detective-cross-account-access.yaml<br>  --capabilities CAPABILITY_NAMED_IAM</pre><p><strong>Airtable access:</strong></p><p>This lambda uses the information stored in Airtable for performance optimization reasons before it submits new roles for processing. To access Airtable, the lambda needs to use a <a href="https://airtable.com/developers/web/guides/personal-access-tokens">Personal access token</a>. We are storing this token in SecretsManager using the following CloudFormation template:</p><pre>Parameters:<br>  AirtableSecret:<br>    Type: String<br>    NoEcho: true<br><br>Resources:<br>  IamDetectiveAirtableSecret:<br>    Type: AWS::SecretsManager::Secret<br>    Properties:<br>      Name: airtable-token<br>      Description: Secret for IAM Detective Airtable integration<br>      SecretString: !Sub &#39;{&quot;airtable_token&quot;:&quot;${AirtableToken}&quot;}&#39;<br><br>Outputs:<br>  IAMDetectiveAirtableTokenARN:<br>    Description: &quot;The airtable secret for the IAM detective microservice.&quot;<br>    Value: !Ref IamDetectiveAirtableSecret<br>    Export:<br>      Name: <br>        Fn::Sub: &quot;${AWS::StackName}-ARN&quot;</pre><p>Using the aws cli, you can create this secrets manager stack and provide the secret at the time of creation by using this command:</p><pre>aws cloudformation create/update-stack <br>  --stack-name airtable-secret <br>  --template-body file://secrets-manager-airtable.yaml<br>  --parameters ParameterKey=AirtableSecret,ParameterValue=XXXXXX<br>  --capabilities CAPABILITY_NAMED_IAM</pre><p><strong>Opsgenie access:</strong></p><p>We use Opsgenie in the backend service to check the health of the service. We use <a href="https://support.atlassian.com/opsgenie/docs/add-heartbeats-to-monitor-external-systems/">Opsgenie heartbeats</a> to do this. Again, this requires an API token that we store on SecretsManager. Here is the CloudFormation template:</p><pre>Parameters:<br>  OpsgenieSecret:<br>    Type: String<br>    NoEcho: true<br><br>Resources:<br>  IamDetectiveOpsgenieSecret:<br>    Type: AWS::SecretsManager::Secret<br>    Properties:<br>      Name: opsgenie-token<br>      Description: Secret for IAM Detective Opsgenie integration<br>      SecretString: !Sub &#39;{&quot;opsgenie_token&quot;:&quot;${OpsgenieToken}&quot;}&#39;<br><br>Outputs:<br>  IAMDetectiveOpsgenieTokenARN:<br>    Description: &quot;The opsgenie secret for the IAM detective microservice.&quot;<br>    Value: !Ref IamDetectiveOpsgenieSecret<br>    Export:<br>      Name: <br>        Fn::Sub: &quot;${AWS::StackName}-ARN&quot;</pre><p><strong>Lambda IAM permissions:</strong></p><p>We need to grant access to the lambda to perform all of these actions by adding the following to the lambda policy on the SAM template:</p><pre>Policies:<br>  - Statement:<br>      - Sid: Stmt1679505932243<br>        Effect: Allow<br>        Action:<br>          - sts:AssumeRole<br>        Resource:<br>          [<br>            arn:aws:iam::XXXXXXXXXXXX:role/iam-detective-cross-account-access,<br>            arn:aws:iam::XXXXXXXXXXXX:role/iam-detective-cross-account-access,<br>            ...<br>          ]<br>      - Sid: Stmt1679384123196<br>        Effect: Allow<br>        Action:<br>          - sqs:SendMessage<br>        Resource: !GetAtt InvestigateIAMPermissionsQueue.Arn<br>      - Sid: Stmt1679253132905<br>        Effect: Allow<br>        Action:<br>          - secretsmanager:GetSecretValue<br>        Resource:<br>          - Fn::ImportValue:<br>              Fn::Sub: &quot;${AirtableSecretsStackName}-ARN&quot;<br>          - Fn::ImportValue:<br>              Fn::Sub: &quot;${OpsgenieSecretsStackName}-ARN&quot;</pre><p>This policy will grant access to assume the cross-account role and access to both secrets for Airtable and Opsgenie.</p><h4>Cronjob</h4><p>Finally, the service needs a daily cronjob to kickstart the lambda. To define this cronjob in the SAM template, you must add the following code inside the events of the lambda function (next to the API gateway event).</p><pre>Events:<br>...<br>  IAMDetectiveInvestigateIAMPermissionsCron:<br>    Type: Schedule<br>    Properties:<br>      Schedule: &quot;cron(0 1 * * ? *)&quot;<br>      Description: This is the cron job for the IAM Detective - Invetigate IAM permissions daily.<br>      Enabled: True</pre><p>Please note that multiple events firing the lambda means it can be called from the API gateway or the cronjob independently.</p><h3>The role processor lambda</h3><p>Taking into account that this lambda will be run once per role in the SQA queue, these are the steps implemented on this lambda:</p><ul><li><strong>Generate a ServiceLastAccessedReport:</strong> To find out unused permissions, we first need to generate a service last accessed report and then download the report generated.</li><li><strong>Update Airtable:</strong> With the report, we need to iterate over all the permissions in the role, identify unused ones (i.e., older than three months), and send them to Airtable.</li></ul><p>This is the code required to include the lambda on the template:</p><pre># This is the Lambda function definition associated with the source code: sqs-payload-logger.js. For all available properties, see<br># https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction<br>SQSIAMProcessor:<br>  Type: AWS::Serverless::Function<br>  Properties:<br>    Tags:<br>      Service: iam-detective<br>    CodeUri: iam-detective<br>    Handler: SQSIAMProcessor.sqsIAMProcessorHandler<br>    Runtime: nodejs18.x<br>    Architectures:<br>      - x86_64<br>    Description: A Lambda function that logs the payload of messages sent to an associated SQS queue.<br><br>    # This property associates this Lambda function with the SQS queue defined above, so that whenever the queue<br>    # receives a message, the Lambda function is invoked<br>    Events:<br>      SQSQueueEvent:<br>        Type: SQS<br>        Properties:<br>          Queue: !GetAtt InvestigateIAMPermissionsQueue.Arn<br>          BatchSize: 10<br>          Enabled: true<br>          ScalingConfig:<br>            MaximumConcurrency: 2<br>    MemorySize: 128<br>    Timeout: 900<br>    Policies:<br>      - Statement:<br>          - Sid: Stmt1679505932243<br>            Effect: Allow<br>            Action:<br>              - sts:AssumeRole<br>            Resource:<br>              [<br>                arn:aws:iam::XXXXXXXXXXXX:role/cross-account-access,<br>                ...,<br>              ]<br>          - Sid: Stmt1679505932905<br>            Effect: Allow<br>            Action:<br>              - secretsmanager:GetSecretValue<br>            Resource:<br>              - Fn::ImportValue:<br>                  Fn::Sub: &quot;${AirtableSecretsStackName}-ARN&quot;<br>  Metadata: # Manage esbuild properties<br>    BuildMethod: esbuild<br>    BuildProperties:<br>      Minify: false<br>      Target: &quot;es2020&quot;<br>      Sourcemap: true<br>      EntryPoints:<br>        - SQSIAMProcessor.ts</pre><p><strong>Invoking event:</strong></p><p>You can see that the only event invoking this lambda is the SQS queue we defined earlier compared to the cronjob and API events defined for the previous lambda.</p><p>It’s worth pointing out that For this lambda, we need to limit the number of concurrent executions down to the minimum (2 at the time of writing). This is required because the lambda IAM Inspector lambda will generate hundreds of requests for processing, and we can’t process them all in parallel because we would get API rate-limiting requests from Airtable. This is achieved by adding the field <strong><em>MaximumConcurrency: 2</em></strong> in the previous template.</p><p><strong>Lambda IAM permissions:</strong></p><p>Regarding permissions, the lambda requires the same cross-account access role as it needs to generate the IAM reports and access the same Airtable secret to perform updates of the newly found permissions.</p><h3>The final template</h3><p>This is the final template, including all infrastructure:</p><pre>AWSTemplateFormatVersion: &quot;2010-09-09&quot;<br>Transform: AWS::Serverless-2016-10-31<br>Description: &gt;<br>  iam-detective<br><br>  Sample SAM Template for iam-detective<br><br># More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst<br>Globals:<br>  Function:<br>    Timeout: 60<br><br>Parameters:<br>  AirtableSecretsStackName:<br>    Description: Name of the airtable secrets manager stack.<br>    Type: String<br>    Default: &quot;airtable-token&quot;<br>  OpsgenieSecretsStackName:<br>    Description: Name of the opsgenie secrets manager stack.<br>    Type: String<br>    Default: &quot;opsgenie-token&quot;<br><br>Conditions:<br>  IsDevAccount: !Equals [!Ref AWS::AccountId, &quot;630843564847&quot;]<br><br>Resources:<br>  InvestigateIAMPermissionsFunction:<br>    Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction<br>    Properties:<br>      Tags:<br>        Service: iam-detective<br>      CodeUri: iam-detective<br>      Handler: InvestigateIAMPermissions.listAllIAMRoles<br>      Runtime: nodejs18.x<br>      Environment:<br>        Variables:<br>          SQS_URL_TO_PROCESS_IAM_ROLES: !Ref InvestigateIAMPermissionsQueue<br>      Architectures:<br>        - x86_64<br>      Policies:<br>        - Statement:<br>            - Sid: Stmt1679505932243<br>              Effect: Allow<br>              Action:<br>                - sts:AssumeRole<br>              Resource:<br>                [<br>                  arn:aws:iam::XXXXXXXXXXXX:role/cross-account-access,<br>                  ...<br>                ]<br>            - Sid: Stmt1679384123196<br>              Effect: Allow<br>              Action:<br>                - sqs:SendMessage<br>              Resource: !GetAtt InvestigateIAMPermissionsQueue.Arn<br>            - Sid: Stmt1679253132905<br>              Effect: Allow<br>              Action:<br>                - secretsmanager:GetSecretValue<br>              Resource:<br>                - Fn::ImportValue:<br>                    Fn::Sub: &quot;${AirtableSecretsStackName}-ARN&quot;<br>                - Fn::ImportValue:<br>                    Fn::Sub: &quot;${OpsgenieSecretsStackName}-ARN&quot;<br>      Events:<br>        IAMDetectiveInvestigateIAMPermissionsCron:<br>          Type: Schedule<br>          Properties:<br>            Schedule: &quot;cron(0 1 * * ? *)&quot;<br>            Description: This is the cron job for the IAM Detective - Invetigate IAM permissions daily.<br>            Enabled: True<br>    Metadata: # Manage esbuild properties<br>      BuildMethod: esbuild<br>      BuildProperties:<br>        Minify: false<br>        Target: &quot;es2020&quot;<br>        Sourcemap: true<br>        EntryPoints: <br>        - InvestigateIAMPermissions.ts<br><br>  # This is an SQS queue with all default configuration properties. To learn more about the available options, see<br>  # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html<br>  InvestigateIAMPermissionsQueue:<br>    Type: AWS::SQS::Queue<br>    Properties:<br>      VisibilityTimeout: 901 # Max lambda timeout + 1 second<br>      RedrivePolicy:<br>        deadLetterTargetArn:<br>          Fn::GetAtt: [InvestigateIAMPermissionsDeadLetterQueue, Arn]<br>        maxReceiveCount: 3<br><br>  InvestigateIAMPermissionsDeadLetterQueue:<br>    Type: AWS::SQS::Queue<br><br>  # This is the Lambda function definition associated with the source code: sqs-payload-logger.js. For all available properties, see<br>  # https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction<br>  SQSIAMProcessor:<br>    Type: AWS::Serverless::Function<br>    Properties:<br>      Tags:<br>        Service: iam-detective<br>      CodeUri: iam-detective<br>      Handler: SQSIAMProcessor.sqsIAMProcessorHandler<br>      Runtime: nodejs18.x<br>      Architectures:<br>        - x86_64<br>      Description: A Lambda function that logs the payload of messages sent to an associated SQS queue.<br><br>      # This property associates this Lambda function with the SQS queue defined above, so that whenever the queue<br>      # receives a message, the Lambda function is invoked<br>      Events:<br>        SQSQueueEvent:<br>          Type: SQS<br>          Properties:<br>            Queue: !GetAtt InvestigateIAMPermissionsQueue.Arn<br>            BatchSize: 10<br>            Enabled: true<br>            ScalingConfig:<br>              MaximumConcurrency: 2<br>      MemorySize: 128<br>      Timeout: 900<br>      Policies:<br>        - Statement:<br>            - Sid: Stmt1679505932243<br>              Effect: Allow<br>              Action:<br>                - sts:AssumeRole<br>              Resource:<br>                [<br>                  arn:aws:iam::XXXXXXXXXXXX:role/cross-account-access,<br>                  ...<br>                ]<br>            - Sid: Stmt1679505932905<br>              Effect: Allow<br>              Action:<br>                - secretsmanager:GetSecretValue<br>              Resource:<br>                - Fn::ImportValue:<br>                    Fn::Sub: &quot;${AirtableSecretsStackName}-ARN&quot;<br>    Metadata: # Manage esbuild properties<br>      BuildMethod: esbuild<br>      BuildProperties:<br>        Minify: false<br>        Target: &quot;es2020&quot;<br>        Sourcemap: true<br>        EntryPoints:<br>          - SQSIAMProcessor.ts<br><br>Outputs:<br>  InvestigateIAMPermissionsFunction:<br>    Description: &quot;Investigate IAM Permissions Lambda Function ARN&quot;<br>    Value: !GetAtt InvestigateIAMPermissionsFunction.Arn<br>  InvestigateIAMPermissionsFunctionIamRole:<br>    Description: &quot;Implicit IAM Role created for Investigate IAM Permissions function&quot;<br>    Value: !GetAtt InvestigateIAMPermissionsFunctionRole.Arn<br>  InvestigateIAMPermissionsQueue:<br>    Description: &quot;The SQS queue to communicate the two lambda functions&quot;<br>    Value: !Ref InvestigateIAMPermissionsQueue<br>  InvestigateIAMPermissionsDeadLetterQueue:<br>    Description: &quot;The dead letter SQS queue to send messages that can&#39;t be processed&quot;<br>    Value: !Ref InvestigateIAMPermissionsDeadLetterQueue</pre><h3>Final thoughts</h3><p>In this journey of creating a robust microservice, we’ve uncovered the remarkable capabilities of AWS SAM. The ability to deploy, test, and maintain cloud-native applications at lightning speed is a game-changer. The power of AWS SAM, combined with your expertise, opens the door to endless possibilities for innovation and efficiency in your development process.</p><p>As you embark on your own AWS SAM adventures, remember that the cloud is your playground, and AWS SAM is your ultimate tool. Keep experimenting, keep building, and enjoy the speed and agility that AWS SAM brings to your development projects. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf69725c6ddd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enforcing IAM least privilege with AWS SAM + Airtable]]></title>
            <link>https://medium.com/cloud-native-daily/enforcing-iam-least-privilege-with-aws-sam-airtable-a3aa622dcf0c?source=rss-22629b92f6a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3aa622dcf0c</guid>
            <category><![CDATA[iam-roles]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-sam]]></category>
            <category><![CDATA[airtable]]></category>
            <dc:creator><![CDATA[Isaac Martin]]></dc:creator>
            <pubDate>Sat, 21 Oct 2023 15:31:34 GMT</pubDate>
            <atom:updated>2023-11-06T16:29:21.853Z</atom:updated>
            <content:encoded><![CDATA[<p>Grabyo has been an <a href="https://aws.amazon.com/marketplace/seller-profile?id=e99cb168-ba2b-4530-a9e9-9e40c6fa1993">AWS partner</a> for a number of years now. One of the requirements to be an AWS partner is to pass their FTR (Foundational Technical Review). An FTR is a checklist of requirements you must fulfil to be an AWS partner. One of these requirements is:</p><blockquote><strong>IAM-008 — Audit identities quarterly.</strong></blockquote><blockquote>Auditing the identities that are configured in your identity provider and IAM helps ensure that only authorized identities have access to your workload. For example, remove people that leave the organization, and remove cross-account roles that are no longer required. Have a process in place to periodically audit permissions to the services accessed by an IAM entity. This helps you identify the policies you needto modify to remove any unused permissions. For more information, see Refining permissions in AWS using last accessed information.</blockquote><p>However, following this recommended practice is easier said than done. AWS recommends using their Access Advisor tool to identify permissions no longer required.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mjPK6P5hEO__reIQJYu3lA.png" /></figure><p>At the time of writing, we have 846 roles across all our AWS accounts. Without a better system, we would need to:</p><ol><li>Ask our engineers to check Access Advisor for all the roles regularly. Let’s say every quarter.</li><li>They would need to produce a report in Access Advisor manually.</li><li>Validate against our code base if the unused permissions are still required.</li></ol><p>While doable, I don’t recommend doing it due to the following reasons:</p><ol><li>Covering all roles is challenging. We must cross-reference all roles with our Terraform code in Git to determine the right ownership.</li><li>There is enormous potential for optimizing this process and reducing the manual work done by our engineers. For example:<br>⎼ A permission to send an SNS alert if the service is down might not have been used in the last three months but may still be needed.<br>⎼ This scenario is excruciating because this permission will need a re-review in the next quarter (assuming there is no service downtime), wasting precious engineering time.</li><li>Since the process is implemented quarterly, there is a potential for almost a three-month delay in detecting unused permissions, keeping our platform less secure.</li></ol><h3>The ideal solution</h3><p>To improve this process, we decided to build a new service that should fulfil these requirements:</p><ol><li>We want to assign roles to owners (teams) responsible for reviewing all unused permissions.</li><li>Once an unused permission for a role is detected, the appropriate team must be notified to take immediate action.</li><li>If the permission is not required, the team must remove it from the role.</li><li>If the permission is still required, the team should be able to mark it as needed, and the alerting should not notify about it again.</li><li>To help with governability, we want dashboards containing near real-time information about all team roles and unused permissions.</li><li>We want to be able to define a threshold for considering a permission unused.</li><li>Initially, we have decided that an <strong>unused permission</strong> is one that has not been used in the last three months (we will refer to this term for the rest of the document). However, we would like to adjust this value in the future easily.</li></ol><h3>Introducing IAM Detective</h3><p>To enhance the efficiency of our permission management process, we&#39;ve introduced a new internal service known as IAM Detective. However, the significance of this blog post extends beyond this service. I find the technologies we&#39;ve employed truly remarkable, and I&#39;m eager to share my experience because they&#39;ve enabled me, someone who isn&#39;t a developer regularly, to construct an entirely new service from scratch in just a matter of days. These technologies are:</p><h4>AWS SAM (AWS Serverless Application Model)</h4><p>We have chosen to use AWS SAM because we believe it is the fastest way to create backend serverless microservices on top of AWS lambda. The framework provides numerous tooling out of the box that makes developing on top of it extremely fast and efficient.</p><h4>Airtable</h4><blockquote>The <em>Airtable Connected Apps Platform™ empowers teams to build custom apps on top of shared data</em>.</blockquote><p>Due to the simple and powerful APIs and data representations, we have used Airtable as our main data store. Airtable stores its data similarly to traditional SQL databases. This data representation is what makes Airtable really powerful. By default, the data gets represented as traditional tables on a spreadsheet. However, you can create other views like List, Kanban, Calendar, etc. You can achieve further customization with additional filters. I recommend having a look <a href="https://www.airtable.com/platform/views">here</a> for more details.</p><p>On top of this, Airtable provides two key features that make it the perfect choice for this service:</p><ul><li>It provides <a href="https://www.airtable.com/guides/collaborate/getting-started-with-interface-designer">interfaces</a> which are the perfect tool for creating dashboards.</li><li>It provides <a href="https://support.airtable.com/docs/getting-started-with-airtable-automations">IFTTT automation</a> and simple JavaScript scripting to perform automated tasks.</li><li>Integrates with different cloud services, which makes expandability very easy. For example, we use Airtable to send alerts to Opsgenie.</li></ul><h3>IAM Detective architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dk5VoW7F8cfkOhVvWGKiuQ.png" /></figure><p>As you can see, the architecture of this service is pretty simple. The backend service runs daily and is built on top of AWS SAM with a combination of lambdas that list all IAM roles and create access detail reports for all of them. The backend will only update Airtable for roles with unused permissions over 3 months.</p><p>You can read all about this backend in this blog post <a href="https://isaacmartin.net/building-a-microservice-lightning-fast-with-aws-sam-cf69725c6ddd">Building a Microservice Lightning-Fast with AWS SAM</a>. The rest of the blog post will focus on Airtable and how we use it to solve the service requirements.</p><p>The backend service deserves its own dedicated blog post that will come later. The rest of the blog post will focus on Airtable and how we use it to solve the service requirements.</p><h4>Data model</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UvKvaZ3w1xzIddzLcQva0g.png" /></figure><p>The previous data model diagram has 3 main tables (in red) with different attributes. The backend service manages the blue attributes, and they are a direct representation of AWS attributes. The red attributes are managed by engineers on Airtable.</p><ul><li><strong>Roles:</strong> The list of all roles in the platform that contain unused permissions. This table contains the attribute Owner (the team responsible for reviewing all unused permissions associated with that role).</li><li><strong>Unused permissions:</strong> The list of unused permissions associated with the roles and permissions tables. This table contains the attribute Status used to drive logic within Airtable. Concretely:<br>➖ <strong>To Review:</strong> An engineer must review the permission (this is the default status on creation).<br>➖ <strong>Accepted:</strong> The unused permission is still required even if it hasn’t been used in the last 3 months.<br>➖ <strong>To Delete:</strong> The unused permission is unnecessary, and an engineer will shortly remove it from the role.</li><li><strong>Permissions:</strong> The list of existing permissions in AWS for IAM roles. This list is auto-generated by the backend service.</li></ul><h3>Dashboards</h3><p>The backend will fill Airtable with many roles and unused permissions the first time it runs. It’s unavoidable that the team goes through all the roles first to assign owners. Once owners are assigned, all engineers must thoroughly sweep all unused permissions to mark them as Accepted or ToDelete.</p><p>Using <a href="https://www.airtable.com/guides/collaborate/getting-started-with-interface-designer">Airtable’s interface designer</a>, we can create interfaces in minutes to help with this process. The following dashboard is great for governance as it allows us to understand the overall status of the process and which teams have completed it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hxD9019e1xSsF_n5h73MYA.png" /></figure><p>Airtable can be difficult to navigate for new users, and it’s easy to make mistakes. For this reason, we have created a second interface to simplify the review process for our engineers:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RvcAh94P9SXHCbtH-lCgQw.png" /></figure><p>This interface has a simple set of instructions for review and only two actions for each unused permission:</p><ul><li><strong>Keep:</strong> In this case, the engineer must indicate why it is required in case of future auditing. Once the permission is marked as accepted, the system won’t alert you about it again.</li><li><strong>Delete:</strong> In this case, it’s expected that the engineer removes the permissions in the AWS role. Once this permission is deleted from the role, the backend will remove it from the database.</li></ul><h3>Alerting</h3><p>Alerting teams when new unused permissions are found is a key requirement for this new service. We can use <a href="https://support.airtable.com/docs/getting-started-with-airtable-automations">Airtable automations</a> to solve this challenge.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-d_7_01gBuaNNlB0oSlHyw.png" /></figure><p>This automation has the following steps:</p><ol><li>The trigger is a scheduled event that executes the automation daily at 4:00 a.m. BST.</li><li>The second step searches for all the roles that contain new unused permissions that haven’t been alerted before.</li><li>The last step sends an email to an Opsgeine endpoint to generate an alert for every role found.</li></ol><p>I think this IFTTT UI from Airtable is pretty intuitive, and you can easily understand it by playing with it. However, I think it’s worth covering the logic implemented in Airtable to ensure that:</p><ol><li>We don’t generate individual alerts for unused permissions that belong to the same role.</li><li>We don’t resend alerts for unused permissions daily (i.e. if the permission was not addressed).</li></ol><p>To accomplish this behaviour, we have created some additional fields in Airtable:</p><blockquote><strong>Alert in the UnusedPermissions table:</strong></blockquote><pre>IF(DATETIME_DIFF(NOW(), Created, &#39;days&#39;) &lt; 2, &quot;ALERT&quot;, &quot;IGNORE&quot;)</pre><p>This <a href="https://support.airtable.com/docs/formula-field-reference">formula attribute</a> writes a string <strong>ALERT</strong> if the unused permission is created in Airtable in the last 24 hours or <strong>IGNORE</strong> if it’s older than that. This is the key logic to avoid sending repetitive alerts.</p><blockquote><strong>AlertLookup in the Roles table:</strong></blockquote><p>This <a href="https://support.airtable.com/docs/lookup-field-overview">Lookup attribute</a> will join the combined value of all the values from the previous Alert attribute in the UnusedPermissions table. The end result looks like this:</p><pre>IGNORE, IGNORE, ALERT, IGNORE</pre><blockquote><strong>Alert Role in the Roles table:</strong></blockquote><pre>IF(FIND(&quot;ALERT&quot;, {AlertLookup (from UnusedPermissions)}), &quot;ALERT&quot;, &quot;IGNORE&quot;)</pre><p>This <a href="https://support.airtable.com/docs/formula-field-reference">formula attribute</a> searches the string “ALERT” on the previous attribute <em>AlertLookup</em> and writes ALERT if found or IGNORE otherwise.</p><p>Using the attribute <em>Owner</em>, we can create an automation per team to route the alerts to the right team.</p><h4>Alert routing</h4><p>As mentioned before, Opsgenie is the entry point for all alerts and notifications in the platform. Opsgenie is responsible for routing them to the right destination based on their severity.</p><p>Opsgenie notifies the engineering rota of the most urgent alerts. However, because these notifications are not that urgent, it create JIRA issues for the different teams to address on the next working day/sprint, and it notifies engineers on Slack so they get instant notifications as well.</p><h4><strong>Closing comments</strong></h4><p>In conclusion, IAM Detective is a game-changer for AWS IAM permissions management. By combining AWS SAM and Airtable, we’ve created an efficient and proactive system that empowers teams to manage permissions effectively. IAM Detective aligns with AWS Well-Architected principles and simplifies governance with real-time dashboards and automated alerts. We’re excited about its future potential and invite you to explore the detailed architecture in the linked blog post. If you’re ready to enhance your AWS IAM management, IAM Detective is here to assist.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3aa622dcf0c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cloud-native-daily/enforcing-iam-least-privilege-with-aws-sam-airtable-a3aa622dcf0c">Enforcing IAM least privilege with AWS SAM + Airtable</a> was originally published in <a href="https://medium.com/cloud-native-daily">Cloud Native Daily</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Security Awareness Training day at Grabyo]]></title>
            <link>https://isaac-martin.medium.com/the-security-awareness-training-day-at-grabyo-7ab8f135dd1?source=rss-22629b92f6a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ab8f135dd1</guid>
            <category><![CDATA[management]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Isaac Martin]]></dc:creator>
            <pubDate>Wed, 20 Sep 2023 18:35:25 GMT</pubDate>
            <atom:updated>2023-09-20T18:35:25.562Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rg2b7VBdpM6mCycHHwd6bw.jpeg" /></figure><p>Security is central to everything we do at Grabyo, from Engineering and Customer Support to Sales, Marketing, and HR. To protect our data and systems, we hold an annual Security Awareness Training event for our employees.</p><h3>What is Security Awareness Training Day?</h3><p>Grabyo’s Security Awareness Training, also known as Security Day, is an annual event filled with talks and workshops on various topics like phishing, social engineering, data protection, incident response, the OWASP Top 10, and specialized sessions for our engineering team. The day includes hands-on exercises to help our engineers identify and fix security vulnerabilities effectively.</p><h3>Why Security Day Matters?</h3><p>This event offers everyone a chance to learn and refresh their knowledge of security basics, stay updated on the latest trends, and understand company policies. The goal is to raise awareness of security risks in our work and encourage best practices, fostering a security-conscious culture within Grabyo.</p><h3>Diving into the Day</h3><p>Here’s an overview of what happens on Security Day:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*fHONIwvqPqKDmL0giNQmHA.png" /></figure><h4>Logistics</h4><p>A few important things to note:</p><ul><li>Multiple tracks run concurrently, allowing employees to choose sessions relevant to their roles and interests.</li><li>All talks are recorded for later viewing.</li><li>Attendees receive recommendations for <strong>must-watch talks</strong> based on their roles.</li><li>The CTO’s keynote is scheduled to accommodate different time zones.</li><li>We value feedback and provide forms for each talk and the overall event to gather input for improvement.</li></ul><h3>The talks</h3><h4>Speakers</h4><p>The bulk of our presentations are conducted by our in-house experts, making it a cost-efficient means of both acquiring and disseminating knowledge about security vulnerabilities and best practices. Our internal speakers rotate annually, providing everyone with the opportunity to delve into subjects that align closely with their roles and experiences, enabling them to share these insights with their peers.</p><p>In addition to our internal sessions, we typically feature an external speaker during the day’s proceedings. We collaborate with seasoned professionals from our network of partners and affiliations, such as AWS and SureCloud, to diversify our knowledge base. These guest speakers deliver talks on a broader spectrum of topics, including security-related products and services, automated security response solutions, and technical deep-dives into various types of application security attacks and their mitigations.</p><h4>Topics</h4><p>Our CTO delivers the main keynote of the day. The VP of Engineering delivers the Engineering keynotes of the day. The main focus of these two keynotes is as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ONAF6kwNm1rWUsllB4ts0g.png" /></figure><p>Apart from the keynotes, multiple tracks run in parallel to cover topics related to Backend, Frontend, DevSecOps and non-engineering disciplines. A few example topics per category are given below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rUV0DhnOssDLB4M7Q04_1g.png" /></figure><h3>The hands-on</h3><h4>Workshops</h4><p>We organize two distinct workshops catering to both our engineering and non-engineering teams.</p><p>For our engineering team, it’s a thrilling challenge as they attempt to breach the defenses of a highly vulnerable web application known as Juice Shop. Described on its page as “the most modern and sophisticated insecure web application,” Juice Shop serves as an ideal training ground for security exercises, awareness demonstrations, CTFs (Capture The Flag), and a testing ground for security tools. Juice Shop is rife with vulnerabilities drawn from the entire OWASP Top Ten list, as well as other security flaws found in real-world applications.</p><p>This hands-on experience unfolds as a “Capture The Flag” (CTF) game, where our engineers are divided into smaller teams, pitting their skills against each other in a series of security-themed challenges. Their aim? To “capture flags” and accumulate points. The competitive spirit is captured in our scoreboard, showcasing team achievements from the previous year.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*YBR863tj3Q6N9qdXSs3ovQ.png" /></figure><p>Meanwhile, our non-engineering departments embark on an engaging “scavenger” hunt and participate in various mini-games, all designed to promote and reinforce security best practices and tips. It’s a fun and interactive way for these teams to embrace and champion security awareness.</p><h3>Simulated attacks</h3><p>Finally, extending beyond the scope of our annual Security Day, Grabyo conducts real-world attack simulations throughout the year. This includes the distribution of convincingly crafted yet benign phishing emails to our internal employees.</p><p>These incidents, along with their corresponding responses, resurface prominently during our Security Day proceedings. This practice not only allows us to assess the current level of awareness regarding information security threats but also serves as a valuable cautionary narrative for our entire workforce.</p><h3>Is it Worth It?</h3><p>Absolutely, without a doubt. Over the past four years since implementing this new process, we’ve witnessed several direct and tangible benefits:</p><ol><li><strong>Heightened Awareness:</strong> Our engineers have significantly elevated their awareness of technology, resulting in more frequent and meaningful discussions about technological aspects. Notably, these conversations now inherently incorporate security considerations right from the outset of any project at Grabyo. This proactive approach aligns seamlessly with our strategy to shift left on security.</li><li><strong>Employee Engagement:</strong> The feedback we’ve received from our engineers highlights the company’s unwavering commitment to their professional growth. Providing the entire organization with a dedicated day to delve into technology-related subjects has been met with great appreciation. It demonstrates our dedication to nurturing our team’s skills and knowledge.</li><li><strong>Security Enhancements:</strong> Additionally, as our engineers prepare and present topics during these security days, they have astutely identified and addressed certain security vulnerabilities within our platform. This not only showcases the value of these training sessions but also leads to tangible improvements in our overall security framework.</li></ol><p>In summary, the investment in these training days has yielded substantial dividends, fostering a culture of heightened awareness, continuous learning, and proactive security measures throughout Grabyo.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ab8f135dd1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>