<?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 Ian Binder on Medium]]></title>
        <description><![CDATA[Stories by Ian Binder on Medium]]></description>
        <link>https://medium.com/@ianbinder?source=rss-b8a2ff66e963------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*H4tdx5-Hq7Dh4f4hhzMszQ.jpeg</url>
            <title>Stories by Ian Binder on Medium</title>
            <link>https://medium.com/@ianbinder?source=rss-b8a2ff66e963------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 19:37:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ianbinder/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[Generative AI: Workslop and the Illusion of Competence]]></title>
            <link>https://medium.com/@ianbinder/generative-ai-workslop-and-the-illusion-of-competence-08301aa9421c?source=rss-b8a2ff66e963------2</link>
            <guid isPermaLink="false">https://medium.com/p/08301aa9421c</guid>
            <category><![CDATA[leadership]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[workslop]]></category>
            <category><![CDATA[ai-slop]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <dc:creator><![CDATA[Ian Binder]]></dc:creator>
            <pubDate>Sat, 09 May 2026 19:24:59 GMT</pubDate>
            <atom:updated>2026-05-09T19:24:59.555Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uejj3zVyNJ16E8aYqqvuOg.png" /></figure><p>I’m a big fan of generative AI. I use it every day and I like to joke that all of my work is done by Claude. A good chunk of my work thes days is helping teams get more out of these tools. For the most part, the technology earns the hype. The way some of it is being used does not though.</p><p>There’s a gap between what AI lets people produce and what AI lets people contribute. While the output is polished, the thinking might not be there at all.</p><p>Several gaps, actually, but I’d like to focus on three of these.</p><ul><li><strong>The input gap.</strong> You feed the model nothing useful, you get back nothing useful, dressed up to look useful.</li><li><strong>The output gap.</strong> The doc looks clean. The reader still has to reverse-engineer what you meant.</li><li><strong>The self-perception gap.</strong> After a long session with ChatGPT, you feel like an expert. The model has been agreeing with you the whole time.</li></ul><h2>The input gap</h2><p>The interesting work with AI happens before you type the prompt, not after. Most of what separates useful output from generic output is settled by the time the model starts running.</p><p><strong>Foundation models are converging and commoditizing.</strong> GPT, Claude, and Gemini all offer broadly similar capabilities at this point, and the API pricing keeps coming down. If your only contribution is a prompt anyone could write, you’re not really adding anything that someone else can’t replicate in seconds.</p><p><strong>The value is in context engineering, not prompting.</strong> Context engineering is the practice of selecting, filtering, and sequencing the information the model sees, so that a general-purpose model can give you domain-specific answers. The model didn’t change, but the information it has when it starts did.</p><p><strong>The strategic shift is from “getting better at asking” to “getting better at feeding.”</strong> Prompting still matters at the margins, but it’s not really where the leverage is anymore. The leverage is in everything that happens before the prompt.</p><p><strong>More context isn’t always better.</strong> Even with the massive context windows we have now, dumping information in unfiltered actually degrades performance. There are documented failure modes like context poisoning, context confusion, and context rot, where the model gets worse the more you stuff in. The skill is in curation, not capacity.</p><p>So how do you actually do this? For me, most of the time I spend with AI isn’t spent prompting, it’s spent building documentation. Docs that capture my voice, what I care about, what my company does. And then more docs that drill down further: my team, the people on it, the projects we’re running, the code we’re shipping. So much of the up-front time goes into building that knowledge base.</p><p>The good news is AI can even help you build these knowledge bases. You can use it to summarize meetings, draft from interview transcripts, extract structure from existing docs. Once the knowledge base is in place, you can hand it to your GenAI tool and the answers come back more natural, more informed, more useful. The model didn’t get smarter, it just finally knows what you know.</p><p>This is one of the reasons I strongly encourage folks to use the Claude Code CLI. The terminal-native workflow makes it much easier to build and maintain context repos, since you’re working with files in a directory rather than pasting things into a chat. The context repo becomes the actual work product, and once that’s in place, prompting is the easy part.</p><p>When this work gets skipped, what comes out is generic, and generic output usually becomes someone else’s problem to clean up.</p><h2>The output gap: workslop</h2><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E8ErW0DOs3YTqS4B2YnR1A.png" /></figure><p>This came up for me recently. I sat in a meeting where folks were taking turns sharing their AI strategies. Every deck looked basically the same. The same structure, the same fonts, the same vague bullets, and the same flowery transitions. It was clear that everyone had used the same model, and it was hard to find any of the presenters in their own decks.</p><p>BetterUp Labs and the Stanford Social Media Lab have a name for what that becomes when it lands on someone else’s desk. They call it workslop, and they define it as AI-generated work content that masquerades as good work but lacks the substance to meaningfully advance a given task. The polish is there, but the substance isn’t.</p><p><strong>The numbers.</strong> In their research, employees spend an average of one hour and 56 minutes dealing with each instance of workslop, which works out to an invisible tax of around $186 per employee per month. Extrapolated across a typical organization in their study, that’s over $9 million a year.</p><p><strong>The mechanism is cognitive offloading onto another human.</strong> This is what makes workslop different from a regular bad email. A calculator offloads arithmetic to a machine, a search engine offloads recall to a machine, but AI content offloads thinking to another human. The sender used a tool to skip the work of organizing their thoughts, and now the receiver has to do that work for them, whether that means interpreting it, correcting it, or redoing it from scratch.</p><p><strong>The bullets-to-email loop.</strong> Tom Fishburne drew a cartoon that captures this perfectly, and I think most of us have been on both sides of that loop by now. One employee says, “AI turns this single bullet point into a long email I can pretend I wrote.” Another says, “AI makes a single bullet point out of this long email I pretend I read.” It’s funny because it’s just possible enough to be believable, and the bullet that goes into that loop has approximately zero percent chance of coming out the other side intact.</p><p><strong>Management is part of the problem.</strong> When organizations reward speed and volume, they incentivize whatever produces the most output the fastest. The cost of cleaning up after low-quality output is invisible in any official metric, which creates an illusion of progress that nobody is positioned to push back on.</p><p><strong>Social cost.</strong> The thing you generated to look productive is actually making you look worse to the person you sent it to. The same research found that roughly half of recipients view workslop senders as less creative, less capable, and less reliable. 42% see them as less trustworthy. 37% see them as less intelligent.</p><p>So how do you handle workslop when it lands on your desk? For me, the answer is to try to turn it into a teachable moment when I can. The goal isn’t to discourage AI use, it’s to make sure the AI is being used to amplify someone’s voice and context rather than replace it. Read the output, understand it, and make sure it sounds like you and not like the model. That said, I will strongly push back on documents that are clearly just slop. If something hasn’t been checked for accuracy, that’s on the person who submitted it. “The AI wrote it” is not an acceptable excuse. You’re responsible for the work you put your name on.</p><h2>The self-perception gap</h2><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YWAFF1z7f0tcF5FFGfjsQg.png" /></figure><p>Of the three gaps, this one has the longest tail. The other two cost someone else their time. This one tends to cost you your own skills over time.</p><p>The receiver of workslop knows it’s workslop and is paying the tax for cleaning it up. The sender often doesn’t know, and feels productive and proficient and like they just did good work.</p><p><strong>The illusion of competence</strong> The phrase for this is “illusion of competence,” which describes a perception of mastery created by AI outputs that mask underlying gaps in understanding. You ship more, you ship faster, and you feel sharper while you’re doing it. The catch is that the same tool that’s generating the work is often the thing you’re using to judge whether the work is any good (if you’re going through that excercise at all).</p><p><strong>The user doesn’t read either.</strong> This is the symmetry to the bullets-to-email loop. The receiver doesn’t really read the doc, and the sender often hasn’t either. They asked the model for an answer, they got something that looked confident, and they forwarded it along. No critical verification, no sanity check, just the AI’s first draft moving through the system as if it were a finished thought.</p><p><strong>People disagree with experts after AI conversations.</strong> There’s a phrase for this called AI overconfidence syndrome, and the rough rule is that if you find yourself disagreeing with domain experts after a ChatGPT conversation, that’s a red flag worth paying attention to. When the model doesn’t know something, it doesn’t say “I don’t know.” It generates a confident, plausible-sounding answer instead. We humans evolved to read confidence cues from other humans, and the model is using that exact register to deliver content that may simply be wrong.</p><p><strong>The AI itself is overconfident.</strong> Carnegie Mellon researchers ran two years of data across ChatGPT, Gemini, Claude Sonnet, and Claude Haiku, and found that the chatbots stay confident even when they’re wrong. The model isn’t aware of when it’s hallucinating, and it doesn’t sound any less sure about a wrong answer than a right one.</p><p><strong>Critical thinking erodes with use.</strong> A Microsoft and Carnegie Mellon study of 319 knowledge workers found three significant shifts in how people think when they use generative AI heavily, and none of those shifts were about thinking more. Reliance on the tool tends to bypass the practice that produces real skill in the first place.</p><p><strong>The Dunning-Kruger angle.</strong> The illusion of competence carries you through the easy stuff, where surface-level pattern matching is good enough. It tends to collapse when you’re handed a real problem and there’s no tool to lean on. That gap between “feels expert” and “is expert” is exactly where Dunning-Kruger lives, and AI is making the slope of that curve a lot steeper.</p><p><strong>Skill rot is real and measurable.</strong> A year-long study of cancer specialists found that early productivity gains from AI decision support came with a gradual dulling of expert judgment, which the authors call intuition rust. A separate study by Shen and Tamkin found that participants who delegated coding tasks to AI learned the least, while the ones who stayed cognitively engaged got more out of the tool and kept their skills sharper in the process.</p><p>So how do you keep yourself from sliding into the illusion? The honest answer is that you mostly catch it after the fact, by noticing the gap between what you thought you knew and what turned out to be true. But there are a few things I try to do up front. When the model is agreeing with me too easily, I treat that as a signal, since models tend to mirror the position you bring in and easy agreement isn’t the same thing as confirmation. When I notice myself feeling certain about something I learned in a 20-minute chatbot conversation, I check with someone who’s actually done the work. Domain experts carry years of lived context that the model is only approximating from public sources, and that gap tends to show up in the edge cases that actually matter. If I find myself disagreeing with the expert after a chatbot session, I treat that as a signal about my own understanding, not about theirs. The model can give you a confident-sounding answer in two seconds, but a short conversation with the right person is what keeps you from being confidently wrong later. There’s also a side benefit, which is that the conversation itself usually teaches you something the model couldn’t have, since experts tend to share the parts of their reasoning that never made it into anything written down. And when I hit a wall, rather than going back and forth trying to force the AI into a solution, I just do it myself, verifying my own work the same way I would anyone else’s, or any AI’s.</p><h2>Putting it together</h2><p>The thread running through all three gaps is that the AI isn’t doing the part that actually matters. It’s not building your context, it’s not owning your output, and it’s not doing your thinking. Those still belong to you, and the work of holding onto them isn’t exotic.</p><p>For input, that means the up-front investment in documentation, capturing voice and context and the specifics that turn a generic answer into a useful one. For output, it means reading what the model gives you, making sure it actually says what you want to say, and standing behind it once it leaves your hands. For self-perception, it means treating easy agreement as a signal, checking with experts when you find yourself certain, and being willing to drop the tool and do the work yourself when the AI keeps missing.</p><p>The bar for using AI well isn’t actually that high. It’s just higher than the bar for using AI to look busy.</p><h2>Sources</h2><ul><li>BetterUp Labs / Stanford Social Media Lab on workslop, <a href="https://hbr.org/2025/09/ai-generated-workslop-is-destroying-productivity">HBR</a> and <a href="https://www.charterworks.com/how-ai-generated-workslop-quietly-drains-productivity-and-how-smarter-ai-use-stops-it/">Charterworks</a></li><li>Tom Fishburne / Marketoonist, <a href="https://marketoonist.com/2023/03/ai-written-ai-read.html">Marketoonist</a></li><li>Context engineering: <a href="https://www.moodys.com/web/en/us/creditview/blog/beyond-prompts-why-enterprise-ai-demands-context-engineering.html">Moody’s</a>, <a href="https://towardsdatascience.com/beyond-rag/">Towards Data Science</a>, and the <a href="https://arxiv.org/pdf/2507.13334">arXiv survey</a></li><li>Carnegie Mellon on chatbot overconfidence, <a href="https://www.cmu.edu/dietrich/news/news-stories/2025/july/trent-cash-ai-overconfidence.html">CMU news</a></li><li>Microsoft / CMU 319-worker critical thinking study, <a href="https://aisimplifiedforleaders.substack.com/p/28-the-illusion-of-competence-how">summary</a></li><li>Illusion of competence and skill degradation, <a href="https://rsisinternational.org/journals/ijrsi/digital-library/volume-12-issue-5/1725-1738.pdf">IJRSI</a></li><li>AI overconfidence syndrome, <a href="https://harishgautam.net/ai-overconfidence-syndrome-chatgpt-dangers/">Harish Gautam</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=08301aa9421c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Trouble with tokens? Some easy strategies for saving.]]></title>
            <link>https://medium.com/@ianbinder/trouble-with-tokens-some-easy-strategies-for-saving-284d9f336cb3?source=rss-b8a2ff66e963------2</link>
            <guid isPermaLink="false">https://medium.com/p/284d9f336cb3</guid>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[token]]></category>
            <category><![CDATA[anthropic-claude]]></category>
            <dc:creator><![CDATA[Ian Binder]]></dc:creator>
            <pubDate>Fri, 10 Apr 2026 13:46:34 GMT</pubDate>
            <atom:updated>2026-04-10T13:46:34.191Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve been using Claude Code as my daily driver for a few months now. It’s genuinely changed how I work. It’s also genuinely changed how fast I burn through API credits.</p><p>After watching my token usage climb, I started paying attention to what actually drives cost. Turns out, most of the waste is avoidable once you understand how the tool works under the hood. Claude resubmits your entire conversation history on every single message. That means the longer your conversation runs, the more expensive every turn gets. It compounds fast.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qqiBAV0djuhuhoK7b-qtHg.png" /></figure><p>Here’s what I’ve been doing to keep costs reasonable without sacrificing productivity.</p><h2>Start fresh conversations often</h2><p>This is the single biggest thing. Don’t let a conversation run past 15–20 turns. By that point you’re paying to resubmit a ton of context that probably isn’t relevant anymore.</p><p>When I start a new conversation, I copy over just the decisions and outputs I need. Not the full history. Not the back-and-forth. Just the stuff that matters for what I’m doing next.</p><h2>Separate planning from execution</h2><p>I plan in one session, write the output to a markdown file, then start a fresh session to actually build the thing. This keeps all that planning context from getting dragged through every implementation turn.</p><p>This also means writing plans to files, not into the conversation. If your plan lives as messages in a chat thread, you’re paying to carry it on every turn. If it’s a .md file, Claude reads it once when it needs it.</p><h2>Convert documents before feeding them in</h2><p>PDFs, images, webpages, spreadsheets. Anything that isn’t plain text carries formatting overhead. HTML tags, layout metadata, embedded fonts. All of that inflates token cost significantly. I’ve seen 10–20x bloat compared to clean markdown.</p><p>My approach: convert everything to markdown in a dedicated session first, save the files, then reference those files in my actual work session. And save your conversion scripts so Claude doesn’t regenerate them each time. That regeneration itself costs tokens.</p><h2>Use the right model for the job</h2><p>Opus for reasoning and planning. Sonnet for execution. Haiku for cleanup and polish. Don’t use the most expensive model to reformat text or proofread a README.</p><h2>Audit your context overhead</h2><p>Run /context in Claude Code to see how many tokens load before you even type your first prompt. Plugins, skills, MCP servers. They all add up. Trim anything you&#39;re not actively using.</p><p>A few specific things I watch for:</p><p><strong>Keep your </strong><strong>CLAUDE.md lean.</strong> This file loads into every single conversation. It should be concise and high-signal. Project structure, key commands, coding conventions, pointers to deeper docs. Not the deep docs themselves. A bloated CLAUDE.md is a per-turn tax.</p><p><strong>Build small, focused docs.</strong> Instead of one giant reference document, keep individual docs small and linked to each other. That way only the relevant doc gets pulled into context, not the whole thing.</p><p><strong>Scope subagent context tightly.</strong> When spawning subagents, only pass what they need for their specific task. They don’t need your full conversation history.</p><p><strong>Keep project configs separate.</strong> MCP servers, skills, and plugins that aren’t relevant to a project still cost tokens when loaded. Set up per-project .claude/settings.json so each project only carries the integrations it actually uses.</p><h2>The bottom line</h2><p>None of this is complicated. It’s just not obvious until you understand the billing mechanics. The core insight is simple: tokens compound per turn, so manage your context like you manage your money. Keep it lean, keep it relevant, and don’t carry what you don’t need.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=284d9f336cb3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop Paying NAT Gateway Prices for S3 Traffic]]></title>
            <link>https://medium.com/@ianbinder/stop-paying-nat-gateway-prices-for-s3-traffic-3944ccd64bf8?source=rss-b8a2ff66e963------2</link>
            <guid isPermaLink="false">https://medium.com/p/3944ccd64bf8</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cost-optimization]]></category>
            <category><![CDATA[s3]]></category>
            <category><![CDATA[aws-nat-gateway]]></category>
            <dc:creator><![CDATA[Ian Binder]]></dc:creator>
            <pubDate>Thu, 26 Mar 2026 15:01:05 GMT</pubDate>
            <atom:updated>2026-03-26T15:01:05.222Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re running workloads in private subnets on AWS, which is a great practice, there’s a good chance you’re paying NAT Gateway data processing charges on S3 traffic you don’t need to.</p><p>NAT Gateway charges $0.045 per GB of data processed. That doesn’t sound like much until you realize your application logs, backups, ML training data, and deployment artifacts are all flowing through it on the way to S3. I’ve seen environments where S3 traffic accounted for 60–80% of NAT Gateway data processing costs. That adds up fast.</p><p>The fix is a <strong>VPC Gateway Endpoint for S3</strong>, and it’s free.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OT6_jhQZKh9GGFh2Br0sAA.png" /><figcaption>NAT Gateway Bytes billing usage — Change applied on February 5.</figcaption></figure><h3>What’s a Gateway Endpoint?</h3><p>A Gateway Endpoint is a VPC-level resource that gives your private subnets a direct path to S3 (or DynamoDB, same concept) without leaving the AWS network. No NAT Gateway. No internet. No data processing charges. You’re also likely shaving off a bit of latency since traffic isn’t making that extra hop through NAT.</p><p>Unlike Interface Endpoints, which create ENIs in your subnets and cost $0.01/hr per AZ, Gateway Endpoints are free to create and free to use. There is no hourly charge and no data processing charge. It’s one of the few things on AWS that is genuinely free with no catch.</p><h3>The Routes You Might Miss</h3><p>Here’s where people get tripped up. When you create a Gateway Endpoint, AWS adds a route to the route tables you associate with it. The route target is the endpoint itself, and the destination is a prefix list that represents all S3 IP ranges in the region.</p><p>That prefix list (something like pl-63a5400a for S3 in us-east-1) is a managed list of CIDR blocks that AWS maintains. You don&#39;t control it, you can&#39;t edit it, and it updates automatically when AWS adds S3 IP ranges. You can see it in your route table in the console, but it doesn&#39;t look like a typical route, so it&#39;s easy to gloss over.</p><p>Adding to the confusion, if you’re doing this in the console, you manage the route table associations from the endpoint page, not from the route table page. So if you’re looking at your route tables trying to figure out why S3 traffic is still hitting NAT, you’re looking in the wrong place.</p><p>Here’s the part that bites people: <strong>if you don’t associate the endpoint with a route table, that route table doesn’t get the route.</strong> Your traffic will keep flowing through the NAT Gateway and you’ll keep paying for it. If you have 10 route tables and you only associate 3 of them, the other 7 are still going the expensive way.</p><h3>The Terraform</h3><h4>The Endpoint</h4><pre>resource &quot;aws_vpc_endpoint&quot; &quot;s3&quot; {<br>  vpc_id       = aws_vpc.main.id<br>  service_name = &quot;com.amazonaws.${var.region}.s3&quot;<br><br>tags = {<br>    Name = &quot;${var.environment}-s3-endpoint&quot;<br>  }<br>}</pre><p>Simple enough. The endpoint by itself does nothing though, you need to associate it with route tables.</p><h4>Route Table Associations</h4><pre>resource &quot;aws_vpc_endpoint_route_table_association&quot; &quot;private&quot; {<br>  for_each = toset(aws_route_table.private[*].id)<br><br>route_table_id  = each.value<br>  vpc_endpoint_id = aws_vpc_endpoint.s3.id<br>}</pre><p>This is the critical piece. You need an association for <strong>every private route table</strong> that has resources talking to S3. Miss one and that subnet’s traffic still goes through NAT. If you’re like most shops and you have separate route tables per AZ or per tier, make sure you’re catching all of them.</p><h4>Putting It All Together</h4><pre>resource &quot;aws_vpc_endpoint&quot; &quot;s3&quot; {<br>  vpc_id       = aws_vpc.main.id<br>  service_name = &quot;com.amazonaws.${var.region}.s3&quot;<br><br>tags = {<br>    Name = &quot;${var.environment}-s3-endpoint&quot;<br>  }<br>}<br><br>resource &quot;aws_vpc_endpoint_route_table_association&quot; &quot;private&quot; {<br>  for_each = toset(aws_route_table.private[*].id)<br><br>route_table_id  = each.value<br>  vpc_endpoint_id = aws_vpc_endpoint.s3.id<br>}</pre><p>Notice I’m associating both the private <em>and</em> database route tables. If you’re running RDS with S3 export, Aurora with S3 integration, or anything that touches S3 from a database subnet, that traffic goes through NAT too if you don’t add the association.</p><h3>How to Tell If You’re Overpaying</h3><p>Before you add the endpoint, or after to verify it’s working, check your NAT Gateway in Cost Explorer. Go to <strong>Cost Explorer → Filter by Service: VPC → Group by: Usage Type</strong>. Look for NatGateway-Bytes. That&#39;s your data processing charge. If you’re using the new Regional NAT Gateways, they actually have a different usage type, “USE1-RegionalNatGateway-Bytes”.</p><p>You can also check CloudWatch metrics on the NAT Gateway itself. Look at BytesOutToDestination. If a significant chunk of that is going to S3 IP ranges, you&#39;ve got money to save.</p><p>After adding the endpoint, give it a few days and check again. You should see a noticeable drop in NAT Gateway data processing costs.</p><h3>DynamoDB Too</h3><p>Everything I just said applies equally to DynamoDB. Same concept, same free Gateway Endpoint, same “invisible” routes:</p><pre>resource &quot;aws_vpc_endpoint&quot; &quot;dynamodb&quot; {<br>  vpc_id       = aws_vpc.main.id<br>  service_name = &quot;com.amazonaws.${var.region}.dynamodb&quot;<br><br>tags = {<br>    Name = &quot;${var.environment}-dynamodb-endpoint&quot;<br>  }<br>}</pre><p>If you’re running DynamoDB-heavy workloads from private subnets, add this one too.</p><h3>The Bottom Line</h3><p>S3 Gateway Endpoints are free. There’s no reason not to have one in every VPC that touches S3. The only thing that’ll bite you is forgetting to associate it with all your route tables, and now you know to check for that.</p><p>Go check your NAT Gateway costs. You might be pleasantly surprised by how much you can save.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3944ccd64bf8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Transit Gateway — Hub and Spoke Networking at AWS]]></title>
            <link>https://medium.com/@ianbinder/aws-transit-gateway-hub-and-spoke-networking-at-aws-f2fe986f561f?source=rss-b8a2ff66e963------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2fe986f561f</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[transit-gateway]]></category>
            <dc:creator><![CDATA[Ian Binder]]></dc:creator>
            <pubDate>Sun, 06 Oct 2024 18:24:46 GMT</pubDate>
            <atom:updated>2024-10-06T18:24:46.987Z</atom:updated>
            <content:encoded><![CDATA[<h3>AWS Transit Gateway — Hub and Spoke Networking at AWS</h3><p>Designing and implementing simple network topologies across AWS accounts without compromising security.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zx9qt2SpfdkyEte0-sM1EQ.png" /></figure><p>You may be wondering, why write this now? AWS Transit Gateway has been around for years at this point. Until very recently though, this was not a good solution for organizations that wanted to both adhere to the principle of least privilege and also use serverless and managed options where available. I’m going to cover a couple things in this post:</p><ul><li>What is a hub and spoke network and why would I want to use one?</li><li>Why couldn’t I do this before?</li></ul><h4>What is a hub and spoke network and why would I want to use one?</h4><figure><img alt="A visual representation of a hub and spoke network, depicting a central node surrounded by other nodes with a connection to the central node." src="https://cdn-images-1.medium.com/max/417/1*5sKaBHnMavBg-ohO-Nbk5A.png" /><figcaption>A visual representation of a hub and spoke network, depicting a central node surrounded by other nodes with a connection to the central node.</figcaption></figure><p>Hub and spoke networks are among the simplest networks you can set up. When we think about connecting networks in clouds, we generally have two options. Mesh, and Hub and Spoke. Early on, mesh networks were our only choice in the cloud.</p><figure><img alt="A visual representation of a full mesh network topology (a) and a partial mesh network topology (b). The image shows nodes connected directly to each other. The first image show each node connected to every other node. The second shows some nodes connected to each other." src="https://cdn-images-1.medium.com/max/850/1*va8O4lVinrVRKfI7vl2jTQ.png" /><figcaption>A visual representation of a full mesh network topology (a) and a partial mesh network topology (b). The image shows nodes connected directly to each other. The first image show each node connected to every other node. The second shows some nodes connected to each other.</figcaption></figure><p>For the purposes of this post, I’ll be discussing the AWS offerings. AWS achieved this mesh topology using VPC Peers. At a small scale, VPC Peers are perfect. They are easy to set up and allow nearly identical functionality for peers to interact with each other as if they were on the same VPC. But as you can see in the diagram above, these webs of peers get more complicated as you add VPCs.</p><p>Let’s assume each VPC has 6 subnets, in 3 availability zones, with a route table attached to each subnet. As I add a new peer, I need to update the route for the new peered VPC in every route table. The number of route table entries required to maintain full mess gets pretty large, pretty fast.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*yBeGK7Ng1OrA-e1Lx-pbww.png" /><figcaption>A table showing total routes per peered VPC.</figcaption></figure><p>Keeping up with these routes can be a bit of a pain. It’s possible to mitigate that pain using tools like Terraform to deploy these peers and routes, but even those begin to struggle as you continue to add accounts. A Terraform provider operates on a single AWS account at a time, and running many of these in a single run can prevent you from using default runners at Terraform Cloud and require you to run your own. Also, the runs are slow due to have so many resources and risk AWS API rate limiting.</p><p>But thankfully, this problem has been solved. At the end of 2018, AWS released a product called Transit Gateway, which allowed customers to use a hub and spoke topology.</p><p><a href="https://docs.aws.amazon.com/whitepapers/latest/building-scalable-secure-multi-vpc-network-infrastructure/transit-gateway.html">AWS Transit Gateway</a></p><p>Now, you could attach all of your networks to a Transit Gateway, and use a single route for the entire connected network. By pushing all private traffic through the Transit Gateway, the problem of individual routes for each VPC just goes away.</p><h4>Why haven’t I been using this for the past six years then?</h4><p>All of this is great so far, from a purely connectivity focused standpoint. But as soon as I start to worry about applying security principles to this network, I run into issues. If all I am doing is running EC2 instances that don’t autoscale, everything is fine. My static IP addresses are fantastic for setting up security groups regardless of account. But the moment I want to take advantage of a managed service or a serverless offering, that security paradigm falls apart.</p><p>Both AWS managed services (like RDS, Elastic Load Balancers, and Elasticache) and serverless offerings (like Fargate and Lambda) do not guarantee static IP addresses as instances are created and destroyed. In order to stick to the principle of least privilege you are left with few options. You can break your subnets into smaller pieces, using entire subnets for specific services, and put these subnets into rules on the target resource. But doing this requires quite a bit more IP space than most would want to use, and it doesn’t really allow for growth if a single service needs to scale rapidly. The other (better) option is to take advantage of security group references in security group rules.</p><p>At AWS, you can attach a security group to the source resource, and then another security group to the target. By adding a rule on the target that references the source, you’ve allowed that security group to access the target. This allows for a single Lambda function running on your VPC to access your database if you need.</p><p><a href="https://docs.aws.amazon.com/vpc/latest/userguide/security-group-rules.html#security-group-referencing">Security group rules</a></p><p>This functionality has been available on VPC Peers for quite some time.</p><p><a href="https://docs.aws.amazon.com/vpc/latest/peering/vpc-peering-security-groups.html">Update your security groups to reference peer security groups</a></p><p>Unfortunately, it has not been available on Transit Gateway. This has required organizations that want to take advantage of security best practices to rely on the cumbersome mesh topologies mentioned above.</p><h4>What happened now?</h4><p>After years of asking (begging) AWS to implement this feature, it’s finally here!</p><p><a href="https://aws.amazon.com/blogs/networking-and-content-delivery/introducing-security-group-referencing-for-aws-transit-gateway/">Introducing security group referencing for AWS Transit Gateway | Amazon Web Services</a></p><p>By switching to AWS Transit Gateway, and taking advantage of security group referencing, you can implement a simple network topology for cross account VPCs while still adhering to the principle of least privilege. This is a big win for organizations that like to segment accounts / VPCs while consuming serverless options. This topology is more scalable, reduces unnecessary IP reservations, and improves security.</p><p>The AWS link above does a pretty good job of walking through a Transit Gateway setup. I’ll likely post my own guide in a future update, documenting the setup in Terraform.</p><p>For folks who would like to do more reading on hub and spoke topologies, AWS isn’t the only cloud doing this. Here are some links if you’re up to doing some extra reading:</p><ul><li><a href="https://cloud.google.com/architecture/deploy-hub-spoke-vpc-network-topology">Hub-and-spoke network architecture | Cloud Architecture Center | Google Cloud</a></li><li><a href="https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/hub-spoke-network-topology">Hub-and-spoke network topology - Cloud Adoption Framework</a></li><li><a href="https://www.tufin.com/blog/demystifying-aws-hub-spoke-network-topology">Demystifying AWS Hub and Spoke Network Topology | Tufin</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2fe986f561f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Aurora IO Optimized Storage — Is it worth it?]]></title>
            <link>https://towardsaws.com/aws-aurora-io-optimized-storage-is-it-worth-it-b099dce558c8?source=rss-b8a2ff66e963------2</link>
            <guid isPermaLink="false">https://medium.com/p/b099dce558c8</guid>
            <category><![CDATA[aws-cost-optimization]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[aws-aurora]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Ian Binder]]></dc:creator>
            <pubDate>Mon, 12 Jun 2023 04:50:43 GMT</pubDate>
            <atom:updated>2023-06-12T04:50:43.750Z</atom:updated>
            <content:encoded><![CDATA[<h3>AWS Aurora IO Optimized Storage — Is it worth it?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*liiEufHRivDEtlBR.png" /><figcaption>Database Cost Optimization</figcaption></figure><p>On May 11, 2023 folks who logged in to the AWS Console and navigated to RDS were met with an interesting banner announcing Aurora I/O-Optimized. The launch was coordinated a bit more poorly than previous Aurora launches, with the link in the banner taking you to a webpage that didn’t mention the new product at all, AWS Support Teams being completely unaware that the product existed, and no pricing information anywhere to be found. Other important caveats, like, you can only toggle this feature once every 30 days were not published anywhere at launch. Over the next couple of weeks, the documentation caught up with the product launch, and this became one of the most exciting Aurora releases since the Graviton instances were announced.</p><p>AWS Aurora is a great database. Not only are many of the administrative functions handled for you, but the underlying architecture is just impressive. The incredibly low latency replication between write and read nodes and the high disk IO are among its best features. But that IO comes with a price. It’s only $0.20 per million requests, and that sounds pretty low. But Aurora Postgres only supports instances up to 1 TB of RAM, which sounds like a lot, but when you consider Aurora supports up to 128 TB of storage, you can tell there’s going to be some heavy IO depending on your workloads. Not only that, but you may find yourself paying for more expensive instances just to keep more data in memory and avoid IO costs.</p><p><a href="https://aws.amazon.com/rds/aurora/pricing/">MySQL PostgreSQL Relational Database - Amazon Aurora Pricing - AWS</a></p><p>Aurora is still great though. To get a comparable instance on RDS, you’d end up needing to buy IO optimized disks which come at a premium anyhow, or just run slowly and wait on your general purpose disks to handle all of the workload. But then this announcement came, and there is now an option for folks with IO intensive workloads on Aurora that allows you to save money AND continue to get all of the Aurora features you know and love.</p><p><a href="https://aws.amazon.com/blogs/aws/new-amazon-aurora-i-o-optimized-cluster-configuration-with-up-to-40-cost-savings-for-i-o-intensive-applications/">New - Amazon Aurora I/O-Optimized Cluster Configuration with Up to 40% Cost Savings for I/O-Intensive Applications | Amazon Web Services</a></p><p>How does this work? You pay a premium for both instance costs and storage costs, and nothing at all for IO costs. AWS currently has verbiage on their page that states these instances are for clusters where “I/O costs &gt;25% of total database costs.” That sounds simple enough, but this isn’t always the easiest to check. In a world where you run reserved instances, the math changes a bit, and you can sometimes get bit by databases with high storage costs. There are 3 (main) components that drive the cost of your Aurora instances:</p><ul><li>Instance Count / Type</li><li>Storage Capacity</li><li>IO requests</li></ul><p>To perform a sanity check before switching instances, I built a quick tool that grabs pricing information for both Standard and IO Optimized instances, and compares that to your last month’s usage.</p><p><a href="https://github.com/ianbinder/aws-aurora-io-sanity-check">GitHub - ianbinder/aws-aurora-io-sanity-check</a></p><p>This script is designed to be run as a Lambda. It gives an output with the cost of running cluster in its current configuration (Standard) vs switching to IO Optimized. There’s a bit of code in there for running this cross-account, but that can be taken out pretty easily if you’re just looking for something simple. I hope this helps folks out. Thanks to the AWS Team for the great new feature!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b099dce558c8" width="1" height="1" alt=""><hr><p><a href="https://towardsaws.com/aws-aurora-io-optimized-storage-is-it-worth-it-b099dce558c8">AWS Aurora IO Optimized Storage — Is it worth it?</a> was originally published in <a href="https://towardsaws.com/">Towards AWS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting started with Infrastructure as Code (IaC) — Creating a Terraform Cloud Workspace with…]]></title>
            <link>https://towardsaws.com/getting-started-with-infrastructure-as-code-iac-creating-a-terraform-cloud-workspace-with-c25bd89d2593?source=rss-b8a2ff66e963------2</link>
            <guid isPermaLink="false">https://medium.com/p/c25bd89d2593</guid>
            <category><![CDATA[iac]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[terraform-cloud]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Ian Binder]]></dc:creator>
            <pubDate>Fri, 09 Dec 2022 06:08:37 GMT</pubDate>
            <atom:updated>2022-12-09T06:08:39.042Z</atom:updated>
            <content:encoded><![CDATA[<h3>Getting started with Infrastructure as Code (IaC) — Creating a Terraform Cloud Workspace with Terraform</h3><p>Creating a Terraform cloud workspace using Terraform allows for efficient and automated infrastructure management. With Terraform, users can define and deploy their infrastructure as code, making it easier to version control and collaborate with team members. By creating a Terraform cloud workspace, users can leverage the power of the cloud to manage and provision their infrastructure resources. This allows for scalability and flexibility, as well as the ability to easily make changes and updates to the infrastructure. Overall, using Terraform to create a cloud workspace simplifies and streamlines the process of managing infrastructure. Again, I know this seems a bit meta, but the benefits of deploying your projects and workspaces with an IaC solution are numerous.</p><p>This is Part 4 of my “Getting started with IaC” series. You can find Part 3 here:</p><p><a href="https://towardsaws.com/getting-started-with-infrastructure-as-code-iac-creating-a-gitlab-backed-workspace-in-6d6a5c0ebb81">Getting started with Infrastructure as Code (IaC) — Creating a Gitlab-backed Workspace in…</a></p><p>If we are going to have Terraform manipulate our Terraform Cloud environment, we’re going to need to look up the Terraform provider for Terraform Cloud. The provider is called the Terraform Enterprise Provider (tfe).</p><p><a href="https://registry.terraform.io/providers/hashicorp/tfe/">Terraform Registry</a></p><p>Also, we’ll need a token to be able to authenticate with our Terraform Cloud environment. To issue the token, log in to Terraform Cloud and open your settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5tQL1S7s0XB3-ugXyjg1cA.png" /><figcaption>General Settings — Terraform Cloud</figcaption></figure><p>Once you are here, click the “API tokens” link on the navigation bar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IST1SESC9-BqBg4fkn9bcg.png" /><figcaption>API Tokens — Terraform Cloud</figcaption></figure><p>There are a few types of tokens you can use. Two of these tokens can work for us, the User Token and the Organization Token. I’m not a big fan of applying user tokens to automated tasks, so I am creating an Organization Token. Once the token is created, we need to copy the token to a variable in our workspace. Open your gitlab-projects workspace in a new tab, and choose “Variables” from the navigation bar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EyDDAA0yQgvqYPXZviBXLQ.png" /><figcaption>gitlab-projects — Variables — Terraform Cloud</figcaption></figure><p>Let’s add a new variable and name it tfe_token. Mark it as sensitive and give it a meaningful description. Paste the token from the “API tokens” page into the “Value” field and save the variable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WBnCVIIwLS0WAMzVP4owcA.png" /><figcaption>tfe_token Workspace Variable — Terraform Cloud</figcaption></figure><p>Now that we have a token and have the token added as a variable in our workspace, we are able to write some Terraform! Let’s modify some of the Terraform from the last exercise. First, the terraform block. Here’s the original:</p><pre>terraform {<br><br>  required_providers {<br>    gitlab = {<br>      source  = &quot;gitlabhq/gitlab&quot;<br>      version = &quot;~&gt;3.8&quot;<br>    }<br>  }    <br><br>  backend &quot;remote&quot; {<br>    organization = &quot;binderworld&quot;<br>    workspaces {<br>      name = &quot;gitlab-projects&quot;<br>    }<br>  }<br>  <br>}</pre><p>Now, let’s add the tfe provider:</p><pre>terraform {<br><br>  required_providers {<br>    gitlab = {<br>      source  = &quot;gitlabhq/gitlab&quot;<br>      version = &quot;~&gt;3.8&quot;<br>    }<br><br>    tfe = {<br>      source  = &quot;hashicorp/tfe&quot;<br>      version = &quot;~&gt;0.40&quot;<br>    }<br>  }    <br><br>  backend &quot;remote&quot; {<br>    organization = &quot;binderworld&quot;<br>    workspaces {<br>      name = &quot;gitlab-projects&quot;<br>    }<br>  }<br><br>}  </pre><p>This modified terraform block defines the source of the tfe provider and sets the minimum version. You may notice for version numbers that I’ve used the ~&gt; operator. The ~&gt; operator is a convenient shorthand for allowing the rightmost component of a version to increment. The required_providers block is documented here:</p><p><a href="https://developer.hashicorp.com/terraform/language/providers/requirements">Provider Requirements - Configuration Language | Terraform | HashiCorp Developer</a></p><p>Next we need to import the variable we passed from Terraform Cloud and define the provider itself, passing our token in. We can just add these lines anywhere in our main.tf.</p><pre>variable &quot;tfe_token&quot; {<br>  type = string<br>}<br><br>provider &quot;tfe&quot; {<br>  token = var.tfe_token<br>}</pre><p>Now we need to create the workspace in Terraform Cloud. Documentation for this is available here:</p><p><a href="https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/workspace">Terraform Registry</a></p><p>Because we are connecting our Terraform Cloud workspace to a Version Control System (VCS) repository, we’re going to need the OAuth token for the repository. This is available to us via the GUI if we navigate to Settings and then Providers in Terraform Cloud. But manually grabbing data is an anti-pattern when we’re trying to build re-usable definitions. Instead, let’s create a data object that grabs the token for us. Data objects retrieve data about resources created outside of the current Terraform Workspace.</p><pre>data &quot;tfe_oauth_client&quot; &quot;gitlab&quot; {<br>  organization = &quot;binderworld&quot;<br>  name         = &quot;Gitlab.com&quot;<br>}</pre><p>The tfe_oauth_client data object is documented here:</p><p><a href="https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/data-sources/oauth_client">Terraform Registry</a></p><p>Finally, we can create the workspace resource:</p><pre>resource &quot;tfe_workspace&quot; &quot;aws-sample1&quot; {<br>  name                  = &quot;aws-sample1&quot;<br>  organization          = &quot;binderworld&quot;<br>  execution_mode        = &quot;remote&quot;<br>  auto_apply            = false<br>  file_triggers_enabled = true<br>  terraform_version     = &quot;1.3.6&quot;<br><br>  vcs_repo {<br>    oauth_token_id   = data.tfe_oauth_client.gitlab.oauth_token_id<br>    identifier       = gitlab_project.aws-sample1.path_with_namespace<br>    branch           = &quot;main&quot;<br>  }<br>}</pre><p>Let’s commit our code and see how it goes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j5qhaHXcinegBWMdoNHD5w.png" /><figcaption>Create TF Cloud Workspace — Terraform Cloud</figcaption></figure><p>We can see the plan finished, with one workspace to add. If we expand that out, we can see details about the workspace it wants to create.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*olzAepkjDtotWYMLard2Vw.png" /><figcaption>Workspace Details — Terraform Cloud</figcaption></figure><p>We can scroll down and approve the plan, and leave a comment before running the apply.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J3sdzEzAaq21p1Fql9xhaw.png" /><figcaption>Confirm and Apply Dialogue — Terraform Cloud</figcaption></figure><p>After we confirm, we can see it run.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k2F3Y-efEhFAwvJnK3LEMg.png" /><figcaption>Apply Finished — Terraform Cloud</figcaption></figure><p>Let’s go back to our list of workspaces and make sure we can see the new workspace.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6LFpvEfMTAyDufFmJErE6A.png" /><figcaption>Workspaces — Terraform Cloud</figcaption></figure><p>It looks like the workspace created, but there’s an error. This is not something we need to worry about though. If we look at the error details, we can see this is because there are no files for Terraform to parse.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BaigyZZpXtXEN-VimS6vuw.png" /><figcaption>Plan errored — Terraform Cloud</figcaption></figure><p>Everything is working great, but I have one last suggestion. Even though Terraform flattens everything into a single file, this doesn’t mean we need to work that way. There are some files I create in every project, just to help with organization. These are:</p><ul><li>main.tf — Define the terraform object and requirements</li><li>data.tf — Create data objects, as these can be shared by many resources</li><li>variables.tf — Import variables from Terraform Cloud</li><li>providers.tf — Define all of the providers in one place</li></ul><p>It’s not required at all, but if you want to follow this pattern, the files should look like this at the end:</p><p>main.tf</p><pre>terraform {<br><br>  required_providers {<br>    gitlab = {<br>      source  = &quot;gitlabhq/gitlab&quot;<br>      version = &quot;~&gt;3.8&quot;<br>    }<br><br>    tfe = {<br>      source  = &quot;hashicorp/tfe&quot;<br>      version = &quot;~&gt;0.40&quot;<br>    }<br>  }    <br><br>  backend &quot;remote&quot; {<br>    organization = &quot;binderworld&quot;<br>    workspaces {<br>      name = &quot;gitlab-projects&quot;<br>    }<br>  }<br>}  <br><br>resource &quot;gitlab_project&quot; &quot;aws-sample1&quot; {<br>  name         = &quot;aws-sample1&quot;<br>  description  = &quot;Our First AWS Project&quot;<br>  namespace_id = data.gitlab_group.default.id<br><br>  initialize_with_readme = true<br>}<br><br>resource &quot;tfe_workspace&quot; &quot;aws-sample1&quot; {<br>  name                  = &quot;aws-sample1&quot;<br>  organization          = &quot;binderworld&quot;<br>  execution_mode        = &quot;remote&quot;<br>  auto_apply            = false<br>  file_triggers_enabled = true<br>  terraform_version     = &quot;1.3.6&quot;<br><br>  vcs_repo {<br>    oauth_token_id   = data.tfe_oauth_client.gitlab.oauth_token_id<br>    identifier       = gitlab_project.aws-sample1.path_with_namespace<br>    branch           = &quot;main&quot;<br>  }<br>}</pre><p>data.tf</p><pre># Gitlab Objects<br><br>data &quot;gitlab_group&quot; &quot;default&quot; {<br>  full_path = &quot;binderworld&quot;<br>}<br><br># Terraform Cloud Objects<br><br>data &quot;tfe_oauth_client&quot; &quot;gitlab&quot; {<br>  organization = &quot;binderworld&quot;<br>  name         = &quot;Gitlab.com&quot;<br>}</pre><p>providers.tf</p><pre>provider &quot;gitlab&quot; {<br>  token = var.gitlab_token<br>}<br><br>provider &quot;tfe&quot; {<br>  token = var.tfe_token<br>}</pre><p>variables.tf</p><pre>variable &quot;gitlab_token&quot; {<br>  type = string<br>}<br><br>variable &quot;tfe_token&quot; {<br>  type = string<br>}</pre><p>If you make these changes and commit, you should see your workspace in the “Planned and finished” status. That means that after the plan ran, there were no changes to make.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c25bd89d2593" width="1" height="1" alt=""><hr><p><a href="https://towardsaws.com/getting-started-with-infrastructure-as-code-iac-creating-a-terraform-cloud-workspace-with-c25bd89d2593">Getting started with Infrastructure as Code (IaC) — Creating a Terraform Cloud Workspace with…</a> was originally published in <a href="https://towardsaws.com/">Towards AWS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting started with Infrastructure as Code (IaC) — Creating a Gitlab-backed Workspace in…]]></title>
            <link>https://towardsaws.com/getting-started-with-infrastructure-as-code-iac-creating-a-gitlab-backed-workspace-in-6d6a5c0ebb81?source=rss-b8a2ff66e963------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d6a5c0ebb81</guid>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[terraform-cloud]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[iac]]></category>
            <dc:creator><![CDATA[Ian Binder]]></dc:creator>
            <pubDate>Thu, 08 Dec 2022 05:00:30 GMT</pubDate>
            <atom:updated>2022-12-09T14:57:31.588Z</atom:updated>
            <content:encoded><![CDATA[<h3>Getting started with Infrastructure as Code (IaC) — Creating a Gitlab-backed Workspace in Terraform Cloud</h3><p>GitLab is a powerful tool for managing software development projects, and Terraform is a popular infrastructure-as-code tool that allows users to define and manage their cloud resources using declarative configuration files. In this post, we will show you how to use Terraform to create GitLab projects, which can help streamline your project management and make it easier to automate the provisioning of your GitLab infrastructure. With Terraform, you can define your GitLab projects in a simple, version-controlled configuration file, and then use a few simple commands to create and manage those projects. Let’s get started!</p><p>This is Part 3 of my “Getting started with IaC” series. You can find Part 2 here:</p><p><a href="https://towardsaws.com/getting-started-with-infrastructure-as-code-iac-setting-up-terraform-cloud-b4fe8cfe16e2">Getting started with Infrastructure as Code (IaC) — Setting up Terraform Cloud</a></p><p>So we have Gitlab set up as a Version Control System (VCS) provider in Terraform Cloud, and now we’re ready to write some Terraform. Our first Terraform project will be a project that allows us to create new projects via Terraform. This may feel a little meta, but it will help us keep track of things as we grow, and apply the same change controls to our Gitlab and Terraform Cloud accounts that we do to our other infrastructure providers.</p><p>First, let’s head over to gitlab and create a new project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ER-5_dcQ9QdbTpVU0-0qGg.png" /><figcaption>Project List — Gitlab.com</figcaption></figure><p>Once you are logged into Gitlab and can see your Project list, click the “New project” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6sKJkbF-KnHrhZdWZXqYgQ.png" /><figcaption>Create new project — Gitlab.com</figcaption></figure><p>You’ll be given some options for the type of project you want to create. Choose “Create blank project”. Then you’ll be prompted to provide more detail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yzK0lTC9vslCyZCJGDxGng.png" /><figcaption>Create blank project — Gitlab.com</figcaption></figure><p>This project will be named gitlab-projects. Note the project name and the project slug are the same. Make sure that your project URL is using your group instead of your personal information. This will ensure you can collaborate in the future. Set the Visibility Level to Private and Initialize with a README. Once your project is created, head back to Terraform Cloud.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bw5rfSKnaTcRCDsepJFjAw.png" /><figcaption>Workspaces landing page — Terraform Cloud</figcaption></figure><p>Click the “Create a workspace” button to create your first workspace. Choose Version control workflow when prompted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j_stzC_ne1Lmybe4JssK8Q.png" /><figcaption>Create a new Workspace — Terraform Cloud</figcaption></figure><p>You should see the Gitlab.com provider we created in the last exercise. Click on that to see recent projects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1DAWSPZMseSjclP06IklLw.png" /><figcaption>Connect to a version control provider — Terraform Cloud</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lxz-8t7WqsDeKkyrFKCKQg.png" /><figcaption>Choose a repository — Terraform Cloud</figcaption></figure><p>The items listed will be items your API key as access to, sorted by most recently edited. Choose the gitlab-projects project we created earlier. You’ll then be prompted to configure settings. Ensure you give the workspace a meaningful description.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6d416jRwBtdBSZpDIIgLag.png" /><figcaption>Configure settings — Terraform Cloud</figcaption></figure><p>And that’s it! Our workspace is created. There’s a prompt to set up variables if we want to, but we’ll come back to that later. There is one last thing to do before we get started writing Terraform. Using providers requires credentials. If we want to programmatically write to Gitlab, we need to give Terraform permissions to do that. This means we’ll need to issue an API key to act on our behalf. Head back to Gitlab and click the icon with your image in the top right and choose Edit Profile.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H3Hm5eWyxK583eW-byG3dw.png" /><figcaption>Projects — Gitlab.com</figcaption></figure><p>Then click Access Tokens. You’ll need to create a token with API permissions. Go ahead and fill out the form and you’ll be given a token.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3J3Io6MOszIBw2ibrsvOFg.png" /><figcaption>Personal Access Tokens — Gitlab.com</figcaption></figure><p>Head back to Terraform Cloud and proceed to configure variables for your workspace.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yxq-HVF2QGijcjdTYRT9bg.png" /><figcaption>gitlab-projects workspace — Terraform Cloud</figcaption></figure><p>Now we can add the token as a variable. This way, we are not storing a credential in plain text in our Terraform. I have named the variable gitlab_token, and set it to sensitive. Place the token in the Value box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h0NG15cJKrPZOHxilnqkvQ.png" /></figure><p>Make sure to click “Save variable” when you’re done. Now it’s time to write some Terraform! If you’ve never written Terraform before, it is important to note that Terraform will treat every file with a .tf extension in a folder as one large flat file. The placement of objects in files within a folder is an organizational unit for humans only. You cannot have two resources or variables with the same name in two different files. With that said, let’s get started. For the purposes of the exercise, I’m going to just do little snippets at a time, but there’s no reason you can’t do this all at once.</p><p>To start, let’s create a main.tf file in our gitlab-projects project.</p><pre># The terraform object defines required versions for providers<br># and where the backend (state) will live<br><br>terraform {<br><br>  required_providers {<br>    gitlab = {<br>      source  = &quot;gitlabhq/gitlab&quot;<br>      version = &quot;~&gt;3.8&quot;<br>    }<br>  }    <br><br>  backend &quot;remote&quot; {<br>    organization = &quot;binderworld&quot;<br>    workspaces {<br>      name = &quot;gitlab-projects&quot;<br>    }<br>  }<br>  <br>}<br><br># First we import variables that were passed in from Terraform Cloud<br><br>variable &quot;gitlab_token&quot; {<br>  type = string<br>}<br><br># Then we define providers  <br># This is where we use the token passed to us by Terraform Cloud<br><br>provider &quot;gitlab&quot; {<br>  token = var.gitlab_token<br>}<br><br># Data objects retrieve data about resources created outside <br># of the current Terraform workspace<br># This data object will grab the ID of my Gitlab group<br># You will need to change the &quot;full_path&quot; to match the group you created<br><br>data &quot;gitlab_group&quot; &quot;default&quot; {<br>  full_path = &quot;binderworld&quot;<br>}<br><br># Resource objects create things and maintain their state<br># This resource will create a new gitlab project<br><br>resource &quot;gitlab_project&quot; &quot;aws-sample1&quot; {<br>  name         = &quot;aws-sample1&quot;<br>  description  = &quot;Our First AWS Project&quot;<br>  namespace_id = data.gitlab_group.default.id<br><br>  initialize_with_readme = true<br>}</pre><p>You’ll notice for version numbers that I’ve used the ~&gt; operator. The ~&gt; operator is a convenient shorthand for allowing the rightmost component of a version to increment. Setting up providers is documented here:</p><p><a href="https://developer.hashicorp.com/terraform/language/providers/requirements">Provider Requirements - Configuration Language | Terraform | HashiCorp Developer</a></p><p>Also, you can see I am using the Gitlab provider. Documentation for this is provided here:</p><p><a href="https://registry.terraform.io/providers/gitlabhq/gitlab/3.20.0">Terraform Registry</a></p><p>You can find most providers documentation in the Terraform Registry. Once you have your main.tf defined, go ahead and commit it. For your first run in Terraform Cloud, you will need to click Start a new run. This will be in the actions dropdown.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aFAFSItGskUDb82nMr9hDg.png" /><figcaption>Start a new run — Terraform Cloud</figcaption></figure><p>Give your run a name like, Initial Run, and click “Start run”. If everything goes well, you should see Terraform run its plan and tell you that it has 1 to create. Terraform plans will return counts on objects to create, modify, and destroy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y1VeT1LfIGlynYQtp-GWkQ.png" /><figcaption>Initial Run — Terraform Cloud</figcaption></figure><p>If you click the “+” next to the gitlab_project.aws-sample1 resource, it will give you more information about the resource it wants to create.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tKZiwtLBRXwNYPuamo53NQ.png" /><figcaption>Plan finished — Terraform Cloud</figcaption></figure><p>Scroll to the bottom and you’ll see you’re being prompted to approve the change. You can set it so workspaces auto-apply if you like, but for the purposes of this exercise, we’ll leave the prompts on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eCuw9AFeAsm8C9XSwoCESg.png" /><figcaption>Approve the apply — Terraform Cloud</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wNtY2-SdkRFbyrrEoy1xvQ.png" /><figcaption>Leave a note with confirmation — Terraform Cloud</figcaption></figure><p>It is not required that you leave a comment on approvals, but it’s a good practice for change control. Many organizations require that the person who reviews a change be different than the person who created the change. This helps for QA and change control documentation. Once you click “Confirm Plan”, the apply will run.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AJC2zF96AUkv_F5ZuuG7Bw.png" /><figcaption>Apply finished — Terraform Cloud</figcaption></figure><p>In addition to seeing that the apply finished, you’ll now see a state version was created. This state includes all of the details about the objects you created. State files can contain sensitive information, so it is vital you restrict access to these state files as much as possible.</p><p>That’s it for this part. In the next section, we’ll have Terraform add the new project as a workspace to Terraform Cloud.</p><p><a href="https://towardsaws.com/getting-started-with-infrastructure-as-code-iac-creating-a-terraform-cloud-workspace-with-c25bd89d2593">Getting started with Infrastructure as Code (IaC) — Creating a Terraform Cloud Workspace with…</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d6a5c0ebb81" width="1" height="1" alt=""><hr><p><a href="https://towardsaws.com/getting-started-with-infrastructure-as-code-iac-creating-a-gitlab-backed-workspace-in-6d6a5c0ebb81">Getting started with Infrastructure as Code (IaC) — Creating a Gitlab-backed Workspace in…</a> was originally published in <a href="https://towardsaws.com/">Towards AWS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting started with Infrastructure as Code (IaC) — Setting up Terraform Cloud]]></title>
            <link>https://towardsaws.com/getting-started-with-infrastructure-as-code-iac-setting-up-terraform-cloud-b4fe8cfe16e2?source=rss-b8a2ff66e963------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4fe8cfe16e2</guid>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[iac]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[terraform-cloud]]></category>
            <dc:creator><![CDATA[Ian Binder]]></dc:creator>
            <pubDate>Tue, 06 Dec 2022 15:58:09 GMT</pubDate>
            <atom:updated>2022-12-08T14:46:54.070Z</atom:updated>
            <content:encoded><![CDATA[<h3>Getting started with Infrastructure as Code (IaC) — Setting up Terraform Cloud</h3><p>Terraform Cloud is a great tool for managing infrastructure as code. It allows teams to collaborate on infrastructure deployments and manage their infrastructure in a consistent and predictable manner. With Terraform Cloud, teams can easily version and track changes to their infrastructure, as well as automate the provisioning and management of their infrastructure. Additionally, Terraform Cloud integrates with a wide range of cloud providers, making it easy to manage infrastructure across multiple environments and platforms. Overall, Terraform Cloud is a powerful tool that can help teams improve their infrastructure management processes and increase productivity.</p><p>This is Part 2 of my “Getting started with IaC” series. You can find Part 1 here:</p><p><a href="https://towardsaws.com/getting-started-with-infrastructure-as-code-iac-setting-up-gitlab-871516c9d738">Getting started with Infrastructure as Code (IaC) — Setting up Gitlab</a></p><p>Now that we have our Gitlab account setup, it is time to create a Terraform Cloud account. To create an account, go to <a href="https://app.terraform.io/">https://app.terraform.io/</a>.</p><p><a href="https://app.terraform.io/">Terraform Cloud by HashiCorp</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WLoltfqqyFfWKyhbqybAAw.png" /><figcaption>Terraform Login Screen</figcaption></figure><p>Once you are at the sign in page, click the link near the bottom to create a free account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-I-QgolhZ430_D0ykhSAwQ.png" /><figcaption>Create an account — Terraform Cloud</figcaption></figure><p>Just put in a username, email, and password and you’ll be able to log create your account. Once you fill out this information, you’ll be asked to verify your email. Click the link on the email you receive and that’s it! Your account is ready to go. Head back to the Terraform Cloud console and you’ll be prompted with a “Getting Started” message.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dBvb_W8OD3bTOJm3e2DECA.png" /><figcaption>Getting Started — Terraform Cloud</figcaption></figure><p>For this exercise, I’m going to choose Start from scratch, but you can choose one of the others if it fits your use case better. After clicking Start from scratch, there’s a prompt to provide an organization name. Like the group name in the last Gitlab exercise, this will define the path for all of your workspaces.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3t3TPi-gSxCTcYWLtAEeXA.png" /><figcaption>Create a new organization — Terraform Cloud</figcaption></figure><p>Now that the organization is created it is time to set up the workflow. There will be a prompt to Choose your workflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hueXdereM9t32mPYBwe1mA.png" /><figcaption>Choose your workflow — Terraform Cloud</figcaption></figure><p>Choose “Version control workflow”. You’ll then be prompted to choose a version control provider. Choose Gitlab.com.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1TJNxtBDUiGL4fy831KsLg.png" /><figcaption>Choose version control provider — Terraform Cloud</figcaption></figure><p>Now it is time to set up the provider. This bit will require work in both Gitlab and Terraform Cloud.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f4UmYCCqHmb39uLaawwSvg.png" /><figcaption>Set up provider — Terraform Cloud</figcaption></figure><p>Click the link to “register a new OAuth Application” and it will open the page in Gitlab. You can click the copy icons to copy the Name and Redirect URI, and paste those values in the Gitlab page. Make sure to check the api checkbox. Once you’ve created the application in Gitlab, you’ll be given an Application ID and Secret to enter into the Terraform Cloud page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oZHEscvCHbFkJRrtVasBzg.png" /><figcaption>Add new application — Gitlab.com</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xEzDXCgj_WOEY6NviZcjPQ.png" /><figcaption>Authorize application — Gitlab.com</figcaption></figure><p>Finally, you’ll be asked to authorize the application. Click “Authorize” and you are good to go. Back in Terraform Cloud, you’ll be prompted to add an SSH key. That’s not necessary for this exercise, so you can choose the option to “Skip and Finish”. And that’s it. We’ve created the integration.</p><p>In the next section, we’ll start writing some Terraform.</p><p><a href="https://towardsaws.com/getting-started-with-infrastructure-as-code-iac-creating-a-gitlab-backed-workspace-in-6d6a5c0ebb81">Getting started with Infrastructure as Code (IaC) — Creating a Gitlab-backed Workspace in…</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4fe8cfe16e2" width="1" height="1" alt=""><hr><p><a href="https://towardsaws.com/getting-started-with-infrastructure-as-code-iac-setting-up-terraform-cloud-b4fe8cfe16e2">Getting started with Infrastructure as Code (IaC) — Setting up Terraform Cloud</a> was originally published in <a href="https://towardsaws.com/">Towards AWS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting started with Infrastructure as Code (IaC) — Setting up Gitlab]]></title>
            <link>https://towardsaws.com/getting-started-with-infrastructure-as-code-iac-setting-up-gitlab-871516c9d738?source=rss-b8a2ff66e963------2</link>
            <guid isPermaLink="false">https://medium.com/p/871516c9d738</guid>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[iac]]></category>
            <category><![CDATA[ssh]]></category>
            <dc:creator><![CDATA[Ian Binder]]></dc:creator>
            <pubDate>Tue, 06 Dec 2022 04:17:53 GMT</pubDate>
            <atom:updated>2022-12-06T17:27:46.013Z</atom:updated>
            <content:encoded><![CDATA[<h3>Getting started with Infrastructure as Code (IaC) — Setting up Gitlab</h3><p>Infrastructure as Code (IaC) is a powerful approach to managing and deploying IT infrastructure that has become increasingly popular in recent years. IaC enables you to define your infrastructure using declarative configuration files that can be versioned, shared, and reviewed just like software code. This allows you to automate the process of provisioning and managing your infrastructure, making it more efficient, repeatable, and scalable.</p><p>This guide will start at a very beginner level, walking you through setting up accounts, connecting them in useful ways, and building an application. There is no requirement to use the same tools as I am when setting these up, but these are just the tools I am most comfortable with. They are:</p><ul><li>Gitlab</li><li>VS Code</li><li>Terraform Cloud</li><li>Amazon Web Services (AWS)</li><li>Cloudflare</li></ul><p>Downloading and installing VS Code is easy enough. Just visit <a href="https://code.visualstudio.com/">https://code.visualstudio.com/</a> and download the most recent version for your operating system. Once you have it downloaded, just run the installer and you’re ready to go. There’s not much configuration needed, though we’ll add some extensions as we go.</p><p>Now we’re ready to set up our Gitlab account. Open up <a href="https://about.gitlab.com/">https://about.gitlab.com</a> and sign up for a free trial account.</p><p><a href="https://about.gitlab.com/">The most-comprehensive AI-powered DevSecOps platform</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0FowL5bbjYCz_Z-r3o-lxg.png" /><figcaption>Gitlab splash page</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jdFTCXf1eRrT6Dwp3WviZw.png" /><figcaption>Sign Up Screen</figcaption></figure><p>Once you sign up and confirm your email you are ready to get started! The next prompts will collect some basic information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*htVzEszSezkMxLWDyuGeZg.png" /><figcaption>Gitlab Personalization</figcaption></figure><p>Finally, you’ll be asked for the name of your first group / project. Your group name will impact the path of every project you publish, so you should keep that in mind when deciding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I4aKDCgDgYayrXflwZkIwA.png" /><figcaption>Group / Project Creation</figcaption></figure><p>Now that you’re all set up with Gitlab, you’ll need to allow your local SSH keys to interact with Gitlab. This is done at the user level. To set this up, click the icon in the top right with your user icon and choose Preferences.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K3ldJm9wV_-lUPrMZDt5LQ.png" /><figcaption>Gitlab Project List</figcaption></figure><p>Then navigate to SSH Keys</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fL-HgueVkIovkqtTKmtZpg.png" /><figcaption>Gitlab User Preferences</figcaption></figure><p>If you are unsure how to find or generate your key, the folks at Gitlab have a handy guide for getting this done.</p><p><a href="https://docs.gitlab.com/ee/user/ssh.html">Use SSH keys to communicate with GitLab | GitLab</a></p><p>On Windows, I use PuttyGen for key generation. Otherwise, I use sshkeygen. PuttyGen is part of the Putty installation and is available here:</p><p><a href="https://www.putty.org/">Download PuTTY - a free SSH and telnet client for Windows</a></p><p>When your key is generated / located and entered into Gitlab, you are ready to clone your project! Open the Command Pallette in VS Code. This is under the View menu. On Mac you can reach this with the shortcut, command+shift+P. Choose Git: Clone. You’ll be prompted for the repository URL. You can find this in your Gitlab project by opening the project and clicking the Clone button. Make sure to copy the Clone with SSH option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*INBAPboQEORw1CJ6pJF6kA.png" /><figcaption>Gitlab Project Page</figcaption></figure><p>Paste this value into VS Code and you’ll be prompted for a target directory. Choose the directory you want to clone to, and that’s it! Gitlab is set up and we’re ready to start building.</p><p>Continue with Part 2: Setting up Terraform Cloud</p><p><a href="https://towardsaws.com/getting-started-with-infrastructure-as-code-iac-setting-up-terraform-cloud-b4fe8cfe16e2">Getting started with Infrastructure as Code (IaC) — Setting up Terraform Cloud</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=871516c9d738" width="1" height="1" alt=""><hr><p><a href="https://towardsaws.com/getting-started-with-infrastructure-as-code-iac-setting-up-gitlab-871516c9d738">Getting started with Infrastructure as Code (IaC) — Setting up Gitlab</a> was originally published in <a href="https://towardsaws.com/">Towards AWS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Cross Account Security for Private Serverless Applications]]></title>
            <link>https://towardsaws.com/aws-cross-account-security-for-private-serverless-applications-3288883a0189?source=rss-b8a2ff66e963------2</link>
            <guid isPermaLink="false">https://medium.com/p/3288883a0189</guid>
            <category><![CDATA[aws-vpc]]></category>
            <category><![CDATA[aws-transit-gateway]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[aws-fargate]]></category>
            <dc:creator><![CDATA[Ian Binder]]></dc:creator>
            <pubDate>Fri, 02 Sep 2022 19:57:58 GMT</pubDate>
            <atom:updated>2022-09-02T19:57:58.001Z</atom:updated>
            <content:encoded><![CDATA[<p>Cloud native architecture principles state that you should practice “defense in depth.” Every service should be internet facing, and have its own authentication layer with minimal trust between components. This sounds great on paper, but for many simple applications, can cause you to end up over-engineering simple projects. Sometimes, building something on a private, trusted network is the fastest way to get things done, and it can still be done safely in the cloud.</p><p><a href="https://cloud.google.com/blog/products/application-development/5-principles-for-cloud-native-architecture-what-it-is-and-how-to-master-it">5 principles for cloud-native architecture-what it is and how to master it | Google Cloud Blog</a></p><h3>Serverless compute services in VPC at AWS</h3><p>The two most common serverless compute services at AWS at the time of this writing are Lambda and Fargate. Each of these is able to run within a VPC. This works by creating an Elastic Network Interface (ENI) and associating it with a subnet inside of one of your VPCs. The ENI will pull an IP address at random from the available pool of IP addresses in the subnet. You’ll notice that if you want to run Lambda inside of a VPC, you’ll need to grant the role additional IAM permissions. Here is the canned policy “AWSLambdaVPCAccessExecutionRole”:</p><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;logs:CreateLogGroup&quot;,<br>                &quot;logs:CreateLogStream&quot;,<br>                &quot;logs:PutLogEvents&quot;,<br>                &quot;ec2:CreateNetworkInterface&quot;,<br>                &quot;ec2:DescribeNetworkInterfaces&quot;,<br>                &quot;ec2:DeleteNetworkInterface&quot;,<br>                &quot;ec2:AssignPrivateIpAddresses&quot;,<br>                &quot;ec2:UnassignPrivateIpAddresses&quot;<br>            ],<br>            &quot;Resource&quot;: &quot;*&quot;<br>        }<br>    ]<br>}</pre><p>The difference between this policy and the basic execution policy are those EC2 actions that allow for creating, assigning, and destroying those network interfaces. The same principles apply to containers running on Fargate.</p><p>So let’s say we have an application running in Account A that needs to access an RDS instance in Account B. How can we allow the service in Account A to access the instance securely? There are a few options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1ltRhAHSqN_ZMoUUFLRKng.png" /><figcaption>A service running across two private subnets on Fargate needs to access an Aurora instance in a private subnet in a different account.</figcaption></figure><h3>Option 1: Peering</h3><p>Let me start by saying that if you are running an organization with many accounts and you want them all to share the same network, peering is awful. You end up with a mesh topology, which is frankly difficult to manage, especially at scale. The best tool for connecting VPCs from all of your disparate accounts is to use Transit Gateway. I love Transit Gateway. I love the hub and spoke topology. But it has a pretty big shortcoming.</p><pre>Security Group Referencing on Amazon VPC is not supported at launch. Spoke Amazon VPCs cannot reference security groups in other spokes connected to the same AWS Transit Gateway.</pre><pre><a href="https://aws.amazon.com/transit-gateway/faqs/">https://aws.amazon.com/transit-gateway/faqs/</a></pre><p>Does this mean you can’t use Transit Gateway at all for this? No, but I’ll get to that later. The best solution for this scenario is to use VPC Peering, specifically for the ability to reference security groups in other VPCs.</p><h4>How does it work?</h4><p>In order to accomplish this, you need to create a security group in both accounts. The security group in Account A will be associated with the either the Lambda or the Fargate instance. Don’t worry about security group rules quite yet. Next, associate the security group in Account B with the Aurora database cluster (make sure it is applied to all instances). Now you can create a security group rule for each on the security groups. In Account A, and an egress rule where the destination is 123456789012/sg-1a2b3c4d (Account B ID / Security Group B ID). In Account B, and an ingress rule where the destination is 234567890123/sg-2b3c4d5e (Account AID / Security Group A ID). This will allow traffic from any instance of your serverless application, regardless of which subnet / AZ it was instantiated in to access your database instance, regardless of which subnet the active node is in. It accomplishes this without allowing all systems within those subnets to access the database, thus securing the database on the network layer as much as possible while still allowing cross account access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6enCFW4UdsH0nA91AhR8Lw.png" /></figure><h3>Option 2: Transit Gateway</h3><p>If you’re like me, you hate having to set those peers up, especially if you already have the Transit Gateway in place. You have this beautiful hub and spoke and you want to use it. Well, if you left yourself some available IP space in your VPC in Account A, you’re in luck! But before you get excited, this solution requires a bit more capacity planning than the previous solution, and has some drawbacks as well. First, you’ll need a good idea of how many ENIs will be consumed by your application. Second, if you have multiple database clusters in the same subnet in Account B, you won’t be able to single out a specific cluster. Moving databases to different subnets is possible, but is not a particularly fun, easy, or non-interruptive procedure.</p><h4>Specialized Subnets</h4><p>The trick is to create specialized subnets for the applications that need to perform this cross account access. In AWS, it is possible to create subnets with as few as 14 usable IP addresses. In Account A, create some small subnets (or large if your application is going to need more ENIs), at least 3 spread across 3 availability zones for a production application. For this example we can use:</p><ul><li>10.100.100.0/28</li><li>10.100.100.16/28</li><li>10.100.100.32/28</li></ul><p>Let’s pretend that our database cluster already exists in with a replica in another subnet, and is the only resource in those subnets. The subnet ranges are:</p><ul><li>10.100.200.0/28</li><li>10.100.200.16/28</li></ul><p>Now we just have to create security groups like in the first example. Account A gets a security group attached to the services, with egress rules that allow traffic to 10.100.200.0/28 and 10.100.200.16/28. It is a good practice to use the description field to document the account and subnet these ranges are in. Then we create a security group in Account B with an ingress rule to allow traffic from 10.100.100.0/28, 10.100.100.16/28, and 10.100.100.32/28. Again, putting meaningful descriptions will make your life easier later. This setup should allow you to be just as secure as the previous model.</p><h3>Wrapping things up</h3><p>I am sure (hopeful) that at some point in the future AWS Transit Gateway will support cross account security group references. Until then, these methods should help you secure your serverless applications. I hope this was helpful for folks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3288883a0189" width="1" height="1" alt=""><hr><p><a href="https://towardsaws.com/aws-cross-account-security-for-private-serverless-applications-3288883a0189">AWS Cross Account Security for Private Serverless Applications</a> was originally published in <a href="https://towardsaws.com/">Towards AWS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>