<?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 Sayan Moitra on Medium]]></title>
        <description><![CDATA[Stories by Sayan Moitra on Medium]]></description>
        <link>https://medium.com/@moitrasayan007?source=rss-de084af3616f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*1WOybqPcg8a3FpHpayZ1nQ.png</url>
            <title>Stories by Sayan Moitra on Medium</title>
            <link>https://medium.com/@moitrasayan007?source=rss-de084af3616f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 05:19:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@moitrasayan007/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[When Kubernetes Scales Down Mid-Stream: Why Graceful Shutdown Is Not Enough]]></title>
            <link>https://aws.plainenglish.io/when-kubernetes-scales-down-mid-stream-why-graceful-shutdown-is-not-enough-98618f5da2a3?source=rss-de084af3616f------2</link>
            <guid isPermaLink="false">https://medium.com/p/98618f5da2a3</guid>
            <category><![CDATA[keda]]></category>
            <category><![CDATA[aws-eks]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[istio]]></category>
            <dc:creator><![CDATA[Sayan Moitra]]></dc:creator>
            <pubDate>Mon, 14 Sep 2026 05:09:53 GMT</pubDate>
            <atom:updated>2026-09-14T05:24:26.731Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A practical Kubernetes, Istio, and KEDA experiment in protecting long-running streamed responses with application-level replay.</em></p><p>Imagine a user asks your application to generate a long report. The response begins streaming immediately. Halfway through, Kubernetes scales the serving Deployment down and terminates the pod handling that connection.</p><p>The Service is still healthy. Other replicas are ready. Your monitoring may stay green. But the user’s HTTP stream is gone — and a replacement pod cannot continue a response that belonged to a different TCP connection.</p><p>That uncomfortable gap is what <strong>Sessionfall</strong> was built to explore.</p><p>Sessionfall is a reproducible lab that compares two ways of surviving pod termination during a streamed response:</p><ul><li><strong>Connection draining</strong>, which gives existing work time to finish before the pod and its Istio sidecar disappear.</li><li><strong>Application replay</strong>, which lets a client reconnect to another replica and continue after its last accepted event.</li></ul><p>The experiment does not try to prove a universal availability number. It asks a narrower and more useful question: <strong>under which shutdown conditions does draining finish the stream, and when does the application need an explicit recovery contract?</strong></p><h3>The architecture: durable work, disposable delivery</h3><p>Sessionfall deliberately separates producing a report from delivering it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tcpRTS05K24CQvLL3uDOTQ.jpeg" /></figure><p>The replay service creates synthetic output at a configurable interval. Before an event can be delivered, it is committed to SQLite with its job ID, sequence number, text, digest, and creation time. The database uses write-ahead logging on a persistent volume.</p><p>Delivery pods do not own event state. They expose a Server-Sent Events stream, read committed events from the replay service, and attach their pod identity to the response. KEDA and the Horizontal Pod Autoscaler change only the number of delivery replicas; the replay service and stable relay remain outside that scaling boundary.</p><p>This separation is the central design decision. A delivery pod can disappear without erasing the report. A new connection can land on any surviving pod and request:</p><pre>/jobs/{job-id}/stream?after={last-accepted-sequence}</pre><p>That cursor is the recovery contract.</p><h3>A healthy Service cannot rescue an existing stream</h3><p>Kubernetes Services route connections; they do not migrate live ones. Once a streamed response has been assigned to a pod, adding or retaining healthy replicas does not transfer that response elsewhere.</p><p>This distinction is easy to lose in operational dashboards. Replica availability answers, “Can a new request be served?” Stream completion answers, “Did this user receive all of the work they already started?” Those are different measurements.</p><p>Sessionfall therefore records the initial serving pod for every client. When a pod is removed, the results distinguish clients that were actually affected from clients already connected to survivors. Without that owner-level evidence, a test can make shutdown behavior look safer than it is.</p><h3>There is more than one drain clock</h3><p>With Istio classic sidecars, graceful termination involves at least three related lifetimes:</p><ol><li>The application’s own drain allowance.</li><li>The proxy’s termination drain duration.</li><li>The pod’s overall termination grace period.</li></ol><p>Making one of them large does not automatically align the others.</p><p>In Sessionfall, the delivery application handles SIGTERM by becoming unready, refusing new stream handlers, and waiting for active handlers up to its configured allowance. Istio has its own termination behavior. The pod grace period places an outer bound around the shutdown process.</p><p>The lab compares four configurations:</p><p>TreatmentApplication allowanceProxy termination periodReport lengthImmediate0 seconds65 seconds48 secondsMismatched65 seconds5 seconds48 secondsCoordinated65 seconds65 seconds48 secondsBeyond windows65 seconds65 seconds96 seconds</p><p>Each configuration is exercised using both targeted pod deletion and actual KEDA/HPA scale-down. That distinction matters: deleting a chosen pod proves a specific interruption path, while autoscaling introduces controller timing and victim selection.</p><h3>Two clients, one report</h3><p>For every trial, baseline and resumable clients consume the same persisted report.</p><p>The baseline client stops when its stream is interrupted. The resumable client retains the highest contiguous sequence it has accepted, reconnects through the relay, and asks for events after that cursor.</p><p>On every chunk, the client verifies:</p><ul><li>The sequence is strictly increasing and contiguous.</li><li>The text matches its SHA-256 digest.</li><li>An already accepted sequence is not accepted twice.</li></ul><p>The offline analysis then compares accepted events with a consistent database snapshot. This is stronger than declaring success because a client reached the end of an HTTP response: it checks that the reconstructed result matches the durable source of truth.</p><p>It is still important to be precise. Sessionfall demonstrates exactly-once <strong>acceptance inside this client protocol</strong> for the measured runs. It does not demonstrate exactly-once business side effects, durable browser cursor storage, or multi-tenant replay authorization.</p><h3>What happened in the cluster</h3><p>The verified experiment ran on Kubernetes 1.35.1, Istio 1.30.4 with classic sidecars, and KEDA 2.20.0. It completed 16 trials and produced 192 known client outcomes.</p><p>Across the full matrix:</p><ul><li>Baseline clients completed <strong>57 of 96</strong> streams.</li><li>Resumable clients completed <strong>96 of 96</strong> streams.</li><li>Both clients completed every short report under coordinated draining.</li><li>Outside coordinated draining, every baseline client whose initial delivery pod was removed failed.</li><li>Persisted event comparison found <strong>zero sequence or digest issues and zero duplicate acceptances</strong>.</li></ul><p>The pooled 57/96 and 96/96 figures describe this test matrix, not production reliability percentages. The trials share faults, run on one minikube node, and use synthetic output.</p><p>The recovery timing is nevertheless useful for understanding the mechanism. In disrupted cells, the observed p95 from detected failure to the next accepted chunk ranged from roughly <strong>0.263 to 0.271 seconds</strong>. The p95 gap from the last delivered event to the next event ranged from <strong>0.818 to 1.127 seconds</strong>. Those values reflect a small local experiment and a 250-millisecond initial retry delay; they are not latency promises.</p><h3>The surprising mismatch</h3><p>The most revealing treatment gave the application 65 seconds to drain but the proxy only five seconds.</p><p>One might expect the application to remain alive for most of its allowance. Instead, pods were observed disappearing roughly 5.8 to 6.7 seconds after proxy draining began.</p><p>Why? The application waits only while handlers remain active. If the proxy disappears and the stream write or a dependency path fails, the handler can finish early. A long application allowance is therefore not the same thing as a guaranteed long pod lifetime.</p><p>The retained evidence supports that interpretation, but it does not identify the precise failure path of every handler. Sessionfall intentionally preserves that uncertainty. A useful reliability experiment should expose the limits of its observations instead of turning timing correlations into certainty.</p><h3>What the results mean</h3><p>The experiment suggests three practical rules.</p><h3>1. Use coordinated draining for bounded work</h3><p>If the maximum stream duration is known, short, and comfortably inside aligned application, proxy, and pod windows, draining can let in-flight work finish without reconnecting. Sessionfall’s coordinated short reports demonstrate that path.</p><p>But “comfortably inside” needs evidence. Verify effective proxy configuration, observe the actual application behavior, and test the full stream — not just readiness transitions.</p><h3>2. Use replay when work can exceed infrastructure windows</h3><p>No reasonable grace period can cover every long-running or unbounded stream. Large drain windows also keep terminating resources around longer.</p><p>Cursor-based replay converts an interrupted transport into a recoverable application session. The durable unit is no longer the socket; it is the ordered event log plus the client’s last accepted sequence.</p><h3>3. Treat replay storage as a new reliability boundary</h3><p>Replay does not remove state. It relocates it.</p><p>Sessionfall uses one SQLite writer on one persistent volume, which is intentionally simple and not highly available. A production design must decide how events are retained, authorized, partitioned, expired, and recovered if the replay store or its volume fails.</p><h3>How to test this in your own platform</h3><p>A shutdown test becomes much more informative when it records user-visible completion alongside infrastructure state.</p><p>Start with this checklist:</p><ol><li>Give every streamed event an ordered, resumable identity.</li><li>Record which pod owns each connection.</li><li>Verify the proxy’s effective runtime settings rather than trusting intended configuration.</li><li>Test targeted termination separately from autoscaler-driven reduction.</li><li>Measure completed work, not only ready replicas or clean process exits.</li><li>Preserve failed attempts and unknown outcomes.</li><li>Compare the reconstructed client result with a durable source of truth.</li></ol><p>That last point matters most. A system can terminate gracefully from the platform’s point of view while still returning an incomplete answer to the user.</p><h3>The deeper lesson</h3><p>Connection draining and application replay solve different parts of the same problem.</p><p>Draining protects work that can finish while the original process and proxy remain available. Replay protects the logical session after that transport boundary is gone. For many streamed systems, the strongest design is not choosing one technique over the other — it is using bounded draining for the common case and replay for recovery.</p><p>Sessionfall makes that boundary visible. It turns “the Service stayed healthy” into a more demanding question:</p><p><strong>Did the user’s work actually finish, and if the connection died, could another replica prove where to continue?</strong></p><p>That is the reliability contract long-running streams need.</p><p><em>Suggested Medium topics: Kubernetes, Istio, KEDA, Site Reliability Engineering, Distributed Systems</em></p><p>Reference — <a href="https://github.com/moitrasayan007/sessionfall">https://github.com/moitrasayan007/sessionfall</a></p><h3>Before you go</h3><ul><li>Please take a moment to like the post and follow the writer!</li><li>Did you know that over 400,000 developers share what they’re building, learning, and discovering across our platforms every month? Learn how you can contribute <a href="https://plainenglish.io/write-for-us">here</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=98618f5da2a3" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/when-kubernetes-scales-down-mid-stream-why-graceful-shutdown-is-not-enough-98618f5da2a3">When Kubernetes Scales Down Mid-Stream: Why Graceful Shutdown Is Not Enough</a> was originally published in <a href="https://aws.plainenglish.io/">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using the AWS Serverless plugin for Claude Code to go from empty folder to live API without…]]></title>
            <link>https://moitrasayan007.medium.com/using-the-aws-serverless-plugin-for-claude-code-to-go-from-empty-folder-to-live-api-without-069411982092?source=rss-de084af3616f------2</link>
            <guid isPermaLink="false">https://medium.com/p/069411982092</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[mcps]]></category>
            <category><![CDATA[serverless]]></category>
            <dc:creator><![CDATA[Sayan Moitra]]></dc:creator>
            <pubDate>Thu, 09 Apr 2026 12:56:16 GMT</pubDate>
            <atom:updated>2026-04-10T03:47:10.241Z</atom:updated>
            <content:encoded><![CDATA[<h3>Using the AWS Serverless plugin for Claude Code to go from empty folder to live API without touching the console</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*WwFtbZo2ISn73vd6Gv1bsA.png" /></figure><p>For as long as I’ve been writing serverless apps, the ritual has been the same. Open the docs. Run sam init. Pick a template. Rip out the hello-world code. Write the real template.yaml. Forget a Policies block. Re-deploy. Forget to enable tracing. Re-deploy. Forget to set log retention. Re-deploy. Write a README so future-me remembers what any of this does.</p><p>This week I skipped all of that. I opened Claude Code, pasted one prompt, and watched it do the whole thing — correctly, on the first try, with a confirmation gate before anything billable happened.</p><p>This post isn’t about the app I built. It’s about the workflow, because the workflow is the interesting part.</p><h3>The setup</h3><p>Claude Code has a plugin system, and one of the plugins is aws-serverless. It exposes an MCP server with tools like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rERfndSkPiqEeYL5rSN98g.png" /></figure><ul><li>get_iac_guidance — returns guidance on picking SAM vs CDK vs CloudFormation</li><li>get_lambda_guidance — sanity checks whether Lambda is actually the right compute for your use case</li><li>get_serverless_templates — searches the Serverless Land pattern catalog</li><li>sam_init / sam_build / sam_deploy — drives the SAM CLI directly</li><li>sam_local_invoke / sam_logs — for testing and debugging</li><li>A handful of specialized tools for event source mappings, metrics, and IAM policies</li></ul><p>The important word is <strong>drives</strong>. These aren’t “here’s a snippet, you run it.” Claude calls the tools, the tools shell out to sam, and the output flows back into the conversation. Claude can read errors, fix the template, and rebuild — all inside a single turn of work.</p><h3>The prompt</h3><p>Here’s the exact prompt I used (with the obvious placeholders filled in)</p><blockquote>Create a production-ready serverless URL shortener on AWS using SAM with Node.js 20 Lambda, API Gateway HTTP API (CORS), DynamoDB (on-demand), least-privilege IAM, X-Ray tracing, CloudWatch alarms, and dev/prod samconfig.toml — use get_iac_guidance, get_lambda_guidance, get_serverless_templates, then sam_init, sam_build, and sam_deploy to us-east-1.</blockquote><p>Notice what this prompt <em>isn’t</em>: it isn’t code. It isn’t YAML. It isn’t a checklist of CloudFormation resources. It’s a requirements list written in the same language I’d use in a design doc.</p><h3>What actually happened</h3><p>Claude worked through the request in order:</p><ol><li><strong>Guidance first.</strong> It called get_iac_guidance and get_lambda_guidance, confirmed SAM was the right IaC choice and Lambda fit the workload, and skimmed get_serverless_templates to see if any Serverless Land pattern matched. None did exactly, so it scaffolded from hello-world and then replaced the contents.</li><li><strong>Tooling check.</strong> On the first sam_init call, the MCP tool returned sam not found. Claude noticed, asked me whether to install SAM via Homebrew or pause, and — after I said &quot;install&quot; — ran brew install aws-sam-cli, verified credentials with aws sts get-caller-identity, and retried.</li><li><strong>Scaffolding.</strong> sam_init created the project. Claude deleted the hello-world folder, created a clean src/ directory, wrote the Lambda handler (ESM, AWS SDK v3, collision-safe short-code generation, TTL support, fire-and-forget hit counter), wrote a real template.yaml with least-privilege IAM scoped to the table ARN, and wrote a samconfig.toml with separate dev and prod sections.</li><li><strong>Build.</strong> sam_build — succeeded first try.</li><li><strong>Confirmation gate.</strong> Before deploying, Claude explicitly asked: “Ready to deploy to us-east-1 in account &lt;AWS_Account_ID&gt;? This will create billable resources.” I had to click “yes.” This is not an accident — the MCP server instructions literally say <em>“CRITICAL: Always ask user for explicit confirmation before any deployment.”</em></li><li><strong>Deploy.</strong> sam_deploy rolled out sixteen resources cleanly: Lambda, HTTP API + stage, DynamoDB table, IAM role, SNS topic, five CloudWatch alarms, two log groups, three Lambda permissions.</li><li><strong>Smoke test.</strong> Claude curled /health, POST /, and GET /{code} against the live endpoint and reported back with the actual HTTP responses.</li></ol><p>Total wall time: about eight minutes. Zero clicks in the AWS console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S0YJD2wQxl7MM8yXXmaeyA.png" /></figure><h3>Why this is different from “AI wrote some YAML”</h3><p>Code generation is old news. GitHub Copilot was writing CloudFormation snippets in 2022. What’s new here is three specific properties of the MCP plugin model:</p><p><strong>1. Tool access, not just text.</strong> Claude isn’t guessing at what sam deploy will say. It runs it, reads the real output, and reacts. When the deploy printed &quot;Waiting for changeset to be created...&quot; and then dumped the CloudFormation event stream, Claude parsed that stream, extracted the stack outputs, and used the ApiUrl value in its very next curl call.</p><p><strong>2. Domain-specific guidance tools.</strong> get_iac_guidance isn&#39;t a wrapper around a web search. It&#39;s a curated decision document written by AWS that ships inside the plugin. get_serverless_templates searches a real pattern library. The model has strong opinions and the plugin gives it strong evidence to back them up.</p><p><strong>3. Built-in safety rails.</strong> The MCP server’s own instructions require confirmation before deploys. When Claude went to run sam_deploy, it didn&#39;t just do it — it stopped, listed the resources it was about to create, mentioned the account number, and waited. That&#39;s the difference between a demo and something you can actually hand to a teammate.</p><h3>The parts that surprised me</h3><p>A few things I didn’t expect:</p><ul><li><strong>It asked about decisions I hadn’t specified.</strong> Did I want an SNS email subscription on the alarm topic? Dev only, or dev and prod? Which AWS profile? Each question came with options and a recommended default.</li><li><strong>It picked sensible production defaults I forgot to ask for.</strong> Point-in-time recovery on the DynamoDB table. DeletionPolicy: Retain on the table so a stack delete doesn&#39;t nuke user data. Throttling on the HTTP API stage. Access logging with a structured JSON format. p99 duration alarm, not just errors.</li><li><strong>It used arm64.</strong> I didn’t say to. It just defaulted to arm64 Lambdas because they’re cheaper and faster for this workload. When I checked the template later, it was the right call.</li><li><strong>The Lambda handler had real production details.</strong> Conditional writes with retry-on-collision for the short code. TTL validation. Base64 body decoding. A regex on the path parameter to block weird characters. A try/catch that downgrades hit-counter failures to warnings so the redirect never blocks on an unrelated write.</li></ul><p>None of this was in my prompt. Claude inferred it from “production-ready.”</p><h3>What you still have to do yourself</h3><p>This isn’t magic, and the workflow has edges:</p><ul><li><strong>You need to verify the template.</strong> I read every line of template.yaml before approving the deploy. Claude gets IAM right most of the time, but &quot;most of the time&quot; is not good enough for production IAM.</li><li><strong>You need real tests.</strong> The smoke test Claude ran is a smoke test, not a test suite. You still need integration tests, contract tests, and load tests.</li><li><strong>You own the bill.</strong> Claude asked before deploying, but once deployed, the meter is running. DeletionPolicy: Retain on the DynamoDB table means sam delete will leave it behind — a safety feature, but also a footgun if you forget to clean up.</li><li><strong>Credentials and permissions are yours.</strong> The plugin uses whatever AWS profile your shell is using. If that profile has AdministratorAccess, Claude has AdministratorAccess for the duration of the deploy. Scope it down.</li></ul><h3>How to try this yourself</h3><ol><li>Install Claude Code and the aws-serverless plugin.</li><li>Install the AWS SAM CLI (brew install aws-sam-cli on macOS).</li><li>Configure AWS credentials (aws configure).</li><li>Open a fresh folder in Claude Code.</li><li>Describe what you want. Be specific about non-functional requirements: runtime, IAM posture, observability, environments.</li><li>Read the template before you approve the deploy.</li><li>Watch it go live.</li></ol><h3>The shift</h3><p>I’ve been doing AWS work for years, and the thing I keep coming back to is how much of my job has been <em>translation — </em>taking a product requirement and converting it into a dialect of YAML that CloudFormation can understand. The MCP plugin model is starting to collapse that translation layer. Not remove it — I still need to read what comes out — but collapse it from “spend an afternoon” to “describe it once.”</p><p>It doesn’t make me less valuable as an engineer. It makes the boring 80% of the job take five minutes, so I can spend the rest of my day on the parts that actually need human judgment: the threat model, the data contracts, the capacity planning, the runbook.</p><p>That’s a trade I’ll take.</p><p><em>The workflow here works for any serverless app: REST APIs, webhook receivers, scheduled jobs, Kinesis/SQS consumers. Swap “URL shortener” in the prompt for whatever you’re building and run.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=069411982092" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Obsidian Bazaar — Turning EKS into a Reliability Market]]></title>
            <link>https://aws.plainenglish.io/obsidian-bazaar-turning-eks-into-a-reliability-market-85cb8361a4e7?source=rss-de084af3616f------2</link>
            <guid isPermaLink="false">https://medium.com/p/85cb8361a4e7</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[amazon-eks]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Sayan Moitra]]></dc:creator>
            <pubDate>Mon, 12 Jan 2026 10:56:57 GMT</pubDate>
            <atom:updated>2026-01-12T11:26:43.511Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Obsidian Bazaar — Turning EKS into a Reliability Market</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tOAqpnTnW2FMdzSo_qX6pw.png" /></figure><p>Most Kubernetes projects optimize for efficiency: autoscaling, cost controls, and cluster utilization. Obsidian Bazaar asks a stranger question:</p><blockquote>“What if reliability itself was currency?”</blockquote><p>Obsidian Bazaar is an experimental EKS platform that transforms your cluster into a tiny economic system. Services earn tokens based on SLO health, then bid for resources in periodic auctions. The healthier a service is, the more purchasing power it gains. The more it degrades, the less it can win.</p><p>This is not a blockchain project. No coins. No NFTs. The system uses <strong>immudb</strong> for tamper-evident provenance — a ledger that records every bid, allocation, and chaos event without the overhead of chain infrastructure.</p><h3>The Big Idea</h3><p>Reliability is expensive. When teams ask for more CPU or memory, they’re asking the cluster to make tradeoffs. Obsidian Bazaar makes those tradeoffs explicit and measurable:</p><ul><li><strong>Healthy services are rewarded</strong>: tokens minted from SLO health.</li><li><strong>Unhealthy services pay a tax</strong>: LitmusChaos runs experiments that drain budgets.</li><li><strong>Policies keep the market fair</strong>: OPA Gatekeeper blocks unsafe bids.</li><li><strong>Everything is observable</strong>: OpenTelemetry + Prometheus + ledgered events.</li></ul><h3>Architecture at a Glance</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*Y8DcWpU-mazrmBJmEbgGLw.png" /></figure><p>Obsidian Bazaar’s core components:</p><ul><li><strong>Token Minter</strong>: CronJob that converts SLO health into tokens on Budget CRDs</li><li><strong>Market Controller</strong>: reconciles Bid and Budget CRDs, settles auctions</li><li><strong>LitmusChaos</strong>: applies chaos penalties when error budgets are violated</li><li><strong>OPA Gatekeeper</strong>: enforces bidding rules and limits</li><li><strong>KEDA</strong>: scales services based on auction results</li><li><strong>immudb</strong>: tamper-evident ledger for provenance</li></ul><h3>A Demo That Makes It Click</h3><p>Deploy two services:</p><ul><li><strong>Merchant-A</strong>: stable, passes SLOs -&gt; earns tokens -&gt; wins auctions</li><li><strong>Merchant-B</strong>: flaky, fails SLOs -&gt; gets chaos-taxed -&gt; loses bids</li></ul><p>The market feels alive: allocations shift over time based on behavior, not static quotas.</p><h3>Example: A Simple Bid</h3><pre>apiVersion: market.obsidianbazaar.io/v1alpha1<br>kind: Bid<br>metadata:<br>  name: merchant-a-epoch-001<br>  namespace: merchants<br>spec:<br>  serviceName: merchant-a<br>  amount: 30<br>  epoch: &quot;001&quot;</pre><p>If Merchant-A has enough tokens, the controller accepts the bid and writes the allocation to the market-allocations ConfigMap.</p><h3>Github Repo</h3><p><a href="https://github.com/moitrasayan007/eks-obsidian-bazaar">https://github.com/moitrasayan007/eks-obsidian-bazaar</a></p><h3>Why This Is Rare</h3><p>Obsidian Bazaar is unusual because it blends disciplines that don’t normally meet:</p><ul><li><strong>Economy-driven autoscaling</strong></li><li><strong>Chaos engineering as a penalty mechanism</strong></li><li><strong>Policy-enforced reliability guarantees</strong></li><li><strong>Tamper-evident provenance without blockchain</strong></li></ul><p>Instead of “scale when busy,” it says “scale when you’ve earned it.”</p><h3>Where This Can Go Next</h3><ul><li>An “Auction House” UI with history + analytics</li><li>Fraud detection (e.g., Falco) for anomalous bidding</li><li>Full SLO orchestration with Keptn</li><li>Real scaling driven by allocation metrics</li></ul><h3>Closing Thought</h3><p>Obsidian Bazaar is a game, but the stakes are real. It turns reliability into a measurable currency and makes tradeoffs visible. If you’ve ever wanted your cluster to reward good behavior instead of just surviving bad behavior, this is a bold place to start.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85cb8361a4e7" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/obsidian-bazaar-turning-eks-into-a-reliability-market-85cb8361a4e7">Obsidian Bazaar — Turning EKS into a Reliability Market</a> was originally published in <a href="https://aws.plainenglish.io/">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Revolutionising GitOps: EKS Capabilities for ArgoCD with Amazon EKS]]></title>
            <link>https://aws.plainenglish.io/revolutionising-gitops-eks-capabilities-for-argocd-with-amazon-eks-a38a53076349?source=rss-de084af3616f------2</link>
            <guid isPermaLink="false">https://medium.com/p/a38a53076349</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[gitops]]></category>
            <category><![CDATA[amazon-eks]]></category>
            <category><![CDATA[kubernetes-argocd]]></category>
            <dc:creator><![CDATA[Sayan Moitra]]></dc:creator>
            <pubDate>Fri, 02 Jan 2026 04:42:56 GMT</pubDate>
            <atom:updated>2026-01-04T11:58:00.638Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Exploring the new EKS capabilities for workload orchestration and cloud resource management</em></p><h3>Introduction</h3><p>The world of Kubernetes deployment has just gotten a major upgrade. AWS recently announced new EKS capabilities that include fully managed ArgoCD, transforming how we approach GitOps workflows. In this article, I’ll walk you through implementing a complete GitOps pipeline using EKS capabilities for ArgoCD with Amazon EKS.</p><h3>What’s New with EKS Capabilities for ArgoCD?</h3><p>AWS has taken the complexity out of ArgoCD management by offering it as a fully managed service within EKS. This means:</p><ul><li><strong>Zero Maintenance</strong>: AWS handles installation, updates, and patches</li><li><strong>Enterprise Security</strong>: Native IAM integration and AWS security best practices</li><li><strong>High Availability</strong>: Multi-AZ deployment with automatic failover</li></ul><h3>Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*sudLQkLh5IOVejFXxAsa1g.jpeg" /></figure><h3>The GitOps Architecture</h3><p>Here’s how the complete workflow looks:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h8emP008r32FgS0tSQzUKg.png" /></figure><h3>Hands-On Implementation</h3><p>Let’s build a practical GitOps pipeline with two application versions to demonstrate the power of this setup.</p><h3>Project Structure</h3><pre>k8s-eks-argocd-capabilities/<br>├── app-v1/<br>│   ├── deployment.yaml         # Kubernetes deployment and service<br>│   └── nodejs-app.yaml         # ArgoCD application definition<br>├── app-v2/<br>│   ├── deployment.yaml         # Kubernetes deployment and service<br>│   └── nodejs-app.yaml         # ArgoCD application definition<br>├── argo-secret.yaml            # EKS cluster connection secret<br>└── README.md</pre><h3>Prerequisites</h3><p>Before deploying and managing our application with ArgoCD, we must first enable and configure EKS capabilities for ArgoCD.</p><ol><li><strong>Set up the EKS Cluster:</strong><br>Ensure the EKS cluster is up and running.</li><li><strong>Enable Capabilities for ArgoCD:</strong><br>Once the cluster is set up, navigate to the Capabilities section and install ArgoCD with the required configurations.</li><li><strong>Configure IAM Identity Center:</strong><br>Set up IAM Identity Center, as this will be used for ArgoCD UI login in.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TG5YTS68vk6E9IhI5fKaiA.png" /></figure><h3>Required role permissions for Access Entry</h3><p>We need to setup the below role permission</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UfzzWsI2gRgLG9-V2dfdlA.png" /></figure><p>Once this is done, we can access the ArgoCD UI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PqGzlhrRMOoruz69KlMAkQ.png" /></figure><p>Before proceeding, we need to register our cluster as a deployment target with ArgoCD so it can access the EKS cluster. There are two ways to do this:</p><ol><li><strong>Using the ArgoCD CLI:</strong><br>Use the ArgoCD command-line tool to add our EKS cluster to ArgoCD.</li><li><strong>Using the Kubernetes Secret:</strong><br>Register our EKS cluster with Kubernetes secret.</li></ol><h4>Option 1:</h4><p>Using <strong>ArgoCD CLI</strong>.</p><pre>argocd cluster add &lt;cluster-context-name&gt; \<br>  --aws-cluster-name arn:aws:eks:&lt;region&gt;:&lt;account_id&gt;:cluster/prod-eks \<br>  --name local-cluster</pre><h4>Option 2:</h4><p>Also using <strong>Kubernetes Secret</strong></p><pre>apiVersion: v1<br>kind: Secret<br>metadata:<br>  name: prod-cluster-local<br>  namespace: argocd<br>  labels:<br>    argocd.argoproj.io/secret-type: cluster<br>stringData:<br>  name: prod-cluster-local<br>  server: arn:aws:eks:&lt;region&gt;:&lt;account_id&gt;:cluster/prod-eks<br>  project: default</pre><p>In this scenario, we will use the second option (Kubernetes Secret):</p><ul><li>After the cluster is created, go to <strong>Settings → Cluster</strong> in the ArgoCD UI.</li><li>We should be seeing that ArgoCD has registered our EKS cluster.</li></ul><p>Now we are ready to deploy our application.</p><h3>Setting Up ArgoCD Applications</h3><p>The magic happens in the ArgoCD application manifests. Here’s what makes them powerful:</p><pre>apiVersion: argoproj.io/v1alpha1<br>kind: Application<br>metadata:<br>  name: nodejs-app<br>  namespace: argocd<br>spec:<br>  project: default<br>  source:<br>    repoURL: https://github.com/our-repo/k8s-eks-argocd-capabilities.git<br>    targetRevision: master<br>    path: app-v1<br>  destination:<br>    name: prod-cluster-local<br>    namespace: sample-app<br>  syncPolicy:<br>    automated:<br>      prune: true<br>      selfHeal: true<br>    syncOptions:<br>    - CreateNamespace=true<br>    - ServerSideApply=true</pre><h3>Key Features That Make This Special</h3><p><strong>1. Automated Sync Policy</strong></p><ul><li>prune: true - Removes resources not defined in Git</li><li>selfHeal: true - Automatically corrects configuration drift</li></ul><p><strong>2. Smart Sync Options</strong></p><ul><li>CreateNamespace=true - Automatically creates target namespaces</li><li>ServerSideApply=true - Uses Kubernetes server-side apply for better conflict resolution</li></ul><p><strong>3. Multi-Environment Support</strong> Our setup demonstrates running two versions simultaneously in different namespaces, perfect for blue-green deployments or A/B testing.</p><h3>Deployment Workflow</h3><p>Getting started is surprisingly simple:</p><pre># 1. Configure cluster connection<br>kubectl apply -f argo-secret.yaml<br><br># 2. Deploy applications<br>kubectl apply -f app-v1/nodejs-app.yaml<br>kubectl apply -f app-v2/nodejs-app.yaml<br><br># 3. Verify deployments<br>kubectl get applications -n argocd<br>kubectl get pods -n sample-app<br>kubectl get pods -n sample-app-v2</pre><h3>The GitOps Magic in Action</h3><p>Once deployed, here’s what happens automatically:</p><ol><li><strong>Developer commits</strong> changes to the Git repository</li><li><strong>ArgoCD detects</strong> changes through polling</li><li><strong>Automatic synchronisation</strong> applies changes to the cluster</li><li><strong>Self-healing</strong> ensures the cluster state matches Git</li><li><strong>Pruning</strong> removes any resources not defined in Git</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zo-3Vum70WqOWJU5lqWcQA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FQAdQUYxOAL7ZRFwMXgULQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tkSHbKlNGXveaRksXXWmRw.png" /></figure><h3>Why This Matters</h3><h3>For DevOps Teams</h3><ul><li><strong>Reduced Operational Overhead</strong>: No more ArgoCD maintenance</li><li><strong>Enhanced Security</strong>: AWS-managed security updates and patches</li><li><strong>Better Reliability</strong>: Multi-AZ deployment ensures high availability</li></ul><h3>For Developers</h3><ul><li><strong>Faster Deployments</strong>: Push to Git and watch it deploy</li><li><strong>Easy Rollbacks</strong>: Git history becomes our deployment history</li><li><strong>Environment Consistency</strong>: Same process across all environments</li></ul><h3>For Organizations</h3><ul><li><strong>Audit Trail</strong>: Complete deployment history in Git</li><li><strong>Compliance</strong>: Declarative infrastructure meets regulatory requirements</li><li><strong>Cost Optimization</strong>: Pay only for what we use, no infrastructure overhead</li></ul><h3>Best Practices and Considerations</h3><p><strong>Security First</strong></p><ul><li>Use IAM roles for service accounts (IRSA) for fine-grained permissions</li><li>Implement Git repository access controls</li><li>Regular security scanning of container images</li></ul><p><strong>Repository Organization</strong></p><ul><li>Separate application code from deployment manifests</li><li>Use Git branches for environment-specific configurations</li><li>Implement proper Git workflow with pull request reviews</li></ul><h3>Real-World Impact</h3><p>This managed approach to GitOps eliminates common pain points:</p><ul><li><strong>No more ArgoCD version management headaches</strong></li><li><strong>Automatic security patches and updates</strong></li><li><strong>Built-in high availability without complex setup</strong></li><li><strong>Native AWS integration for monitoring and logging</strong></li></ul><h3>Getting Started Today</h3><p>Ready to implement this in your organisation? Here’s your action plan:</p><ol><li><strong>Enable EKS capabilities for ArgoCD</strong> in your existing cluster</li><li><strong>Structure your Git repositories</strong> following GitOps principles</li><li><strong>Start small</strong> with a non-critical application</li><li><strong>Gradually migrate</strong> existing deployments to the GitOps model</li><li><strong>Train your team</strong> on Git-based deployment workflows</li></ol><h3>Conclusion</h3><p>EKS Capabilities for ArgoCD with EKS represents a significant leap forward in Kubernetes deployment automation. By removing the operational complexity of managing ArgoCD while providing enterprise-grade features, AWS has made GitOps accessible to organizations of all sizes.</p><p>The combination of declarative configuration, automated synchronization, and AWS’s managed infrastructure creates a powerful platform for modern application deployment. Whether we’re running microservices, monoliths, or hybrid architectures, this approach provides the reliability, security, and scalability needed for production workloads.</p><p>Start your GitOps journey today and experience the future of Kubernetes deployment automation.</p><p><strong><em>Want to try this yourself? Check out the complete implementation on </em></strong><a href="https://github.com/moitrasayan007/k8s-eks-argocd-capabilities"><strong><em>GitHub</em></strong></a><strong><em> and start building your own GitOps pipeline.</em></strong></p><h3>A message from our Founder</h3><p><strong>Hey, </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>Sunil</strong></a><strong> here.</strong> I wanted to take a moment to thank you for reading until the end and for being a part of this community.</p><p>Did you know that our team run these publications as a volunteer effort to over 3.5m monthly readers? <strong>We don’t receive any funding, we do this to support the community. ❤️</strong></p><p>If you want to show some love, please take a moment to <strong>follow me on </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>LinkedIn</strong></a><strong>, </strong><a href="https://tiktok.com/@messyfounder"><strong>TikTok</strong></a>, <a href="https://instagram.com/sunilsandhu"><strong>Instagram</strong></a>. You can also subscribe to our <a href="https://newsletter.plainenglish.io/"><strong>weekly newsletter</strong></a>.</p><p>And before you go, don’t forget to <strong>clap</strong> and <strong>follow</strong> the writer️!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a38a53076349" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/revolutionising-gitops-eks-capabilities-for-argocd-with-amazon-eks-a38a53076349">Revolutionising GitOps: EKS Capabilities for ArgoCD with Amazon EKS</a> was originally published in <a href="https://aws.plainenglish.io/">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Scalable Microservices Platform with NATS on Amazon EKS]]></title>
            <link>https://aws.plainenglish.io/building-a-scalable-microservices-platform-with-nats-on-aws-eks-43e3790218e7?source=rss-de084af3616f------2</link>
            <guid isPermaLink="false">https://medium.com/p/43e3790218e7</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[amazon-eks]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Sayan Moitra]]></dc:creator>
            <pubDate>Tue, 30 Dec 2025 04:10:20 GMT</pubDate>
            <atom:updated>2026-01-04T11:58:35.686Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*-bU3X6bAQORyrwcsyff65Q.png" /></figure><p>In modern cloud-native architectures, effective communication between microservices is critical. NATS, a high-performance messaging system, combined with Amazon EKS (Elastic Kubernetes Service), provides a powerful foundation for building scalable, resilient distributed systems.</p><p>In this article, we’ll build a real-world microservices application that demonstrates NATS messaging patterns on Amazon EKS, including pub-sub, request-reply, and JetStream for persistence.</p><h3>Architecture Overview</h3><p>Our architecture consists of:</p><ul><li><strong>Amazon EKS Cluster</strong>: Managed Kubernetes control plane</li><li><strong>NATS Server with JetStream</strong>: Distributed messaging backbone</li><li><strong>Order Service</strong>: Publishes order events</li><li><strong>Inventory Service</strong>: Subscribes to order events and manages stock</li><li><strong>Notification Service</strong>: Sends notifications for order updates</li><li><strong>API Gateway</strong>: REST API for external interactions</li></ul><h3>Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*SRKzxwgZtqFny6iWhIA6gg.jpeg" /><figcaption>Event-Driven Microservices with NATS on Amazon EKS</figcaption></figure><h3>Prerequisites</h3><ul><li>AWS CLI configured with appropriate credentials</li><li>kubectl installed</li><li>Helm 3.x installed</li><li>Docker installed</li><li>eksctl installed</li></ul><h3>Step 1: Setting Up Amazon EKS Cluster</h3><p>First, let’s create our EKS cluster using eksctl:</p><pre># cluster-config.yaml<br>apiVersion: eksctl.io/v1alpha5<br>kind: ClusterConfig<br><br>metadata:<br>  name: nats-microservices-cluster<br>  region: us-east-1<br>  version: &quot;1.28&quot;<br><br>managedNodeGroups:<br>  - name: primary-nodegroup<br>    instanceType: t3.medium<br>    desiredCapacity: 3<br>    minSize: 2<br>    maxSize: 4<br>    volumeSize: 50<br>    ssh:<br>      allow: false<br>    labels:<br>      role: worker<br>    tags:<br>      Environment: production<br>      Application: nats-microservices<br><br>iam:<br>  withOIDC: true</pre><p>Create the cluster:</p><pre>eksctl create cluster -f cluster-config.yaml</pre><p>This process takes approximately 15–20 minutes. Verify the cluster is ready:</p><pre>kubectl get nodes</pre><h3>Step 2: Installing NATS with Helm</h3><p>Add the NATS Helm repository and install NATS with JetStream enabled:</p><pre>helm repo add nats https://nats-io.github.io/k8s/helm/charts/<br>helm repo update<br><br>helm install nats nats/nats \<br>  --namespace nats \<br>  --create-namespace \<br>  --set config.jetstream.enabled=true \<br>  --set config.jetstream.memStorage.enabled=true \<br>  --set config.jetstream.memStorage.size=2Gi \<br>  --set config.jetstream.fileStorage.enabled=true \<br>  --set config.jetstream.fileStorage.size=10Gi \<br>  --set natsBox.enabled=true</pre><p>Verify NATS is running:</p><pre>kubectl get pods -n nats</pre><h3>Step 3: Building the Microservices</h3><h3>Order Service (Publisher)</h3><p>The Order Service exposes a REST API and publishes order events to NATS.</p><pre>// order-service/main.go<br>package main<br><br>import (<br>    &quot;encoding/json&quot;<br>    &quot;log&quot;<br>    &quot;net/http&quot;<br>    &quot;time&quot;<br><br>    &quot;github.com/google/uuid&quot;<br>    &quot;github.com/nats-io/nats.go&quot;<br>    &quot;github.com/gorilla/mux&quot;<br>)<br><br>type Order struct {<br>    ID          string    `json:&quot;id&quot;`<br>    CustomerID  string    `json:&quot;customer_id&quot;`<br>    ProductID   string    `json:&quot;product_id&quot;`<br>    Quantity    int       `json:&quot;quantity&quot;`<br>    Status      string    `json:&quot;status&quot;`<br>    CreatedAt   time.Time `json:&quot;created_at&quot;`<br>}<br><br>type OrderService struct {<br>    nc *nats.Conn<br>    js nats.JetStreamContext<br>}<br><br>func NewOrderService(natsURL string) (*OrderService, error) {<br>    nc, err := nats.Connect(natsURL)<br>    if err != nil {<br>        return nil, err<br>    }<br><br>    js, err := nc.JetStream()<br>    if err != nil {<br>        return nil, err<br>    }<br><br>    // Create stream if it doesn&#39;t exist<br>    js.AddStream(&amp;nats.StreamConfig{<br>        Name:     &quot;ORDERS&quot;,<br>        Subjects: []string{&quot;orders.*&quot;},<br>        Storage:  nats.FileStorage,<br>    })<br><br>    return &amp;OrderService{nc: nc, js: js}, nil<br>}<br><br>func (s *OrderService) CreateOrder(w http.ResponseWriter, r *http.Request) {<br>    var order Order<br>    if err := json.NewDecoder(r.Body).Decode(&amp;order); err != nil {<br>        http.Error(w, err.Error(), http.StatusBadRequest)<br>        return<br>    }<br><br>    order.ID = uuid.New().String()<br>    order.Status = &quot;pending&quot;<br>    order.CreatedAt = time.Now()<br><br>    // Publish to NATS<br>    orderJSON, _ := json.Marshal(order)<br>    _, err := s.js.Publish(&quot;orders.created&quot;, orderJSON)<br>    if err != nil {<br>        http.Error(w, &quot;Failed to publish order&quot;, http.StatusInternalServerError)<br>        return<br>    }<br><br>    log.Printf(&quot;Order created: %s&quot;, order.ID)<br>    w.Header().Set(&quot;Content-Type&quot;, &quot;application/json&quot;)<br>    json.NewEncoder(w).Encode(order)<br>}<br><br>func (s *OrderService) GetOrderStatus(w http.ResponseWriter, r *http.Request) {<br>    vars := mux.Vars(r)<br>    orderID := vars[&quot;id&quot;]<br><br>    // Request-Reply pattern to get order status<br>    msg, err := s.nc.Request(&quot;order.status.&quot;+orderID, nil, 2*time.Second)<br>    if err != nil {<br>        http.Error(w, &quot;Order not found&quot;, http.StatusNotFound)<br>        return<br>    }<br><br>    w.Header().Set(&quot;Content-Type&quot;, &quot;application/json&quot;)<br>    w.Write(msg.Data)<br>}<br><br>func main() {<br>    natsURL := &quot;nats://nats.nats.svc.cluster.local:4222&quot;<br>    service, err := NewOrderService(natsURL)<br>    if err != nil {<br>        log.Fatal(err)<br>    }<br>    defer service.nc.Close()<br><br>    router := mux.NewRouter()<br>    router.HandleFunc(&quot;/orders&quot;, service.CreateOrder).Methods(&quot;POST&quot;)<br>    router.HandleFunc(&quot;/orders/{id}&quot;, service.GetOrderStatus).Methods(&quot;GET&quot;)<br><br>    log.Println(&quot;Order Service starting on :8080&quot;)<br>    log.Fatal(http.ListenAndServe(&quot;:8080&quot;, router))<br>}</pre><h3>Inventory Service (Subscriber)</h3><p>The Inventory Service subscribes to order events and manages inventory.</p><pre>// inventory-service/main.go<br>package main<br><br>import (<br>    &quot;encoding/json&quot;<br>    &quot;log&quot;<br>    &quot;sync&quot;<br>    &quot;time&quot;<br><br>    &quot;github.com/nats-io/nats.go&quot;<br>)<br><br>type Order struct {<br>    ID         string    `json:&quot;id&quot;`<br>    CustomerID string    `json:&quot;customer_id&quot;`<br>    ProductID  string    `json:&quot;product_id&quot;`<br>    Quantity   int       `json:&quot;quantity&quot;`<br>    Status     string    `json:&quot;status&quot;`<br>    CreatedAt  time.Time `json:&quot;created_at&quot;`<br>}<br><br>type InventoryService struct {<br>    nc        *nats.Conn<br>    js        nats.JetStreamContext<br>    inventory map[string]int<br>    orders    map[string]Order<br>    mu        sync.RWMutex<br>}<br><br>func NewInventoryService(natsURL string) (*InventoryService, error) {<br>    nc, err := nats.Connect(natsURL)<br>    if err != nil {<br>        return nil, err<br>    }<br><br>    js, err := nc.JetStream()<br>    if err != nil {<br>        return nil, err<br>    }<br><br>    service := &amp;InventoryService{<br>        nc: nc,<br>        js: js,<br>        inventory: map[string]int{<br>            &quot;product-1&quot;: 100,<br>            &quot;product-2&quot;: 50,<br>            &quot;product-3&quot;: 75,<br>        },<br>        orders: make(map[string]Order),<br>    }<br><br>    return service, nil<br>}<br><br>func (s *InventoryService) ProcessOrder(msg *nats.Msg) {<br>    var order Order<br>    if err := json.Unmarshal(msg.Data, &amp;order); err != nil {<br>        log.Printf(&quot;Error unmarshaling order: %v&quot;, err)<br>        msg.Nak()<br>        return<br>    }<br><br>    s.mu.Lock()<br>    currentStock := s.inventory[order.ProductID]<br>    <br>    if currentStock &gt;= order.Quantity {<br>        s.inventory[order.ProductID] -= order.Quantity<br>        order.Status = &quot;confirmed&quot;<br>        log.Printf(&quot;Order %s confirmed. Product %s stock: %d&quot;, <br>            order.ID, order.ProductID, s.inventory[order.ProductID])<br>    } else {<br>        order.Status = &quot;rejected&quot;<br>        log.Printf(&quot;Order %s rejected. Insufficient stock for %s&quot;, <br>            order.ID, order.ProductID)<br>    }<br>    <br>    // Store order for status queries<br>    s.orders[order.ID] = order<br>    s.mu.Unlock()<br><br>    // Publish updated order status<br>    updatedOrder, _ := json.Marshal(order)<br>    s.js.Publish(&quot;orders.updated&quot;, updatedOrder)<br>    <br>    msg.Ack()<br>}<br><br>func (s *InventoryService) HandleStatusRequest(msg *nats.Msg) {<br>    // Extract order ID from subject (order.status.ORDER_ID)<br>    subject := msg.Subject<br>    orderID := subject[len(&quot;order.status.&quot;):]<br>    <br>    s.mu.RLock()<br>    order, exists := s.orders[orderID]<br>    s.mu.RUnlock()<br>    <br>    if !exists {<br>        msg.Respond([]byte(`{&quot;error&quot;: &quot;order not found&quot;}`))<br>        return<br>    }<br>    <br>    responseJSON, _ := json.Marshal(order)<br>    msg.Respond(responseJSON)<br>}<br><br>func (s *InventoryService) Start() error {<br>    // Subscribe with queue group for load balancing across replicas<br>    _, err := s.js.QueueSubscribe(<br>        &quot;orders.created&quot;,<br>        &quot;inventory-workers&quot;, // Queue group name<br>        s.ProcessOrder,<br>        nats.Durable(&quot;inventory-service&quot;),<br>        nats.ManualAck(),<br>    )<br>    if err != nil {<br>        return err<br>    }<br><br>    // Subscribe to status requests (all replicas respond)<br>    _, err = s.nc.Subscribe(&quot;order.status.*&quot;, s.HandleStatusRequest)<br>    if err != nil {<br>        return err<br>    }<br><br>    log.Println(&quot;Inventory Service started and listening...&quot;)<br>    return nil<br>}<br><br>func main() {<br>    natsURL := &quot;nats://nats.nats.svc.cluster.local:4222&quot;<br>    service, err := NewInventoryService(natsURL)<br>    if err != nil {<br>        log.Fatal(err)<br>    }<br>    defer service.nc.Close()<br><br>    if err := service.Start(); err != nil {<br>        log.Fatal(err)<br>    }<br><br>    select {} // Keep running<br>}</pre><h3>Notification Service (Subscriber)</h3><pre>// notification-service/main.go<br>package main<br><br>import (<br>    &quot;encoding/json&quot;<br>    &quot;log&quot;<br>    &quot;time&quot;<br><br>    &quot;github.com/nats-io/nats.go&quot;<br>)<br><br>type Order struct {<br>    ID         string    `json:&quot;id&quot;`<br>    CustomerID string    `json:&quot;customer_id&quot;`<br>    ProductID  string    `json:&quot;product_id&quot;`<br>    Quantity   int       `json:&quot;quantity&quot;`<br>    Status     string    `json:&quot;status&quot;`<br>    CreatedAt  time.Time `json:&quot;created_at&quot;`<br>}<br><br>type NotificationService struct {<br>    nc *nats.Conn<br>    js nats.JetStreamContext<br>}<br><br>func NewNotificationService(natsURL string) (*NotificationService, error) {<br>    nc, err := nats.Connect(natsURL)<br>    if err != nil {<br>        return nil, err<br>    }<br><br>    js, err := nc.JetStream()<br>    if err != nil {<br>        return nil, err<br>    }<br><br>    return &amp;NotificationService{nc: nc, js: js}, nil<br>}<br><br>func (s *NotificationService) SendNotification(msg *nats.Msg) {<br>    var order Order<br>    if err := json.Unmarshal(msg.Data, &amp;order); err != nil {<br>        log.Printf(&quot;Error unmarshaling order: %v&quot;, err)<br>        msg.Nak()<br>        return<br>    }<br><br>    // Simulate sending notification<br>    log.Printf(&quot;📧 Sending notification to customer %s: Order %s is %s&quot;, <br>        order.CustomerID, order.ID, order.Status)<br>    <br>    // In a real system, this would integrate with email/SMS services<br>    time.Sleep(100 * time.Millisecond)<br>    <br>    msg.Ack()<br>}<br><br>func (s *NotificationService) Start() error {<br>    // Subscribe with queue group for load balancing across replicas<br>    _, err := s.js.QueueSubscribe(<br>        &quot;orders.*&quot;,<br>        &quot;notification-workers&quot;, // Queue group name<br>        s.SendNotification,<br>        nats.Durable(&quot;notification-service&quot;),<br>        nats.ManualAck(),<br>    )<br>    if err != nil {<br>        return err<br>    }<br><br>    log.Println(&quot;Notification Service started and listening...&quot;)<br>    return nil<br>}<br><br>func main() {<br>    natsURL := &quot;nats://nats.nats.svc.cluster.local:4222&quot;<br>    service, err := NewNotificationService(natsURL)<br>    if err != nil {<br>        log.Fatal(err)<br>    }<br>    defer service.nc.Close()<br><br>    if err := service.Start(); err != nil {<br>        log.Fatal(err)<br>    }<br><br>    select {} // Keep running<br>}</pre><h3>Step 4: Dockerfiles and Kubernetes Manifests</h3><h3>Dockerfile (similar for all services)</h3><pre>FROM golang:1.21-alpine AS builder<br>WORKDIR /app<br>COPY go.mod go.sum ./<br>RUN go mod download<br>COPY . .<br>RUN CGO_ENABLED=0 GOOS=linux go build -o service .<br><br>FROM alpine:latest<br>RUN apk --no-cache add ca-certificates<br>WORKDIR /root/<br>COPY --from=builder /app/service .<br>EXPOSE 8080<br>CMD [&quot;./service&quot;]</pre><h3>Kubernetes Deployment for Order Service</h3><pre># k8s/order-service-deployment.yaml<br>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: order-service<br>  namespace: default<br>spec:<br>  replicas: 2<br>  selector:<br>    matchLabels:<br>      app: order-service<br>  template:<br>    metadata:<br>      labels:<br>        app: order-service<br>    spec:<br>      containers:<br>      - name: order-service<br>        image: your-registry/order-service:latest<br>        ports:<br>        - containerPort: 8080<br>        env:<br>        - name: NATS_URL<br>          value: &quot;nats://nats.nats.svc.cluster.local:4222&quot;<br>        resources:<br>          requests:<br>            memory: &quot;128Mi&quot;<br>            cpu: &quot;100m&quot;<br>          limits:<br>            memory: &quot;256Mi&quot;<br>            cpu: &quot;200m&quot;<br>---<br>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: order-service<br>  namespace: default<br>spec:<br>  selector:<br>    app: order-service<br>  ports:<br>  - protocol: TCP<br>    port: 80<br>    targetPort: 8080<br>  type: ClusterIP</pre><h3>Kubernetes Deployment for Inventory Service</h3><pre># k8s/inventory-service-deployment.yaml<br>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: inventory-service<br>  namespace: default<br>spec:<br>  replicas: 2<br>  selector:<br>    matchLabels:<br>      app: inventory-service<br>  template:<br>    metadata:<br>      labels:<br>        app: inventory-service<br>    spec:<br>      containers:<br>      - name: inventory-service<br>        image: your-registry/inventory-service:latest<br>        env:<br>        - name: NATS_URL<br>          value: &quot;nats://nats.nats.svc.cluster.local:4222&quot;<br>        resources:<br>          requests:<br>            memory: &quot;128Mi&quot;<br>            cpu: &quot;100m&quot;<br>          limits:<br>            memory: &quot;256Mi&quot;<br>            cpu: &quot;200m&quot;</pre><h3>Kubernetes Deployment for Notification Service</h3><pre># k8s/notification-service-deployment.yaml<br>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: notification-service<br>  namespace: default<br>spec:<br>  replicas: 2<br>  selector:<br>    matchLabels:<br>      app: notification-service<br>  template:<br>    metadata:<br>      labels:<br>        app: notification-service<br>    spec:<br>      containers:<br>      - name: notification-service<br>        image: your-registry/notification-service:latest<br>        env:<br>        - name: NATS_URL<br>          value: &quot;nats://nats.nats.svc.cluster.local:4222&quot;<br>        resources:<br>          requests:<br>            memory: &quot;128Mi&quot;<br>            cpu: &quot;100m&quot;<br>          limits:<br>            memory: &quot;256Mi&quot;<br>            cpu: &quot;200m&quot;</pre><h3>Ingress Configuration</h3><pre># k8s/ingress.yaml<br>apiVersion: networking.k8s.io/v1<br>kind: Ingress<br>metadata:<br>  name: api-ingress<br>  namespace: default<br>  annotations:<br>    kubernetes.io/ingress.class: alb<br>    alb.ingress.kubernetes.io/scheme: internet-facing<br>    alb.ingress.kubernetes.io/target-type: ip<br>spec:<br>  rules:<br>  - http:<br>      paths:<br>      - path: /orders<br>        pathType: Prefix<br>        backend:<br>          service:<br>            name: order-service<br>            port:<br>              number: 80</pre><h3>Step 5: Deployment Script</h3><p>bash</p><pre>#!/bin/bash<br># deploy.sh<br><br># Build and push Docker images<br>docker build -t your-registry/order-service:latest ./order-service<br>docker build -t your-registry/inventory-service:latest ./inventory-service<br>docker build -t your-registry/notification-service:latest ./notification-service<br><br>docker push your-registry/order-service:latest<br>docker push your-registry/inventory-service:latest<br>docker push your-registry/notification-service:latest<br><br># Apply Kubernetes manifests<br>kubectl apply -f k8s/order-service-deployment.yaml<br>kubectl apply -f k8s/inventory-service-deployment.yaml<br>kubectl apply -f k8s/notification-service-deployment.yaml<br>kubectl apply -f k8s/ingress.yaml<br><br># Wait for deployments<br>kubectl rollout status deployment/order-service<br>kubectl rollout status deployment/inventory-service<br>kubectl rollout status deployment/notification-service<br><br>echo &quot;Deployment complete!&quot;</pre><h3>Step 6: Testing the System</h3><h4>Create an Order</h4><pre>curl -X POST http://&lt;ingress-url&gt;/orders \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{<br>    &quot;customer_id&quot;: &quot;customer-123&quot;,<br>    &quot;product_id&quot;: &quot;product-1&quot;,<br>    &quot;quantity&quot;: 5<br>  }&#39;</pre><h3>Check Order Status</h3><pre>curl http://&lt;ingress-url&gt;/orders/{order-id}</pre><pre># Access NATS box<br>kubectl exec -n nats -it deployment/nats-box -- /bin/sh<br><br># Subscribe to all order events<br>nats sub &quot;orders.*&quot;<br><br># Check JetStream status<br>nats stream ls<br>nats stream info ORDERS</pre><h3>Monitoring and Observability</h3><h4>Install Prometheus and Grafana</h4><pre>helm repo add prometheus-community https://prometheus-community.github.io/helm-charts<br>helm install prometheus prometheus-community/kube-prometheus-stack \<br>  --namespace monitoring \<br>  --create-namespace</pre><p>NATS exports Prometheus metrics by default on port 7777.</p><h3>Key Benefits of This Architecture</h3><ol><li><strong>Decoupling</strong>: Services communicate through NATS without direct dependencies</li><li><strong>Scalability</strong>: Each service can scale independently based on load</li><li><strong>Resilience</strong>: JetStream ensures message persistence and at-least-once delivery</li><li><strong>Performance</strong>: NATS provides microsecond latency for message delivery</li><li><strong>Cloud-Native</strong>: Fully containerized and orchestrated on Kubernetes</li></ol><h3>Cleanup</h3><pre># Delete services<br>kubectl delete -f k8s/<br><br># Delete NATS<br>helm uninstall nats -n nats<br><br># Delete EKS cluster<br>eksctl delete cluster --name nats-microservices-cluster</pre><h3>Conclusion</h3><p>We’ve built a production-ready microservices platform using NATS on Amazon EKS, demonstrating pub-sub patterns, request-reply messaging, and persistent streams with JetStream. This architecture provides a solid foundation for building scalable, event-driven applications in the cloud.</p><p>The combination of NATS and Kubernetes offers several advantages: low latency message delivery, automatic failover, horizontal scalability, and seamless integration with cloud-native tools. Whether you’re building a simple event bus or a complex distributed system, NATS on EKS provides the reliability and performance you need.</p><h3>A message from our Founder</h3><p><strong>Hey, </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>Sunil</strong></a><strong> here.</strong> I wanted to take a moment to thank you for reading until the end and for being a part of this community.</p><p>Did you know that our team run these publications as a volunteer effort to over 3.5m monthly readers? <strong>We don’t receive any funding, we do this to support the community. ❤️</strong></p><p>If you want to show some love, please take a moment to <strong>follow me on </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>LinkedIn</strong></a><strong>, </strong><a href="https://tiktok.com/@messyfounder"><strong>TikTok</strong></a>, <a href="https://instagram.com/sunilsandhu"><strong>Instagram</strong></a>. You can also subscribe to our <a href="https://newsletter.plainenglish.io/"><strong>weekly newsletter</strong></a>.</p><p>And before you go, don’t forget to <strong>clap</strong> and <strong>follow</strong> the writer️!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43e3790218e7" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/building-a-scalable-microservices-platform-with-nats-on-aws-eks-43e3790218e7">Building a Scalable Microservices Platform with NATS on Amazon EKS</a> was originally published in <a href="https://aws.plainenglish.io/">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Production-Grade Strands Agents on Amazon EKS with KEDA (TriggerAuthentication, IRSA…]]></title>
            <link>https://aws.plainenglish.io/building-production-grade-strands-agents-on-amazon-eks-with-keda-triggerauthentication-irsa-0eac5c0e40d9?source=rss-de084af3616f------2</link>
            <guid isPermaLink="false">https://medium.com/p/0eac5c0e40d9</guid>
            <category><![CDATA[amazon-eks]]></category>
            <category><![CDATA[strand-agents]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Sayan Moitra]]></dc:creator>
            <pubDate>Mon, 08 Sep 2025 00:20:11 GMT</pubDate>
            <atom:updated>2025-09-08T05:38:14.948Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building Production-Grade Strands Agents on Amazon EKS with KEDA (TriggerAuthentication, IRSA, Multi-Trigger Autoscaling)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*hu7uSLMBl86eYc4I1lgVpQ.jpeg" /><figcaption>Strands Agents on Amazon EKS</figcaption></figure><p><strong>Goal:</strong> Deploy a Strand Agent system to <strong>Amazon EKS</strong> that scales <strong>pods and jobs dynamically</strong> using <strong>KEDA</strong>. We’ll combine:</p><ul><li><strong>HTTP Agents</strong> (FastAPI) for request/response.</li><li><strong>Workers</strong> for background tasks, scaled by <strong>SQS queue depth</strong>.</li><li><strong>KEDA ScaledObjects</strong> with <strong>TriggerAuthentication</strong> using <strong>IRSA</strong> (no static keys).</li><li><strong>Prometheus</strong>-based scaling on <strong>tokens/sec</strong> (a business KPI).</li><li>Solid <strong>security</strong> (NetworkPolicies, Secrets Manager CSI), <strong>resilience</strong> (PDB), and <strong>observability</strong> (Fluent Bit → CloudWatch).</li></ul><p><strong><em>Assumptions: You have basic EKS up (with OIDC), an ECR repo, AWS CLI, </em></strong><strong><em>eksctl, </em></strong><strong><em>kubectl, </em></strong><strong><em>helm, and admin access.</em></strong></p><h3>1) Create / update the EKS cluster (OIDC + IRSA ready)</h3><pre>eksctl create cluster \<br>  --name strand-agents-keda \<br>  --region us-east-1 \<br>  --with-oidc \<br>  --managed \<br>  --nodes 3 \<br>  --node-type t3.xlarge</pre><p>Confirm IRSA is enabled:</p><pre>eksctl utils associate-iam-oidc-provider \<br>  --region us-east-1 \<br>  --cluster strand-agents-keda \<br>  --approve</pre><h3>2) Install KEDA (Helm) and Metrics Pipeline</h3><pre>helm repo add kedacore https://kedacore.github.io/charts<br>helm repo update</pre><pre>helm upgrade --install keda kedacore/keda \<br>  --namespace keda --create-namespace \<br>  --set metricsServer.enabled=true</pre><p><em>We’ll also install Prometheus (any distro works — Prometheus Operator, AMP with Prometheus remote-write, etc.). For a quick lab:</em></p><pre>helm repo add prometheus-community https://prometheus-community.github.io/helm-charts<br>helm upgrade --install kube-prom prometheus-community/kube-prometheus-stack \<br>  --namespace monitoring --create-namespace</pre><h3>3) Build the Strand Agent services</h3><h3>3.1 App layout</h3><pre>/agent-app<br>  ├── requirements.txt<br>  ├── main.py            # FastAPI + Strand “web agent”<br>  ├── worker.py          # SQS worker (background agent)<br>  └── Dockerfile</pre><p><strong>requirements.txt</strong></p><pre>fastapi==0.110.0<br>uvicorn[standard]==0.30.0<br>strands==0.1.6<br>strands-agents-tools==0.1.5<br>langchain==0.2.1<br>langchain-openai==0.1.7<br>boto3==1.34.120<br>prometheus-client==0.20.0</pre><p><strong>main.py</strong> (HTTP “web agent” exporting Prometheus metrics)</p><pre>import os, time<br>from fastapi import FastAPI<br>from strands import Agent<br>from langchain_openai import ChatOpenAI<br>from prometheus_client import Counter, start_http_server<br>import boto3<br><br># Prometheus metric (tokens processed per second proxy via count)<br>TOKENS = Counter(&quot;tokens_processed_total&quot;, &quot;Total tokens processed&quot;)<br>app = FastAPI()<br># Optional: DynamoDB-backed memory (simple example)<br>TABLE = os.getenv(&quot;AGENT_MEMORY_TABLE&quot;, &quot;StrandAgentMemory&quot;)<br>REGION = os.getenv(&quot;AWS_REGION&quot;, &quot;us-east-1&quot;)<br>dynamodb = boto3.resource(&quot;dynamodb&quot;, region_name=REGION)<br>table = dynamodb.Table(TABLE)<br>def memory_backend(key, val=None):<br>    if val is None:<br>        resp = table.get_item(Key={&quot;id&quot;: key})<br>        return resp.get(&quot;Item&quot;, {}).get(&quot;state&quot;)<br>    table.put_item(Item={&quot;id&quot;: key, &quot;state&quot;: val})<br>agent = Agent(<br>    llm=ChatOpenAI(model=&quot;gpt-4o&quot;),<br>    tools=[],<br>    memory_backend=memory_backend,<br>)<br>@app.on_event(&quot;startup&quot;)<br>def _metrics():<br>    # Expose Prometheus metrics on a side port for scraping (e.g., 9091)<br>    start_http_server(9091)<br>@app.post(&quot;/query&quot;)<br>async def query(payload: dict):<br>    t0 = time.time()<br>    result = await agent.run(payload[&quot;message&quot;])<br>    # crude token estimate; replace with your tokenizer/LLM usage accounting<br>    tokens = max(1, len(result.split()) // 3)<br>    TOKENS.inc(tokens)<br>    return {&quot;response&quot;: result, &quot;latency_ms&quot;: int((time.time() - t0) * 1000)}</pre><p><strong>worker.py</strong> (SQS “background agent” for long tasks)</p><pre>import os, json, time<br>import boto3<br>from strands import Agent<br>from langchain_openai import ChatOpenAI<br><br>QUEUE_URL = os.environ[&quot;SQS_QUEUE_URL&quot;]<br>REGION = os.getenv(&quot;AWS_REGION&quot;, &quot;us-east-1&quot;)<br>POLL_SECONDS = int(os.getenv(&quot;POLL_SECONDS&quot;, &quot;10&quot;))<br>sqs = boto3.client(&quot;sqs&quot;, region_name=REGION)<br>agent = Agent(<br>    llm=ChatOpenAI(model=&quot;gpt-4o&quot;),<br>    tools=[],<br>)<br>def handle_message(body: dict):<br>    # do long-running work, write to S3/Dynamo, etc.<br>    prompt = body.get(&quot;prompt&quot;, &quot;Say hello&quot;)<br>    return agent.run(prompt)<br>if __name__ == &quot;__main__&quot;:<br>    while True:<br>        resp = sqs.receive_message(<br>            QueueUrl=QUEUE_URL, MaxNumberOfMessages=5, WaitTimeSeconds=10<br>        )<br>        for m in resp.get(&quot;Messages&quot;, []):<br>            try:<br>                out = handle_message(json.loads(m[&quot;Body&quot;]))<br>                print(&quot;RESULT:&quot;, out)<br>                sqs.delete_message(QueueUrl=QUEUE_URL, ReceiptHandle=m[&quot;ReceiptHandle&quot;])<br>            except Exception as e:<br>                print(&quot;ERR:&quot;, e)<br>        time.sleep(POLL_SECONDS)</pre><p><strong>Dockerfile</strong></p><pre>FROM python:3.11-slim<br>WORKDIR /app<br>COPY requirements.txt .<br>RUN pip install --no-cache-dir -r requirements.txt<br>COPY main.py worker.py ./<br># Default to web agent, override with CMD for worker<br>CMD [&quot;uvicorn&quot;, &quot;main:app&quot;, &quot;--host&quot;, &quot;0.0.0.0&quot;, &quot;--port&quot;, &quot;8000&quot;]</pre><p>Build &amp; push to ECR (replace &lt;acct&gt;, &lt;region&gt;, &lt;repo&gt;):</p><pre>aws ecr create-repository --repository-name strand-agent<br>aws ecr get-login-password --region us-east-1 \<br>| docker login --username AWS --password-stdin &lt;acct&gt;.dkr.ecr.us-east-1.amazonaws.com</pre><pre>docker build -t strand-agent:latest .<br>docker tag strand-agent:latest &lt;acct&gt;.dkr.ecr.us-east-1.amazonaws.com/strand-agent:latest<br>docker push &lt;acct&gt;.dkr.ecr.us-east-1.amazonaws.com/strand-agent:latest</pre><h3>4) AWS resources: SQS queue + DynamoDB table</h3><pre>aws sqs create-queue --queue-name strand-agent-jobs<br>aws dynamodb create-table \<br>  --table-name StrandAgentMemory \<br>  --attribute-definitions AttributeName=id,AttributeType=S \<br>  --key-schema AttributeName=id,KeyType=HASH \<br>  --billing-mode PAY_PER_REQUEST</pre><p>Grab the <strong>SQS Queue Url</strong> and note the region.</p><h3>5) IAM for IRSA (no static keys)</h3><p>Create IAM policy for SQS + DynamoDB access:</p><pre>cat &gt; iam-policy.json &lt;&lt;&#39;JSON&#39;<br>{<br>  &quot;Version&quot;:&quot;2012-10-17&quot;,<br>  &quot;Statement&quot;:[<br>    {&quot;Effect&quot;:&quot;Allow&quot;,&quot;Action&quot;:[&quot;sqs:ReceiveMessage&quot;,&quot;sqs:DeleteMessage&quot;,&quot;sqs:GetQueueAttributes&quot;,&quot;sqs:ChangeMessageVisibility&quot;],&quot;Resource&quot;:&quot;*&quot;},<br>    {&quot;Effect&quot;:&quot;Allow&quot;,&quot;Action&quot;:[&quot;dynamodb:GetItem&quot;,&quot;dynamodb:PutItem&quot;],&quot;Resource&quot;:&quot;*&quot;}<br>  ]<br>}<br>JSON</pre><pre>aws iam create-policy --policy-name StrandAgentsPolicy --policy-document file://iam-policy.json</pre><p>Create a ServiceAccount + IAM role (IRSA) for the agent namespace:</p><pre>kubectl create namespace agents</pre><pre>eksctl create iamserviceaccount \<br>  --name strand-agents-sa \<br>  --namespace agents \<br>  --cluster strand-agents-keda \<br>  --attach-policy-arn arn:aws:iam::&lt;acct&gt;:policy/StrandAgentsPolicy \<br>  --approve \<br>  --override-existing-serviceaccounts</pre><h3>6) Kubernetes Manifests (Deployments, Services, PDB, NetworkPolicy)</h3><p><strong><em>Secrets</em></strong><em>: we’ll source cloud API keys via </em><strong><em>AWS Secrets Manager CSI</em></strong><em> (or Kubernetes Secret). Below shows a K8s Secret for simplicity — swap to CSI in prod.</em></p><pre># agents/00-secret.yaml<br>apiVersion: v1<br>kind: Secret<br>metadata:<br>  name: agent-secrets<br>  namespace: agents<br>type: Opaque<br>stringData:<br>  OPENAI_API_KEY: &quot;replace-with-real&quot;</pre><pre># agents/10-deploy-web.yaml<br>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: strand-web<br>  namespace: agents<br>spec:<br>  replicas: 2<br>  selector:<br>    matchLabels: {app: strand-web}<br>  template:<br>    metadata:<br>      labels: {app: strand-web}<br>    spec:<br>      serviceAccountName: strand-agents-sa<br>      containers:<br>      - name: web<br>        image: &lt;acct&gt;.dkr.ecr.us-east-1.amazonaws.com/strand-agent:latest<br>        ports:<br>          - containerPort: 8000<br>          - containerPort: 9091   # Prometheus metrics<br>        env:<br>          - name: AWS_REGION<br>            value: &quot;us-east-1&quot;<br>          - name: AGENT_MEMORY_TABLE<br>            value: &quot;StrandAgentMemory&quot;<br>          - name: OPENAI_API_KEY<br>            valueFrom:<br>              secretKeyRef:<br>                name: agent-secrets<br>                key: OPENAI_API_KEY<br>        readinessProbe:<br>          httpGet: {path: /docs, port: 8000}<br>          initialDelaySeconds: 5<br>        livenessProbe:<br>          httpGet: {path: /docs, port: 8000}<br>          initialDelaySeconds: 10<br>---<br>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: strand-web-svc<br>  namespace: agents<br>spec:<br>  selector: {app: strand-web}<br>  ports:<br>    - name: http<br>      port: 80<br>      targetPort: 8000</pre><p><strong>PDB &amp; NetworkPolicy</strong></p><pre># agents/15-pdb-np.yaml<br>apiVersion: policy/v1<br>kind: PodDisruptionBudget<br>metadata:<br>  name: strand-web-pdb<br>  namespace: agents<br>spec:<br>  minAvailable: 1<br>  selector:<br>    matchLabels: {app: strand-web}<br>---<br>apiVersion: networking.k8s.io/v1<br>kind: NetworkPolicy<br>metadata:<br>  name: strand-web-egress<br>  namespace: agents<br>spec:<br>  podSelector:<br>    matchLabels: {app: strand-web}<br>  policyTypes: [&quot;Egress&quot;]<br>  egress:<br>    - to: # allow kube-dns<br>      - namespaceSelector: {matchLabels: {kubernetes.io/metadata.name: kube-system}}<br>      ports: [{port: 53, protocol: UDP}]<br>    - to: # allow AWS endpoints (example: 443 to anywhere—tighten with VPC endpoints/cidr)<br>      - ipBlock: {cidr: 0.0.0.0/0}<br>      ports: [{port: 443, protocol: TCP}]</pre><h3>7) KEDA TriggerAuthentication (IRSA) + Multi-Trigger ScaledObject</h3><p>We’ll scale the <strong>web deployment</strong> by:</p><ol><li><strong>Prometheus</strong> metric tokens_processed_total → rate to approximate tokens/sec.</li><li>Fallback <strong>CPU</strong> via KEDA’s cpu trigger.</li></ol><p><strong><em>KEDA</em></strong><em> supports multiple triggers; it scales when any trigger breaches.</em></p><p><strong>Prometheus ServiceMonitor</strong> (scrape port 9091)</p><pre># agents/20-servicemonitor.yaml<br>apiVersion: monitoring.coreos.com/v1<br>kind: ServiceMonitor<br>metadata:<br>  name: strand-web-sm<br>  namespace: monitoring<br>spec:<br>  selector:<br>    matchLabels: {app: strand-web}<br>  namespaceSelector:<br>    matchNames: [&quot;agents&quot;]<br>  endpoints:<br>    - port: http<br>      interval: 15s<br>      path: /metrics   # (prom-client default is /metrics; we bound to 9091)<br>      scheme: http<br>      targetPort: 9091</pre><p><strong>TriggerAuthentication</strong> for IRSA (no credentials needed):</p><pre># agents/30-trigger-auth.yaml<br>apiVersion: keda.sh/v1alpha1<br>kind: TriggerAuthentication<br>metadata:<br>  name: ta-irsa<br>  namespace: agents<br>spec:<br>  podIdentity:<br>    provider: aws-eks   # use IRSA on EKS</pre><p><strong>ScaledObject</strong> for the web deployment**</p><pre># agents/40-scaledobject-web.yaml<br>apiVersion: keda.sh/v1alpha1<br>kind: ScaledObject<br>metadata:<br>  name: strand-web-so<br>  namespace: agents<br>spec:<br>  scaleTargetRef:<br>    name: strand-web<br>  minReplicaCount: 2<br>  maxReplicaCount: 15<br>  cooldownPeriod: 120<br>  pollingInterval: 15<br>  triggers:<br>    - type: prometheus<br>      metadata:<br>        serverAddress: http://kube-prometheus-stack-prometheus.monitoring.svc:9090<br>        metricName: rate_tokens_processed<br>        query: |<br>          sum(rate(tokens_processed_total[1m]))<br>        threshold: &quot;50&quot;    # target sum rate (tokens/sec)<br>    - type: cpu<br>      metadata:<br>        type: Utilization<br>        value: &quot;70&quot;</pre><p><strong><em>Tip</em></strong><em>: Tune thresholds to match your workload. If you label agents by tenant or model, expose per-label metrics and shard ScaledObjects.</em></p><h3>8) KEDA ScaledJob for SQS-driven background workers</h3><p>We’ll have a separate <strong>image</strong> entrypoint for the worker:</p><pre># agents/50-job-worker.yaml<br>apiVersion: batch/v1<br>kind: Job<br>metadata:<br>  name: strand-worker-template   # not used directly; ScaledJob will template pods<br>  namespace: agents<br>spec:<br>  template:<br>    spec:<br>      serviceAccountName: strand-agents-sa<br>      restartPolicy: Never<br>      containers:<br>      - name: worker<br>        image: &lt;acct&gt;.dkr.ecr.us-east-1.amazonaws.com/strand-agent:latest<br>        command: [&quot;python&quot;, &quot;worker.py&quot;]<br>        env:<br>          - name: AWS_REGION<br>            value: &quot;us-east-1&quot;<br>          - name: SQS_QUEUE_URL<br>            value: &quot;https://sqs.us-east-1.amazonaws.com/&lt;acct&gt;/strand-agent-jobs&quot;<br>          - name: OPENAI_API_KEY<br>            valueFrom:<br>              secretKeyRef:<br>                name: agent-secrets<br>                key: OPENAI_API_KEY</pre><p><strong>ScaledJob</strong> with SQS trigger (IRSA via TriggerAuthentication)</p><pre># agents/60-scaledjob.yaml<br>apiVersion: keda.sh/v1alpha1<br>kind: ScaledJob<br>metadata:<br>  name: strand-worker-sj<br>  namespace: agents<br>spec:<br>  jobTargetRef:<br>    template:<br>      spec:<br>        serviceAccountName: strand-agents-sa<br>        restartPolicy: Never<br>        containers:<br>        - name: worker<br>          image: &lt;acct&gt;.dkr.ecr.us-east-1.amazonaws.com/strand-agent:latest<br>          command: [&quot;python&quot;, &quot;worker.py&quot;]<br>          env:<br>            - name: AWS_REGION<br>              value: &quot;us-east-1&quot;<br>            - name: SQS_QUEUE_URL<br>              value: &quot;https://sqs.us-east-1.amazonaws.com/&lt;acct&gt;/strand-agent-jobs&quot;<br>            - name: OPENAI_API_KEY<br>              valueFrom:<br>                secretKeyRef:<br>                  name: agent-secrets<br>                  key: OPENAI_API_KEY<br>  pollingInterval: 15<br>  successfulJobsHistoryLimit: 2<br>  failedJobsHistoryLimit: 2<br>  maxReplicaCount: 50              # upper bound for parallelism<br>  rolloutStrategy: gradual<br>  triggers:<br>    - type: aws-sqs-queue<br>      metadata:<br>        queueURL: &quot;https://sqs.us-east-1.amazonaws.com/&lt;acct&gt;/strand-agent-jobs&quot;<br>        queueLength: &quot;5&quot;          # each 5 msgs → 1 job<br>        awsRegion: &quot;us-east-1&quot;<br>      authenticationRef:<br>        name: ta-irsa</pre><p><em>Behind the scenes, KEDA will </em><strong><em>create Jobs</em></strong><em> as queue depth rises — each Job runs one or more messages to completion.</em></p><h3>9) Ingress (Nginx or ALB) and test</h3><p>Example <strong>Ingress</strong> (Nginx):</p><pre># agents/70-ingress.yaml<br>apiVersion: networking.k8s.io/v1<br>kind: Ingress<br>metadata:<br>  name: strand-web-ing<br>  namespace: agents<br>  annotations:<br>    kubernetes.io/ingress.class: nginx<br>spec:<br>  rules:<br>  - host: agents.example.com<br>    http:<br>      paths:<br>      - path: /<br>        pathType: Prefix<br>        backend:<br>          service:<br>            name: strand-web-svc<br>            port:<br>              number: 80</pre><p>Test:</p><pre>curl -X POST https://agents.example.com/query \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{&quot;message&quot;:&quot;Summarize the latest EKS autoscaling strategies&quot;}&#39;</pre><p>Queue a background job:</p><pre>aws sqs send-message \<br>  --queue-url https://sqs.us-east-1.amazonaws.com/&lt;acct&gt;/strand-agent-jobs \<br>  --message-body &#39;{&quot;prompt&quot;:&quot;Batch-process 1k rows and write analysis to S3&quot;}&#39;</pre><p>Watch KEDA scale:</p><pre>kubectl get hpa,scaledobject,scaledjob -A<br>kubectl get jobs -n agents<br>kubectl get pods -n agents -w</pre><h3>10) Observability (logs + metrics + alerts)</h3><ul><li><strong>Logs</strong>: Install CloudWatch/Fluent Bit add-on (or your stack) and add JSON logging to main.py/worker.py.</li><li><strong>Prometheus</strong>: Create alerts for low SLO (e.g., high latency, low tokens/sec per replica).</li><li><strong>CloudWatch Alarms</strong>: on SQS ApproximateNumberOfMessagesVisible to catch backlog breaches.</li></ul><h3>11) Security hardening checklist</h3><ul><li>Prefer <strong>AWS Secrets Manager + CSI driver</strong> over K8s Secrets for API keys.</li><li>Lock <strong>NetworkPolicies</strong> to only necessary egress (use <strong>VPC endpoints</strong> for AWS APIs).</li><li>Use <strong>separate namespaces &amp; IRSA roles per tenant</strong>; label pods with tenant: foo and deploy <strong>per-tenant ScaledObjects</strong>.</li><li>Define <strong>PodSecurity</strong> profiles / seccompProfile: RuntimeDefault and run as non-root.</li><li>Apply <strong>resource requests/limits</strong> per container for predictable HPA/KEDA behavior.</li></ul><h3>12) Bonus: Workload-aware node placement</h3><p>To keep costs down &amp; performance high:</p><ul><li>Label nodes by <strong>capability</strong> (e.g., workload=llm-cpu, workload=llm-gpu).</li><li>Add <strong>nodeSelector/affinity</strong> to the web/worker Deployments and ScaledJobs.</li><li>If you use <strong>Karpenter</strong>, define separate <strong>NodePools/Provisioners</strong> with requirements on workload label and set <strong>consolidation</strong> + <strong>zonal spread</strong> rules.</li></ul><p>Example pod spec addition:</p><pre>spec:<br>  affinity:<br>    nodeAffinity:<br>      requiredDuringSchedulingIgnoredDuringExecution:<br>        nodeSelectorTerms:<br>        - matchExpressions:<br>          - key: workload<br>            operator: In            <br>            values: [&quot;llm-cpu&quot;]</pre><h3>End-to-End Apply Order</h3><pre>kubectl apply -f agents/00-secret.yaml<br>kubectl apply -f agents/10-deploy-web.yaml<br>kubectl apply -f agents/15-pdb-np.yaml<br>kubectl apply -f agents/20-servicemonitor.yaml<br>kubectl apply -f agents/30-trigger-auth.yaml<br>kubectl apply -f agents/40-scaledobject-web.yaml<br>kubectl apply -f agents/50-job-worker.yaml<br>kubectl apply -f agents/60-scaledjob.yaml<br>kubectl apply -f agents/70-ingress.yaml</pre><h3>What we achieved</h3><ul><li><strong>Complex multi-trigger autoscaling</strong> with <strong>KEDA</strong>:</li><li>Web pods scale on <strong>Prometheus business metrics</strong> (tokens/sec) and <strong>CPU</strong>.</li><li>Background workers scale as <strong>ScaledJobs</strong> by <strong>SQS queue depth</strong>.</li><li><strong>Zero static AWS keys</strong> via <strong>IRSA + TriggerAuthentication</strong>.</li><li><strong>Production posture</strong>: PDB, NetworkPolicies, readiness/liveness probes, metrics, and secrets hygiene.</li><li><strong>Separation of concerns</strong>: low-latency HTTP agents vs. bursty background jobs.</li></ul><h3>Next Steps (ideas to push this further)</h3><ul><li><strong>Per-tenant ScaledObjects</strong> keyed by tenant label &amp; Prometheus queries using label_replace.</li><li><strong>GPU nodegroups</strong> for RAG or bigger models; run text-only on CPU pool.</li><li><strong>Async tool execution</strong> with result notifications via EventBridge + Webhooks.</li><li><strong>Canary rollouts</strong> (Argo Rollouts) to test new prompt templates/agents safely.</li><li><strong>Cost guardrails</strong>: alerts when replicas and tokens/sec cross budgets.</li></ul><h3>A message from our Founder</h3><p><strong>Hey, </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>Sunil</strong></a><strong> here.</strong> I wanted to take a moment to thank you for reading until the end and for being a part of this community.</p><p>Did you know that our team run these publications as a volunteer effort to over 3.5m monthly readers? <strong>We don’t receive any funding, we do this to support the community. ❤️</strong></p><p>If you want to show some love, please take a moment to <strong>follow me on </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>LinkedIn</strong></a><strong>, </strong><a href="https://tiktok.com/@messyfounder"><strong>TikTok</strong></a>, <a href="https://instagram.com/sunilsandhu"><strong>Instagram</strong></a>. You can also subscribe to our <a href="https://newsletter.plainenglish.io/"><strong>weekly newsletter</strong></a>.</p><p>And before you go, don’t forget to <strong>clap</strong> and <strong>follow</strong> the writer️!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0eac5c0e40d9" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/building-production-grade-strands-agents-on-amazon-eks-with-keda-triggerauthentication-irsa-0eac5c0e40d9">Building Production-Grade Strands Agents on Amazon EKS with KEDA (TriggerAuthentication, IRSA…</a> was originally published in <a href="https://aws.plainenglish.io/">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Cloud-Native API Gateway: Deploying Emissary Ingress on Amazon EKS]]></title>
            <link>https://aws.plainenglish.io/building-a-cloud-native-api-gateway-deploying-emissary-ingress-on-amazon-eks-6d27cf6eccc6?source=rss-de084af3616f------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d27cf6eccc6</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[emissary-ingress]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[amazon-eks]]></category>
            <dc:creator><![CDATA[Sayan Moitra]]></dc:creator>
            <pubDate>Thu, 07 Aug 2025 11:18:06 GMT</pubDate>
            <atom:updated>2025-08-08T01:08:36.979Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*8dy2EOmYEazi05sujTiiUg.jpeg" /><figcaption>Emissary Ingress on Amazon EKS</figcaption></figure><p>As modern applications move to microservices architectures, the need for robust API gateways becomes critical. In this comprehensive project guide, we’ll explore how to deploy Emissary Ingress on Amazon Elastic Kubernetes Service (EKS), creating a powerful, cloud-native ingress solution that can handle enterprise-grade traffic management.</p><h3>What is Emissary Ingress?</h3><p>Emissary Ingress is an open-source, Kubernetes-native API gateway built on the proven Envoy Proxy. Unlike traditional ingress controllers, Emissary is designed from the ground up to support multiple, independent teams that need to rapidly publish, monitor, and update services for end-users. It serves as both a Layer 7 load balancer and a Kubernetes Ingress controller, making it ideal for complex microservices environments.</p><h3>Key Benefits for Amazon EKS</h3><ul><li>Platform agnostic: Works seamlessly with any Kubernetes distribution, including managed EKS clusters</li><li>Envoy-based: Leverages the battle-tested Envoy proxy for high performance</li><li>Kubernetes-native: Uses Custom Resource Definitions (CRDs) for declarative configuration</li><li>Multi-team support: Built for organisations with multiple development teams</li></ul><h3>Project Overview</h3><p>In this project, we’ll create a complete Emissary Ingress deployment on Amazon EKS that includes:</p><ol><li>EKS cluster setup with proper security groups</li><li>Emissary Ingress installation using Helm</li><li>Sample application deployment</li><li>Load balancer configuration</li><li>Traffic routing with Mappings and Listeners</li><li>Testing and validation</li></ol><h3>Prerequisites</h3><p>Before starting, ensure you have:</p><ul><li>AWS CLI configured with appropriate permissions</li><li><strong><em>kubectl</em></strong> installed and configured</li><li><strong><em>eksctl</em></strong> or Terraform for EKS cluster management</li><li>Helm 3.x installed</li><li>A domain name (optional, for production setups)</li></ul><h3>Step 1: Setting Up the EKS Cluster</h3><p>First, let’s create our EKS cluster. For this project, we’ll use a standard configuration:</p><pre># Create EKS cluster<br>eksctl create cluster \<br>  --name emissary-demo \<br>  --region us-west-2 \<br>  --nodegroup-name worker-nodes \<br>  --node-type t3.medium \<br>  --nodes 3 \<br>  --nodes-min 1 \<br>  --nodes-max 4 \<br>  --managed</pre><p>Wait for the cluster to be created (typically 10–15 minutes), then verify connectivity:</p><pre>kubectl get nodes</pre><h3>Step 2: Installing Emissary Ingress</h3><p>We’ll use Helm for the installation, which is the recommended approach:</p><h3>Add the Helm Repository</h3><pre>helm repo add datawire https://app.getambassador.io<br>helm repo update</pre><h3>Create Namespace and Install CRDs</h3><pre>kubectl create namespace emissary<br>kubectl apply -f https://app.getambassador.io/yaml/emissary/3.9.1/emissary-crds.yaml</pre><h3>Wait for CRD Installation</h3><pre>kubectl wait --timeout=90s --for=condition=available deployment emissary-apiext -n emissary-system</pre><h3>Install Emissary Ingress</h3><pre>helm install emissary-ingress --namespace emissary datawire/emissary-ingress</pre><pre># Wait for deployment to be ready<br>kubectl -n emissary wait \<br>  --for condition=available \<br>  --timeout=90s deploy \<br>  -lapp.kubernetes.io/instance=emissary-ingress</pre><h3>Step 3: Deploying a Test Application</h3><p>Let’s deploy a simple demo application to test our ingress setup:</p><pre>kubectl apply -f &quot;https://anywhere.eks.amazonaws.com/manifests/hello-eks-a.yaml&quot;</pre><p>Verify the application is running:</p><pre>kubectl get pods -l app=hello-eks-a</pre><h3>Step 4: Configuring Emissary Listeners</h3><p>Listeners define what ports Emissary should listen on. Create HTTP and HTTPS listeners:</p><pre># listeners.yaml<br>---<br>apiVersion: getambassador.io/v3alpha1<br>kind: Listener<br>metadata:<br>  name: http-listener<br>  namespace: default<br>spec:<br>  port: 8080<br>  protocol: HTTP<br>  securityModel: XFP<br>  hostBinding:<br>    namespace:<br>      from: ALL<br>---<br>apiVersion: getambassador.io/v3alpha1<br>kind: Listener<br>metadata:<br>  name: https-listener<br>  namespace: default<br>spec:<br>  port: 8443<br>  protocol: HTTPS<br>  securityModel: XFP<br>  hostBinding:<br>    namespace:<br>      from: ALL</pre><p>Apply the listeners:</p><pre>kubectl apply -f listeners.yaml</pre><h3>Step 5: Creating Traffic Mappings</h3><p>Mappings tell Emissary how to route incoming requests. Create a mapping for our test application:</p><pre># mapping.yaml<br>---<br>apiVersion: getambassador.io/v3alpha1<br>kind: Mapping<br>metadata:<br>  name: hello-backend<br>  labels:<br>    examplehost: host<br>spec:<br>  prefix: /hello/<br>  service: hello-eks-a<br>  hostname: &quot;*&quot;</pre><p>Apply the mapping:</p><pre>kubectl apply -f mapping.yaml</pre><h3>Step 6: Exposing Emissary with AWS Load Balancer</h3><p>For Amazon EKS, we need to expose Emissary through an AWS Load Balancer. Create a service configuration:</p><pre># emissary-service.yaml<br>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: emissary-ingress<br>  namespace: emissary<br>  annotations:<br>    service.beta.kubernetes.io/aws-load-balancer-type: nlb<br>    service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: &#39;true&#39;<br>spec:<br>  type: LoadBalancer<br>  ports:<br>  - name: http<br>    port: 80<br>    targetPort: 8080<br>    protocol: TCP<br>  - name: https<br>    port: 443<br>    targetPort: 8443<br>    protocol: TCP<br>  selector:<br>    app.kubernetes.io/instance: emissary-ingress<br>    app.kubernetes.io/name: emissary-ingress</pre><p>Apply the service:</p><pre>kubectl apply -f emissary-service.yaml</pre><h3>Step 7: Testing the Configuration</h3><p>Get the load balancer endpoint:</p><pre>export EMISSARY_LB_ENDPOINT=$(kubectl get svc emissary-ingress -n emissary -o jsonpath=&#39;{.status.loadBalancer.ingress[0].hostname}&#39;)<br>echo &quot;Load Balancer Endpoint: $EMISSARY_LB_ENDPOINT&quot;</pre><p>Test the configuration:</p><pre>curl -Lk http://$EMISSARY_LB_ENDPOINT/hello/</pre><p>You should see the hello-eks-a application response, confirming that traffic is being routed correctly through Emissary Ingress.</p><h3>Advanced Configuration Options</h3><h3>HTTPS/TLS Configuration</h3><p>For production environments, you’ll want to configure TLS. Create a Host resource:</p><pre># host.yaml<br>---<br>apiVersion: getambassador.io/v3alpha1<br>kind: Host<br>metadata:<br>  name: example-host<br>  namespace: default<br>spec:<br>  hostname: your-domain.com<br>  acmeProvider:<br>    authority: https://acme-v02.api.letsencrypt.org/directory<br>    email: your-email@example.com</pre><h3>Rate Limiting and Security</h3><p>Emissary supports advanced features like rate limiting, authentication, and authorisation. Example rate limit configuration:</p><pre>---<br>apiVersion: getambassador.io/v3alpha1<br>kind: RateLimitService<br>metadata:<br>  name: basic-rate-limit<br>spec:<br>  service: &quot;ratelimit:5000&quot;</pre><h3>Monitoring Integration</h3><p>Emissary integrates well with Prometheus and Grafana for monitoring. The ingress controller exposes metrics that can be scraped by Prometheus using ServiceMonitor resources.</p><h3>Production Considerations</h3><h3>Security Groups</h3><p>Ensure your EKS cluster’s security groups allow traffic on ports 80 and 443:</p><pre># Get cluster security group<br>CLUSTER_SG=$(aws eks describe-cluster --name emissary-demo --query &#39;cluster.resourcesVpcConfig.clusterSecurityGroupId&#39; --output text)</pre><pre># Allow HTTP traffic<br>aws ec2 authorize-security-group-ingress \<br>  --group-id $CLUSTER_SG \<br>  --protocol tcp \<br>  --port 80 \<br>  --cidr 0.0.0.0/0<br><br># Allow HTTPS traffic<br>aws ec2 authorize-security-group-ingress \<br>  --group-id $CLUSTER_SG \<br>  --protocol tcp \<br>  --port 443 \<br>  --cidr 0.0.0.0/0</pre><h3>High Availability</h3><p>For production deployments, consider:</p><ul><li>Multiple availability zones</li><li>Horizontal Pod Autoscaling for Emissary pods</li><li>Network Load Balancer with cross-zone load balancing</li><li>Proper resource requests and limits</li></ul><h3>Certificate Management</h3><p>The emissary-apiext service has a known limitation where its TLS certificate expires after one year. Set up monitoring and automated renewal:bash</p><pre># Manual certificate renewal when needed<br>kubectl delete --all secrets --namespace=emissary-system<br>kubectl rollout restart deploy/emissary-apiext -n emissary-system</pre><h3>Troubleshooting Common Issues</h3><h4>Pod Status Issues</h4><p>Check pod status and logs:</p><pre>kubectl get pods -n emissary<br>kubectl logs -n emissary deployment/emissary-ingress</pre><h4>Load Balancer Not Working</h4><p>Verify AWS Load Balancer Controller is installed and service annotations are correct.</p><h4>Routing Issues</h4><p>Check Listener and Mapping configurations:</p><pre>kubectl get listeners<br>kubectl get mappings<br>kubectl describe mapping hello-backend</pre><h3>Conclusion</h3><p>Emissary Ingress provides a robust, enterprise-ready API gateway solution for Amazon EKS environments. Its Kubernetes-native approach, combined with the power of Envoy Proxy, makes it an excellent choice for organisations running microservices at scale.</p><p>The flexibility and extensibility of Emissary Ingress enable advanced traffic management and policy enforcement, while its declarative configuration model fits naturally into GitOps workflows. Whether you’re exposing simple web applications or building complex API aggregation patterns, Emissary Ingress on EKS provides the foundation for reliable, scalable ingress management.</p><p>This project demonstrates the core concepts needed to get started with Emissary Ingress on Amazon EKS. From here, you can explore advanced features like authentication, rate limiting, and observability to build a production-ready API gateway that meets your organisation’s specific requirements.</p><h3>A message from our Founder</h3><p><strong>Hey, </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>Sunil</strong></a><strong> here.</strong> I wanted to take a moment to thank you for reading until the end and for being a part of this community.</p><p>Did you know that our team run these publications as a volunteer effort to over 200k supporters? <strong>We do not get paid by Medium</strong>!</p><p>If you want to show some love, please take a moment to <strong>follow me on </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>LinkedIn</strong></a><strong>, </strong><a href="https://tiktok.com/@messyfounder"><strong>TikTok</strong></a><strong> and </strong><a href="https://instagram.com/sunilsandhu"><strong>Instagram</strong></a>. And before you go, don’t forget to <strong>clap</strong> and <strong>follow</strong> the writer️!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d27cf6eccc6" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/building-a-cloud-native-api-gateway-deploying-emissary-ingress-on-amazon-eks-6d27cf6eccc6">Building a Cloud-Native API Gateway: Deploying Emissary Ingress on Amazon EKS</a> was originally published in <a href="https://aws.plainenglish.io/">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Detecting Fraudulent Transactions in Real Time using Amazon Bedrock and EKS]]></title>
            <link>https://aws.plainenglish.io/detecting-fraudulent-transactions-in-real-time-using-amazon-bedrock-and-eks-254c312130ea?source=rss-de084af3616f------2</link>
            <guid isPermaLink="false">https://medium.com/p/254c312130ea</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[elastic-container-service]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[generative-ai-use-cases]]></category>
            <dc:creator><![CDATA[Sayan Moitra]]></dc:creator>
            <pubDate>Fri, 20 Jun 2025 08:47:51 GMT</pubDate>
            <atom:updated>2025-06-23T00:11:08.576Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How to build a GenAI-powered fraud detection app on Kubernetes with Amazon Bedrock</em></p><h3>Introduction</h3><p>Fraud detection is a cornerstone of modern fintech applications. Traditional rule-based systems often struggle to keep pace with evolving fraud patterns. In this post, we’ll demonstrate how to deploy a GenAI-powered fraud detection service on Amazon EKS that leverages Amazon Bedrock’s foundation models (like Claude) to analyze transactions in real time.</p><p>We’ll walk through:</p><ul><li>Designing the architecture</li><li>Building a Spring Boot service</li><li>Integrating with Amazon Bedrock using the Java SDK</li><li>Deploying on Amazon EKS</li><li>Writing unit tests for confidence</li></ul><h3>Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ztddOQIRrTeTPhZevFJpBA.jpeg" /></figure><h3>Stack Used</h3><ul><li>Amazon EKS</li><li>Amazon Bedrock</li><li>Spring Boot</li><li>AWS SDK v2 for Java</li><li>Docker &amp; Kubernetes</li><li>Amazon SNS (for alerting)</li><li>Amazon S3 (for logging)</li></ul><h3>Use Case</h3><p>We’ll simulate a credit card transaction analysis API. Transactions with unusual characteristics (high amount, suspicious merchant, foreign location) will be sent to Bedrock for evaluation.</p><h3>Backend Code</h3><blockquote><strong>Transaction.java</strong></blockquote><pre>@Data<br>@AllArgsConstructor<br>@NoArgsConstructor<br>public class Transaction {<br>    private String userId;<br>    private double amount;<br>    private String location;<br>    private String merchant;<br>}</pre><blockquote>FraudDetectorController.java</blockquote><pre>@RestController<br>@RequestMapping(&quot;/api/transactions&quot;)<br>@RequiredArgsConstructor<br>public class FraudDetectorController {<br><br>    private final BedrockService bedrockService;<br><br>    @PostMapping<br>    public ResponseEntity&lt;String&gt; detect(@RequestBody Transaction txn) {<br>        String verdict = bedrockService.evaluateTransaction(txn);<br>        return ResponseEntity.ok(verdict);<br>    }<br>}</pre><blockquote>BedrockService.java</blockquote><pre>@Service<br>@RequiredArgsConstructor<br>public class BedrockService {<br><br>    private final BedrockRuntimeClient client;<br>    private final SnsClient snsClient;<br>    private final S3Client s3Client;<br>     <br>    @Value(&quot;${SNS_TOPIC_ARN}&quot;)<br>    private String snsTopicArn;<br><br>    public String evaluateTransaction(Transaction txn) {<br>        String prompt = String.format(&quot;&quot;&quot;<br>            You are a fraud detection engine. Answer with &#39;Fraud&#39; or &#39;Legit&#39;.<br><br>            Q: user:1234, $500 at Walmart in NY ➔ Legit<br>            Q: user:5678, $9000 at CryptoVendor in Nigeria ➔ Fraud<br>            Q: %s ➔<br>        &quot;&quot;&quot;, formatTxn(txn));<br><br>        InvokeModelRequest request = InvokeModelRequest.builder()<br>            .body(SdkBytes.fromUtf8String(&quot;{&quot;prompt&quot;:&quot;&quot; + prompt + &quot;&quot;,&quot;max_tokens&quot;:10}&quot;))<br>            .modelId(&quot;anthropic.claude-3-sonnet-20240229-v1:0&quot;)<br>            .contentType(&quot;application/json&quot;)<br>            .accept(&quot;application/json&quot;)<br>            .build();<br><br>        InvokeModelResponse response = client.invokeModel(request);<br>        String result = response.body().asUtf8String();<br><br>        logToS3(txn, result);<br>        if (result.toLowerCase().contains(&quot;fraud&quot;)) {<br>            notifySns(txn);<br>        }<br>        return result;<br>    }<br><br>    private String formatTxn(Transaction txn) {<br>        return String.format(&quot;user:%s, $%.2f at %s in %s&quot;,<br>                txn.getUserId(), txn.getAmount(), txn.getMerchant(), txn.getLocation());<br>    }<br><br>    private void notifySns(Transaction txn) {<br>        String msg = &quot;Fraud detected: &quot; + formatTxn(txn);<br>        snsClient.publish(PublishRequest.builder()<br>            .message(msg)<br>            .topicArn(snsTopicArn)<br>            .build());<br>    }<br><br>    private void logToS3(Transaction txn, String result) {<br>        String log = formatTxn(txn) + &quot; --&gt; Verdict: &quot; + result;<br>        String key = &quot;logs/&quot; + UUID.randomUUID() + &quot;.txt&quot;;<br>        s3Client.putObject(PutObjectRequest.builder()<br>            .bucket(&quot;fraud-detector-logs&quot;)<br>            .key(key)<br>            .build(),<br>            RequestBody.fromString(log));<br>    }<br>}</pre><blockquote>Bedrock + S3 + SNS Clients</blockquote><pre>@Configuration<br>public class AwsConfig {<br>    @Bean<br>    public BedrockRuntimeClient bedrockClient() {<br>        return BedrockRuntimeClient.builder()<br>                .region(Region.US_EAST_1)<br>                .build();<br>    }<br><br>    @Bean<br>    public SnsClient snsClient() {<br>        return SnsClient.builder()<br>                .region(Region.US_EAST_1)<br>                .build();<br>    }<br><br>    @Bean<br>    public S3Client s3Client() {<br>        return S3Client.builder()<br>                .region(Region.US_EAST_1)<br>                .build();<br>    }<br>}</pre><h3>Docker + K8s</h3><pre>FROM eclipse-temurin:17-jdk<br>COPY target/fraud-detector.jar app.jar<br>ENTRYPOINT [&quot;java&quot;, &quot;-jar&quot;, &quot;app.jar&quot;]</pre><h3>Kubernetes Deployment</h3><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: fraud-detector<br>spec:<br>  replicas: 2<br>  selector:<br>    matchLabels:<br>      app: fraud-detector<br>  template:<br>    metadata:<br>      labels:<br>        app: fraud-detector<br>    spec:<br>      containers:<br>        - name: app<br>          image: &lt;AWS-ECR-REPO-EP&gt;/fraud-detector:latest<br>          ports:<br>            - containerPort: 8080<br>          env:<br>            - name: AWS_REGION<br>              value: us-east-1<br>            - name: SNS_TOPIC_ARN<br>              valueFrom:<br>                configMapKeyRef:<br>                  name: fraud-config<br>                  key: snsTopicArn</pre><h3>Unit Test</h3><blockquote>BedrockServiceTest.java</blockquote><pre>@ExtendWith(MockitoExtension.class)<br>class BedrockServiceTest {<br><br>    @Mock<br>    private BedrockRuntimeClient client;<br><br>    @Mock<br>    private S3Client s3Client;<br><br>    @Mock<br>    private SnsClient snsClient;<br><br>    @InjectMocks<br>    private BedrockService service;<br><br>    @Test<br>    void shouldReturnFraudWhenSuspicious() {<br>        Transaction t = new Transaction(&quot;5678&quot;, 9000, &quot;Lagos&quot;, &quot;CryptoVendor&quot;);<br><br>        when(client.invokeModel(any())).thenReturn(<br>            InvokeModelResponse.builder()<br>                .body(SdkBytes.fromUtf8String(&quot;Fraud&quot;))<br>                .build()<br>        );<br><br>        String result = service.evaluateTransaction(t);<br>        assertEquals(&quot;Fraud&quot;, result);<br>        verify(snsClient).publish(any(PublishRequest.class));<br>        verify(s3Client).putObject(any(PutObjectRequest.class), any(RequestBody.class));<br>    }<br>}</pre><h3>Real Prompt Example</h3><pre>You are a fraud detection engine. Answer with &#39;Fraud&#39; or &#39;Legit&#39;.<br><br>Q: user:1234, $500 at Walmart in NY ➔ Legit<br>Q: user:5678, $9000 at CryptoVendor in Nigeria ➔ Fraud<br>Q: user:9999, $8500 at GoldATM in Dubai ➔</pre><p>Expected response: Fraud</p><h3>Improvements</h3><ul><li>Use semantic search to retrieve few-shot examples</li><li>Add fallback if Bedrock is slow or unavailable</li><li>Integrate KEDA for autoscaling on request rate</li></ul><h3>Final Thoughts</h3><p>Using Amazon Bedrock’s large language models, you can detect transaction fraud patterns in real time <em>without training your own model</em>. Combine this with EKS for scalability and you have a production-ready fraud pipeline.</p><h3>Thank you for being a part of the community</h3><p><em>Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://x.com/inPlainEngHQ"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/@InPlainEnglish"><strong>YouTube</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a> | <a href="https://open.spotify.com/show/7qxylRWKhvZwMz2WuEoua0"><strong>Podcast</strong></a> | <a href="https://twitch.tv/inplainenglish"><strong>Twitch</strong></a></li><li><a href="https://differ.blog/"><strong>Start your own free AI-powered blog on Differ</strong></a> 🚀</li><li><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Join our content creators community on Discord</strong></a> 🧑🏻‍💻</li><li>For more content, visit <a href="https://plainenglish.io/"><strong>plainenglish.io</strong></a> + <a href="https://stackademic.com/"><strong>stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=254c312130ea" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/detecting-fraudulent-transactions-in-real-time-using-amazon-bedrock-and-eks-254c312130ea">Detecting Fraudulent Transactions in Real Time using Amazon Bedrock and EKS</a> was originally published in <a href="https://aws.plainenglish.io/">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying a Production-Ready EKS Cluster with Spot NodeGroups, Cluster Autoscaler, and IRSA Using…]]></title>
            <link>https://aws.plainenglish.io/deploying-a-production-ready-eks-cluster-with-spot-nodegroups-cluster-autoscaler-and-irsa-using-7db275a653ca?source=rss-de084af3616f------2</link>
            <guid isPermaLink="false">https://medium.com/p/7db275a653ca</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[elastic-kubernetes]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-cdk]]></category>
            <dc:creator><![CDATA[Sayan Moitra]]></dc:creator>
            <pubDate>Fri, 16 May 2025 07:41:13 GMT</pubDate>
            <atom:updated>2025-05-19T00:53:39.015Z</atom:updated>
            <content:encoded><![CDATA[<h3>Deploying a Production-Ready EKS Cluster with Spot NodeGroups, Cluster Autoscaler, and IRSA Using AWS CDK</h3><p><strong>Most EKS “hello world” tutorials get you to a cluster — but skip all the details you actually need for production.</strong></p><p>What about cost optimization, secure AWS access for pods, and scaling that works without manual intervention?</p><p>In this guide, we’ll use <strong>AWS CDK (TypeScript)</strong> to provision a <strong>production-ready EKS cluster</strong> that’s <em>actually</em> ready for real workloads, not just a sandbox. We’ll also wire up <strong>Jest tests</strong> — because if you wouldn’t deploy untested app code, why risk your infrastructure?</p><p><strong>Here’s what we’ll build:</strong></p><ul><li>VPC with public and private subnets</li><li>EKS cluster with Spot Instance node groups for cost savings</li><li>Cluster Autoscaler via Helm</li><li>IRSA (IAM Roles for Service Accounts) so pods can access AWS (demo: S3 readonly)</li><li>Jest tests for everything above</li></ul><p>Let’s get our hands dirty! ✋🌱</p><h3>1. Prerequisites</h3><ul><li>Node.js (20+)</li><li>AWS CLI configured for your account</li><li>AWS CDK v2 (npm i -g aws-cdk)</li><li>Basic TypeScript knowledge</li></ul><h3>2. Project Bootstrap</h3><pre>mkdir eks-cdk-prod &amp;&amp; cd eks-cdk-prod<br>cdk init app --language typescript<br>npm install @aws-cdk/aws-eks @aws-cdk/aws-ec2 @aws-cdk/aws-iam<br>npm install --save-dev aws-cdk-lib@2 constructs @aws-cdk/assertions jest ts-jest @types/jest</pre><h3>3. The Production-Ready EKS Stack</h3><p>Create lib/eks-cdk-prod-stack.ts:</p><pre>import * as cdk from &#39;aws-cdk-lib&#39;;<br>import { Construct } from &#39;constructs&#39;;<br>import * as eks from &#39;aws-cdk-lib/aws-eks&#39;;<br>import * as ec2 from &#39;aws-cdk-lib/aws-ec2&#39;;<br>import * as iam from &#39;aws-cdk-lib/aws-iam&#39;;<br><br>export class EksCdkProdStack extends cdk.Stack {<br>  public readonly cluster: eks.Cluster;<br><br>  constructor(scope: Construct, id: string, props?: cdk.StackProps) {<br>    super(scope, id, props);<br><br>    // 1. VPC with public/private subnets<br>    const vpc = new ec2.Vpc(this, &#39;EksVpc&#39;, {<br>      maxAzs: 2,<br>      natGateways: 1,<br>      subnetConfiguration: [<br>        {<br>          cidrMask: 24,<br>          name: &#39;public&#39;,<br>          subnetType: ec2.SubnetType.PUBLIC,<br>        },<br>        {<br>          cidrMask: 24,<br>          name: &#39;private&#39;,<br>          subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS,<br>        },<br>      ],<br>    });<br><br>    // 2. EKS Cluster<br>    this.cluster = new eks.Cluster(this, &#39;EksCluster&#39;, {<br>      vpc,<br>      version: eks.KubernetesVersion.V1_28,<br>      defaultCapacity: 0,<br>      vpcSubnets: [{ subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }],<br>      endpointAccess: eks.EndpointAccess.PUBLIC_AND_PRIVATE,<br>    });<br><br>    // 3. Spot NodeGroup for cost savings<br>    this.cluster.addNodegroupCapacity(&#39;SpotNodeGroup&#39;, {<br>      desiredSize: 2,<br>      minSize: 1,<br>      maxSize: 4,<br>      instanceTypes: [new ec2.InstanceType(&#39;t3.large&#39;)],<br>      capacityType: eks.CapacityType.SPOT,<br>      subnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS },<br>      labels: { spot: &#39;true&#39; },<br>    });<br><br>    // 4. IRSA for S3 ReadOnly<br>    const s3ReadOnlyPolicy = iam.ManagedPolicy.fromAwsManagedPolicyName(&#39;AmazonS3ReadOnlyAccess&#39;);<br>    const irsaSA = this.cluster.addServiceAccount(&#39;irsa-demo&#39;, {<br>      name: &#39;irsa-demo&#39;,<br>      namespace: &#39;default&#39;,<br>    });<br>    irsaSA.role.addManagedPolicy(s3ReadOnlyPolicy);<br><br>    // 5. Cluster Autoscaler via Helm chart<br>    this.cluster.addHelmChart(&#39;ClusterAutoscaler&#39;, {<br>      chart: &#39;cluster-autoscaler&#39;,<br>      release: &#39;cluster-autoscaler&#39;,<br>      repository: &#39;https://kubernetes.github.io/autoscaler&#39;,<br>      namespace: &#39;kube-system&#39;,<br>      values: {<br>        autoDiscovery: { clusterName: this.cluster.clusterName },<br>        awsRegion: cdk.Stack.of(this).region,<br>        rbac: { create: true },<br>      },<br>    });<br><br>    new cdk.CfnOutput(this, &#39;ClusterName&#39;, { value: this.cluster.clusterName });<br>    new cdk.CfnOutput(this, &#39;IRSAServiceAccount&#39;, { value: irsaSA.serviceAccountName });<br>  }<br>}</pre><p>And set your entrypoint in bin/eks-cdk-prod.ts:</p><pre>#!/usr/bin/env node<br>import * as cdk from &#39;aws-cdk-lib&#39;;<br>import { EksCdkProdStack } from &#39;../lib/eks-cdk-prod-stack&#39;;<br><br>const app = new cdk.App();<br>new EksCdkProdStack(app, &#39;EksCdkProdStack&#39;, {<br>  env: { region: &#39;ap-south-1&#39; }, // or your preferred region<br>});</pre><h3>4. Deploying</h3><pre>cdk bootstrap<br>cdk deploy</pre><h3>4. Testing Your Infra with Jest</h3><p>Infrastructure code needs tests too!<br>Here’s a sample Jest test in test/eks-cdk-prod-stack.test.ts:</p><pre>import * as cdk from &#39;aws-cdk-lib&#39;;<br>import { Template, Match } from &#39;aws-cdk-lib/assertions&#39;;<br>import { EksCdkProdStack } from &#39;../lib/eks-cdk-prod-stack&#39;;<br><br>describe(&#39;Production EKS Stack&#39;, () =&gt; {<br>  let app: cdk.App;<br>  let stack: EksCdkProdStack;<br>  let template: Template;<br><br>  beforeAll(() =&gt; {<br>    app = new cdk.App();<br>    stack = new EksCdkProdStack(app, &#39;TestStack&#39;);<br>    template = Template.fromStack(stack);<br>  });<br><br>  it(&#39;creates public and private subnets&#39;, () =&gt; {<br>    template.resourceCountIs(&#39;AWS::EC2::Subnet&#39;, 4);<br>    template.hasResourceProperties(&#39;AWS::EC2::Subnet&#39;, {<br>      MapPublicIpOnLaunch: true,<br>    });<br>  });<br><br>  it(&#39;creates an EKS cluster&#39;, () =&gt; {<br>    template.resourceCountIs(&#39;AWS::EKS::Cluster&#39;, 1);<br>  });<br><br>  it(&#39;creates a Spot nodegroup&#39;, () =&gt; {<br>    template.hasResourceProperties(&#39;AWS::EKS::Nodegroup&#39;, {<br>      CapacityType: &#39;SPOT&#39;,<br>      InstanceTypes: Match.arrayWith([&#39;t3.large&#39;]),<br>      ScalingConfig: Match.objectLike({ DesiredSize: 2, MinSize: 1, MaxSize: 4 }),<br>      Labels: Match.objectLike({ spot: &#39;true&#39; }),<br>    });<br>  });<br><br>  it(&#39;creates IRSA role with S3 readonly&#39;, () =&gt; {<br>    template.hasResourceProperties(&#39;AWS::IAM::Role&#39;, {<br>      AssumeRolePolicyDocument: Match.objectLike({<br>        Statement: Match.arrayWith([Match.objectLike({<br>          Principal: Match.objectLike({<br>            Federated: Match.stringLikeRegexp(&#39;oidc&#39;),<br>          }),<br>        })]),<br>      }),<br>    });<br>    template.hasResourceProperties(&#39;AWS::IAM::Policy&#39;, {<br>      PolicyDocument: Match.objectLike({<br>        Statement: Match.arrayWith([Match.objectLike({<br>          Action: &#39;s3:GetObject&#39;,<br>        })]),<br>      }),<br>    });<br>  });<br><br>  it(&#39;installs Cluster Autoscaler via Helm&#39;, () =&gt; {<br>    template.resourceCountIs(&#39;Custom::AWSCDK-EKS-HelmChart&#39;, 1);<br>    template.hasResourceProperties(&#39;Custom::AWSCDK-EKS-HelmChart&#39;, {<br>      Release: &#39;cluster-autoscaler&#39;,<br>    });<br>  });<br><br>  it(&#39;outputs cluster name and IRSA service account&#39;, () =&gt; {<br>    template.hasOutput(&#39;ClusterName&#39;, {});<br>    template.hasOutput(&#39;IRSAServiceAccount&#39;, {});<br>  });<br>});</pre><p>Run your tests:</p><pre>npx jest</pre><h3>6. The Payoff: A Cluster Built for Real Work</h3><p>With this CDK stack and test suite, you now have:</p><ul><li>A <strong>cost-optimized</strong> EKS cluster with Spot node groups</li><li>A secure way for pods to access AWS using IRSA</li><li>Automated scaling (and the ability to autoscale to zero for batch/ML workloads)</li><li>Jest tests to catch accidental changes in your infra</li></ul><p><em>Cloud infrastructure should be as testable and repeatable as the applications it runs. Happy shipping!</em> 🚢✨</p><h3>Thank you for being a part of the community</h3><p><em>Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://x.com/inPlainEngHQ"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/@InPlainEnglish"><strong>YouTube</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a> | <a href="https://open.spotify.com/show/7qxylRWKhvZwMz2WuEoua0"><strong>Podcast</strong></a> | <a href="https://differ.blog/inplainenglish"><strong>Differ</strong></a> | <a href="https://twitch.tv/inplainenglish"><strong>Twitch</strong></a></li><li><a href="https://differ.blog/"><strong>Start your own free AI-powered blog on Differ</strong></a> 🚀</li><li><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Join our content creators community on Discord</strong></a> 🧑🏻‍💻</li><li>For more content, visit <a href="https://plainenglish.io/"><strong>plainenglish.io</strong></a> + <a href="https://stackademic.com/"><strong>stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7db275a653ca" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/deploying-a-production-ready-eks-cluster-with-spot-nodegroups-cluster-autoscaler-and-irsa-using-7db275a653ca">Deploying a Production-Ready EKS Cluster with Spot NodeGroups, Cluster Autoscaler, and IRSA Using…</a> was originally published in <a href="https://aws.plainenglish.io/">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Global Kubernetes Infrastructure with Amazon EKS and Karmada]]></title>
            <link>https://aws.plainenglish.io/building-global-kubernetes-infrastructure-with-amazon-eks-and-karmada-6610975ae66d?source=rss-de084af3616f------2</link>
            <guid isPermaLink="false">https://medium.com/p/6610975ae66d</guid>
            <category><![CDATA[elastickubernetesservice]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[karmada]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Sayan Moitra]]></dc:creator>
            <pubDate>Sun, 30 Mar 2025 17:13:31 GMT</pubDate>
            <atom:updated>2025-03-31T00:48:20.529Z</atom:updated>
            <content:encoded><![CDATA[<h3>Solving Multi-Cluster Management Challenges in the Enterprise</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*6yOaeVtfWKhJhM3D.png" /></figure><p>As organizations scale their Kubernetes environments, managing multiple clusters across various regions becomes increasingly complex. Amazon Elastic Kubernetes Service (EKS) provides a managed Kubernetes service, but orchestrating workloads across multiple EKS clusters presents significant operational challenges. Enter Karmada (Kubernetes Armada) — an open-source CNCF project designed to solve multi-cluster management issues.</p><p>In this article, we’ll explore how to combine Amazon EKS with Karmada to build a robust, scalable multi-cluster management solution that provides high availability, disaster recovery, and improved resource utilization across your Kubernetes estate.</p><h3>What is Karmada?</h3><p>Karmada, which stands for Kubernetes Armada, is a CNCF project that provides a unified control plane for managing multiple Kubernetes clusters. Unlike other multi-cluster solutions, Karmada maintains the native Kubernetes API without introducing custom APIs, making it easier to integrate with existing Kubernetes tools and workflows.</p><p>Key features of Karmada include:</p><ul><li><strong>Centralized cluster management</strong>: Manage multiple clusters from a single control plane</li><li><strong>Native Kubernetes API compatibility</strong>: Use familiar Kubernetes APIs and tools</li><li><strong>Resource propagation</strong>: Automatically distribute resources across member clusters</li><li><strong>Failover and high availability</strong>: Support application failover between clusters</li><li><strong>Override policies</strong>: Define cluster-specific configurations while maintaining a single source of truth</li></ul><h3>Why Combine EKS with Karmada?</h3><p>Amazon EKS simplifies running Kubernetes on AWS by eliminating the need to install and operate your own Kubernetes control plane. However, many organizations require workloads to run across multiple regions or even multiple cloud providers. Combining EKS with Karmada offers several advantages:</p><ol><li><strong>Global High Availability</strong>: Deploy applications across multiple regions to ensure service continuity even if an entire region experiences an outage</li><li><strong>Regulatory Compliance</strong>: Meet data residency requirements by deploying specific workloads to specific regions</li><li><strong>Cost Optimization</strong>: Distribute workloads to the most cost-effective regions</li><li><strong>Scalability</strong>: Scale beyond the limits of a single Kubernetes cluster</li><li><strong>Simplified Management</strong>: Manage multiple clusters with consistent policies and configurations</li></ol><h3>Implementation Architecture</h3><p>Let’s walk through a reference architecture for implementing Karmada with EKS:</p><ol><li><strong>Karmada Control Plane</strong>: Deploy the Karmada control plane in a dedicated EKS cluster, preferably in your primary region</li><li><strong>Member Clusters</strong>: Set up multiple EKS clusters across different AWS regions</li><li><strong>Connectivity</strong>: Establish secure connectivity between clusters using AWS Transit Gateway or similar networking services</li><li><strong>Authentication</strong>: Configure IAM roles and service accounts for secure cluster access</li><li><strong>Monitoring</strong>: Implement a unified monitoring solution across all clusters</li></ol><h3>Setting Up Your Multi-Cluster Environment</h3><h3>Prerequisites</h3><ul><li>AWS CLI configured with appropriate permissions</li><li>kubectl installed and configured</li><li>Helm 3.x installed</li></ul><h3>Creating EKS Clusters</h3><p>First, create EKS clusters in your desired regions:</p><pre># Create a cluster in us-west-2 (for Karmada control plane)<br>eksctl create cluster --name karmada-control --region us-west-2 --version 1.28 --nodegroup-name standard-workers --node-type m5.large --nodes 3</pre><pre># Create a member cluster in us-east-1<br>eksctl create cluster --name eks-east --region us-east-1 --version 1.28 --nodegroup-name standard-workers --node-type m5.large --nodes 3</pre><pre># Create another member cluster in eu-west-1<br>eksctl create cluster --name eks-europe --region eu-west-1 --version 1.28 --nodegroup-name standard-workers --node-type m5.large --nodes 3</pre><h3>Installing the Karmada Control Plane</h3><p>Next, install the Karmada control plane on the first cluster:</p><pre># Update kubeconfig to point to the control plane cluster<br>aws eks update-kubeconfig --name karmada-control --region us-west-2</pre><pre># Install Karmada using Helm<br>helm repo add karmada <a href="https://raw.githubusercontent.com/karmada-io/karmada/master/charts">https://raw.githubusercontent.com/karmada-io/karmada/master/charts</a><br>helm repo update<br>helm install karmada karmada/karmada --create-namespace --namespace karmada-system</pre><h3>Registering Member Clusters</h3><p>Now, register your EKS clusters with Karmada:</p><pre># Install karmadactl<br>curl -s https://raw.githubusercontent.com/karmada-io/karmada/master/hack/install-cli.sh | bash</pre><pre># Get kubeconfig for member clusters<br>aws eks update-kubeconfig --name eks-east --region us-east-1 --kubeconfig=/tmp/eks-east.kubeconfig<br>aws eks update-kubeconfig --name eks-europe --region eu-west-1 --kubeconfig=/tmp/eks-europe.kubeconfig</pre><pre># Register clusters with Karmada<br>karmadactl join eks-east --cluster-kubeconfig=/tmp/eks-east.kubeconfig<br>karmadactl join eks-europe --cluster-kubeconfig=/tmp/eks-europe.kubeconfig</pre><p>Verify your clusters are properly registered:</p><pre>kubectl get clusters</pre><p>You should see your EKS clusters listed with their status as “Ready”.</p><h3>Deploying Applications Across Clusters</h3><p>With Karmada, you have multiple ways to deploy applications across clusters. The most common approach is using a PropagationPolicy:</p><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: nginx-deployment<br>  namespace: default<br>spec:<br>  replicas: 2<br>  selector:<br>    matchLabels:<br>      app: nginx<br>  template:<br>    metadata:<br>      labels:<br>        app: nginx<br>    spec:<br>      containers:<br>      - name: nginx<br>        image: nginx:1.21<br>        ports:<br>        - containerPort: 80<br>---<br>apiVersion: policy.karmada.io/v1alpha1<br>kind: PropagationPolicy<br>metadata:<br>  name: nginx-propagation<br>  namespace: default<br>spec:<br>  resourceSelectors:<br>    - apiVersion: apps/v1<br>      kind: Deployment<br>      name: nginx-deployment<br>  placement:<br>    clusterAffinity:<br>      clusterNames:<br>        - eks-east<br>        - eks-europe</pre><p>Apply this YAML to your Karmada control plane, and Karmada will propagate the nginx deployment to both the eks-east and eks-europe clusters.</p><h3>Using OverridePolicy for Cluster-specific Configurations</h3><p>You might want different configurations for different clusters. For instance, you might need more replicas in a region with higher traffic:</p><pre>apiVersion: policy.karmada.io/v1alpha1<br>kind: OverridePolicy<br>metadata:<br>  name: nginx-override<br>  namespace: default<br>spec:<br>  resourceSelectors:<br>    - apiVersion: apps/v1<br>      kind: Deployment<br>      name: nginx-deployment<br>  overrideRules:<br>    - targetCluster:<br>        clusterNames:<br>          - eks-europe<br>      overriders:<br>        plaintext:<br>          - path: &quot;/spec/replicas&quot;<br>            operator: replace<br>            value: 5</pre><p>This policy will override the replicas count to 5 in the eks-europe cluster, while eks-east will use the default value from the original deployment.</p><h3>Implementing Failover Between Regions</h3><p>One of the key benefits of a multi-cluster setup is the ability to implement cross-region failover. Here’s how to set up a simple failover mechanism using Karmada:</p><pre>apiVersion: policy.karmada.io/v1alpha1<br>kind: PropagationPolicy<br>metadata:<br>  name: nginx-failover<br>  namespace: default<br>spec:<br>  resourceSelectors:<br>    - apiVersion: apps/v1<br>      kind: Deployment<br>      name: nginx-deployment<br>  placement:<br>    replicaScheduling:<br>      replicaSchedulingType: Divided<br>      weightPreference:<br>        staticWeightList:<br>          - targetCluster:<br>              clusterNames:<br>                - eks-east<br>            weight: 1<br>          - targetCluster:<br>              clusterNames:<br>                - eks-europe<br>            weight: 0<br>    clusterTolerations:<br>      - key: cluster.karmada.io/unreachable<br>        operator: Exists<br>        effect: NoSchedule<br>        tolerationSeconds: 300</pre><p>With this policy, your workloads initially run in eks-east. If eks-east becomes unreachable for more than 300 seconds, Karmada will reschedule the workloads to eks-europe.</p><h3>Monitoring Your Multi-cluster Setup</h3><p>Monitoring a multi-cluster setup requires a unified approach. Consider implementing:</p><ol><li><strong>Prometheus and Grafana</strong>: Deploy Prometheus for metrics collection and Grafana for visualization</li><li><strong>Karmada Dashboards</strong>: Use Karmada-specific Grafana dashboards to monitor propagation status</li><li><strong>AWS CloudWatch</strong>: Integrate with CloudWatch for EKS-specific metrics</li><li><strong>Distributed Tracing</strong>: Implement tools like Jaeger or AWS X-Ray for tracing requests across clusters</li></ol><h3>Cost Optimization Strategies</h3><p>Running multiple EKS clusters can increase costs. Here are strategies to optimize expenses:</p><ol><li><strong>Right-size your clusters</strong>: Use appropriate instance types and autoscaling</li><li><strong>Spot Instances</strong>: Configure node groups to use Spot instances for non-critical workloads</li><li><strong>Cluster Autoscaler</strong>: Implement the Kubernetes Cluster Autoscaler to adjust node count based on workload</li><li><strong>Fargate Profiles</strong>: Use AWS Fargate for serverless container execution when appropriate</li><li><strong>Workload Distribution</strong>: Use Karmada to place workloads in lower-cost regions when possible</li></ol><h3>Common Challenges and Solutions</h3><h3>Networking Complexity</h3><p><strong>Challenge</strong>: Establishing secure communication between clusters across regions.</p><p><strong>Solution</strong>: Use AWS Transit Gateway for regional connectivity, implement service mesh solutions like Istio or AWS App Mesh for service-to-service communication.</p><h3>Data Synchronization</h3><p><strong>Challenge</strong>: Keeping data synchronized across multiple regions.</p><p><strong>Solution</strong>: Use region-specific persistent volumes for regional data, employ cross-region replication for shared data, or use managed services like Amazon Aurora Global Database.</p><h3>Certificate Management</h3><p><strong>Challenge</strong>: Managing TLS certificates across clusters.</p><p><strong>Solution</strong>: Implement cert-manager with a central certificate authority, or use AWS Certificate Manager for certificates.</p><h3>Conclusion</h3><p>Combining Amazon EKS with Karmada provides a powerful solution for multi-cluster Kubernetes management. This approach enables global high availability, regulatory compliance, and cost optimization while simplifying operations through a unified control plane.</p><p>As organizations continue to expand their Kubernetes footprint, multi-cluster management becomes essential. By following the steps and best practices outlined in this article, you can build a robust, scalable Kubernetes platform that spans multiple regions and even multiple cloud providers.</p><p>Remember that multi-cluster management is a journey, not a destination. Start with a simple setup, gain operational experience, and gradually expand your multi-cluster capabilities as your organization’s needs evolve.</p><h3>Additional Resources</h3><ul><li><a href="https://karmada.io/docs/">Karmada Official Documentation</a></li><li><a href="https://docs.aws.amazon.com/eks/">Amazon EKS Documentation</a></li><li><a href="https://github.com/karmada-io/karmada">Karmada GitHub Repository</a></li></ul><h3>Thank you for being a part of the community</h3><p><em>Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://x.com/inPlainEngHQ"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/@InPlainEnglish"><strong>YouTube</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a> | <a href="https://open.spotify.com/show/7qxylRWKhvZwMz2WuEoua0"><strong>Podcast</strong></a> | <a href="https://differ.blog/inplainenglish"><strong>Differ</strong></a> | <a href="https://twitch.tv/inplainenglish"><strong>Twitch</strong></a></li><li><a href="https://cofeed.app/"><strong>Check out CoFeed, the smart way to stay up-to-date with the latest in tech</strong></a> <strong>🧪</strong></li><li><a href="https://differ.blog/"><strong>Start your own free AI-powered blog on Differ</strong></a> 🚀</li><li><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Join our content creators community on Discord</strong></a> 🧑🏻‍💻</li><li>For more content, visit <a href="https://plainenglish.io/"><strong>plainenglish.io</strong></a> + <a href="https://stackademic.com/"><strong>stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6610975ae66d" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/building-global-kubernetes-infrastructure-with-amazon-eks-and-karmada-6610975ae66d">Building Global Kubernetes Infrastructure with Amazon EKS and Karmada</a> was originally published in <a href="https://aws.plainenglish.io/">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>